$title Tests on GPE $stitle Problem from Pronzato and Walter $ontext -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- Purpose: Tests -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- $offtext * activates the use of end-of-line comments $Oneolcom * end-of-line comment character $eolcom # $offlog # turn off line logging $offupper # forces GAMS to display mixed upper- and lowercase $offsymxref # off symbol cross reference listing $offsymlist # off symbol list $offdigit # off number precision check *$offlisting # turn off echoing input lines to listing file $onempty # Data entites can be empty option limrow=0; # number of cases output in the LST file for each named eq. option limcol=0; # number of cases output in the LST file for each named var. option decimals=8; # number of decimals being displayed in the output $version 240 # Force a compilation error if GAMS Rev 240 or higher is not used file screen / '' /; # Define screen channel screen.nr=0; * ------------------- * Problem definitions| *-------------------- $setglobal NP 2 # number of parameters $setglobal NE 2 # number of experiments * Data sets: SET i 'number of support points' /1*%NP%/; SET j 'number of experiments' /1*%NE%/; * Numerical data: * --------------- PARAMETER pE_b(i) 'parameters target values' /1 1.15, 2 1.28/; PARAMETER eLow 'minimum error' /-0.05/; PARAMETER eUp 'maximum error' /0.05/; * * Variables: POSITIVE VARIABLES x(j) 'values of x' pLow(i) 'parameters lower values' pUP(i) 'parameters upper values' pLOW_b(i) 'parameters lower values' pUP_b(i) 'parameters upper values'; VARIABLES ort 'objective'; * Equations: *----------- EQUATIONS * equations for the problem * 1. fixed lower bounds eq_low_p1_low(j) 'equation for lower relative to p1 for minimum error' eq_low_p1_up(j) 'equation for lower relative to p1 for maximum error' eq_low_p2_low(j) 'equation for lower relative to p2 for minimum error' eq_low_p2_up(j) 'equation for lower relative to p2 for maximum error' * 2. fixed upper bounds eq_up_p1_low(j) 'equation for upper relative to p1 for minimum error' eq_up_p1_up(j) 'equation for upper relative to p1 for maximum error' eq_up_p2_low(j) 'equation for upper relative to p2 for minimum error' eq_up_p2_up(j) 'equation for upper relative to p1 for maximum error' * 3. ordering relations eq_UP_b_UP(i) 'relation between upper bounds for p and upper values' eq_UP_E(i) 'relation between upper bounds for p and expected values' eq_LOW_E(i) 'relation between lower bounds for p and lower values' eq_Low_b_LOW(i) 'relation between lower bounds for p and lower values' * 4. objective object 'objective functions (A-opt)'; * * Equations listing: eq_low_p1_low(j) .. pE_b('1')*exp(pE_b('2')*x(j))-pLow('1')*exp(pLOW_b('2')*x(j)) =g= eLow; eq_low_p1_up(j) .. pE_b('1')*exp(pE_b('2')*x(j))-pLow('1')*exp(pLOW_b('2')*x(j)) =l= eUp; eq_low_p2_low(j) .. pE_b('1')*exp(pE_b('2')*x(j))-pLOW_b('1')*exp(pLow('2')*x(j)) =g= eLow; eq_low_p2_up(j) .. pE_b('1')*exp(pE_b('2')*x(j))-pLOW_b('1')*exp(pLow('2')*x(j)) =l= eUp; eq_up_p1_low(j) .. pE_b('1')*exp(pE_b('2')*x(j))-pUP('1')*exp(pUP_b('2')*x(j)) =g= eLow; eq_up_p1_up(j) .. pE_b('1')*exp(pE_b('2')*x(j))-pUP('1')*exp(pUP_b('2')*x(j)) =l= eUp; eq_up_p2_low(j) .. pE_b('1')*exp(pE_b('2')*x(j))-pUP_b('1')*exp(pUP('2')*x(j)) =g= eLow; eq_up_p2_up(j) .. pE_b('1')*exp(pE_b('2')*x(j))-pUP_b('1')*exp(pUP('2')*x(j)) =l= eUp; * eq_UP_b_UP(i) .. pUP_b(i)-pUP(i) =g= 0; eq_UP_E(i) .. pUP(i)-pE_b(i) =g= 0; eq_LOW_E(i) .. pE_b(i)-pLow(i) =g= 0; eq_Low_b_LOW(i) .. pLow(i)-pLOW_b(i) =g= 0; * object .. ort =e= sum(i, pUP(i)-pLow(i)); * * problem model orthot /eq_low_p1_low, eq_low_p1_up, eq_low_p2_low, eq_low_p2_up, eq_up_p1_low, eq_up_p1_up, eq_up_p2_low, eq_up_p2_up, eq_UP_b_UP, eq_UP_E, eq_LOW_E,eq_Low_b_LOW, object/; * * new model with macros (first the macro for lower bound of the error) * here s is for the parameter number; t is for lower and upper (1a and 2) and * m is for the elements in jth. vector $macro lb_error(s, t, m) \ equation eqlb_&s&t&m; \ eq_lb_&s_&t_&m .. pE_b('1')*exp(pE_b('2')*x) =e= 0; * invokation of macros lb_error(1, 1) * parameters for solving option optcr = 1.0e-8; option optca = 1.0e-9; option iterlim = 2000000000; option domlim = 1000; option nlp = conopt; option bratio = 1; option decimals = 8; * * Initialization and bounds: *----------- pLow.lo(i) = pE_b(i)-1.0; pLow.up(i) = pE_b(i)+1.0; pLow.l(i) = pE_b(i); pUP.lo(i) = pE_b(i)-1.0; pUP.up(i) = pE_b(i)+1.0; pUP.l(i) = pE_b(i); pLOW_b.lo(i) = pLow.lo(i); pLOW_b.up(i) = pUp.up(i); pUP_b.lo(i) = pLow.lo(i); pUP_b.up(i) = pUp.up(i); * *x.fx('1') = -1.0; x.up(j) = 1.0; * * * solving the problem solve orthot using nlp maximizing ort; display pLow.l; display pUP.l;