moo1.gms : Test libInclude tool moo

Description

This test checks the expected behavior of libInclude tool moo for multi-objective optimization.

Contributor: Aileen Böhme, January 2024


Small Model of Type : GAMS


Category : GAMS Test library


Main file : moo1.gms

$title 'Test libInclude tool moo' (MOO1, SEQ=949)
$onText
This test checks the expected behavior of libInclude tool moo for multi-objective optimization.

Contributor: Aileen Böhme, January 2024
$offText


$log --- Using Python library %sysEnv.GMSPYTHONLIB%

* SET UP TEST MODELS:

$onEcho > cplex.opt
threads 1
$offEcho

*** EPSCM model from model library ***
$onEchoV > epscm.gms
$inlineCom [ ]

Set
   p       'power generation units' / Lignite, Oil, Gas, RES /
   i       'load areas'             / base, middle, peak     /
   pi(p,i) 'availability of unit for load types' / Lignite.(base,middle)
                                                   Oil.(middle,peak), Gas.set.i
                                                   RES.(base, peak)            /
   es(p)   'endogenous sources'  / Lignite, RES /
   k       'objective functions' / cost, CO2emission, endogenous /
   points  'pareto points' / point1*point10000 /;

$set min -1
$set max +1

Parameter dir(k) 'direction of the objective functions'
                 / cost %min%, CO2emission %min%, endogenous %max% /
          pareto_obj(points,k);

Set pheader / capacity, cost, CO2emission /;

Table pdata(pheader,p)
                         Lignite    Oil    Gas    RES
   capacity [GWh]          31000  15000  22000  10000
   cost [$/MWh]               30     75     60     90
   CO2emission [t/MWh]      1.44   0.72   0.45      0;

Parameter
   ad        'annual demand in GWh'          / 64000 /
   df(i)     'demand fraction for load type' / base 0.6, middle 0.3, peak 0.1 /
   demand(i) 'demand for load type in GWh';

demand(i) = ad*df(i);

Variable
   z(k)      'objective function variables';

Positive Variable
   x(p,i)    'production level of unit in load area in GWh';

Equation
   objcost   'objective for minimizing cost in K$'
   objco2    'objective for minimizing CO2 emissions in Kt'
   objes     'objective for maximizing endogenous sources in GWh'
   defcap(p) 'capacity constraint'
   defdem(i) 'demand satisfaction';

* Objective functions
objcost..   sum(pi(p,i), pdata('cost',p)*x(pi)) =e= z('cost');

objco2..    sum(pi(p,i), pdata('CO2emission',p)*x(pi)) =e= z('CO2emission');

objes..     sum(pi(es,i), x(pi)) =e= z('endogenous');

defcap(p).. sum(pi(p,i), x(pi))  =l= pdata('capacity',p);

defdem(i).. sum(pi(p,i), x(pi))  =g= demand(i);

Model example / all /;

$libInclude moo %method% example LP k dir z points pareto_obj -gridpoints=11 -iterations=%iterations% -solver=cplex -optfile_init=1 -optfile_main=1
pareto_obj(points,k) = round(pareto_obj(points,k),6)
execute_unload 'moo', pareto_obj;
$offEcho


*** EPSCMMIP model from model library ***
$onEchoV > epscmmip.gms
Set
   I 'constraints'         / i1* i2 /
   J 'decision variables'  / j1*j50 /
   K 'objective functions' / k1* k2 /
   points  'pareto points' / point1*point1000 /;

Parameter
   dir(k) 'direction of the objective functions 1 for max and -1 for min' / k1 1, k2 1 /
   b(I)   'RHS of the constraints' / i1 1445, i2 1502.5 /
   pareto_obj(points,k);

Table c(K,J) 'matrix of objective function coefficients C'
       j1  j2  j3  j4  j5  j6  j7  j8  j9 j10 j11 j12 j13 j14 j15 j16 j17
   k1  21  69  26  92  77  30  96  80  60  61  52  92  19  10  63  34 100
   k2  24  92  53  25  10  31  83  34  64  69  95  40  59  87  13  94  53

   +  j18 j19 j20 j21 j22 j23 j24 j25 j26 j27 j28 j29 j30 j31 j32 j33 j34
   k1  60  11  12  37 100  74  17  60  69  49  69  49  59  17  21  74  85
   k2  52  61  53  78  34  89  32  28  56  52  40  41  59  35  96  72  55

   +  j35 j36 j37 j38 j39 j40 j41 j42 j43 j44 j45 j46 j47 j48 j49 j50
   k1  83  41  29  63  56  38  66  92  25  84  89  21  46  94  96  92
   k2 100  44  90  66  59  22  72  25  36  16  56  91  61  56  66  53    ;

Table a(I,J) 'matrix of technological coefficients A'
       j1  j2  j3  j4  j5  j6  j7  j8  j9 j10 j11 j12 j13 j14 j15 j16 j17
   i1  84  49  68  20  97  74  60  30  13  95  19  41  17  95  73  12  66
   i2  19  96  93  64  72  91  32  96  44  76  69  82  51  38  52  22  83

   +  j18 j19 j20 j21 j22 j23 j24 j25 j26 j27 j28 j29 j30 j31 j32 j33 j34
   i1  55  75  20  56  80  59  66  25  70  95  96  62  74  31  59  21  85
   i2  27  70  56  29  89  86  48  13  95  66  94  16  44  67  90  48  29

   +  j35 j36 j37 j38 j39 j40 j41 j42 j43 j44 j45 j46 j47 j48 j49 j50
   i1  45  97  23  53  51  95  58  68  62  45  83  82  47  15  52  72
   i2  90  54  77  28 100  86  51  62  40  54  21  55  50  62  51  77    ;

Variable
   Z(K) 'objective function variables'
   X(J) 'decision variables';

Binary Variable X;

Equation
   objfun(K) 'objective functions'
   con(I)    'constraints';

objfun(K).. sum(J, c(K,J)*X(J)) =e= Z(K);

con(I)..    sum(J, a(I,J)*X(J)) =l= b(I);

Model example / all /;

$libInclude moo %method% example MIP k dir z points pareto_obj -gridpoints=492 -iterations=%iterations% -solver=cplex -optfile_init=1 -optfile_main=1
pareto_obj(points,k) = round(pareto_obj(points,k),6)
execute_unload 'moo', pareto_obj;
$offEcho


*** moo01 model from data library ***
$call.checkErrorLevel datalib moo01 > %system.NullFile%
$onEcho >> moo01.gms
pareto_obj(p,k) = round(pareto_obj(p,k),6)
execute_unload 'moo', pareto_obj;
$offEcho


*** moo02 model from data library ***
$call.checkErrorLevel datalib moo02 > %system.NullFile%
$onEcho >> moo02.gms
pareto_obj(points,k) = round(pareto_obj(points,k),6)
execute_unload 'moo', pareto_obj;
$offEcho

*** moo03 model from data library ***
$call.checkErrorLevel datalib moo03 > %system.NullFile%
$onEcho >> moo03.gms
pareto_obj(points,p)$(pareto_obj(points,p)<>EPS) = round(pareto_obj(points,p),6)
execute_unload 'moo', pareto_obj;
$offEcho

*** modified moo02 model ***
* checks that zero objective values are handled correctly: CO2 emissions for sources modified to allow zero total CO2 emissions
* checks that skipping objectives works in case of min=max: With --CO2=0 we get min=max for objective CO2emissions
* checks that for a single objective a single pareto point is returned
$onEchoV > moo02_zero_obj.gms
$inlineCom [ ]

$if not set NBOBJ $set NBOBJ  2
$if not set METHOD $set METHOD Sandwiching
$if not set CO2 $set CO2 1

Set
   p       'power generation units' / Lignite, Oil, Gas, RES /
   i       'load areas'             / base, middle, peak     /
   pi(p,i) 'availability of unit for load types' / Lignite.(base,middle)
                                                   Oil.(middle,peak), Gas.set.i
                                                   RES.(base, peak)            /
   es(p)   'endogenous sources'  / Lignite, RES /
   k       'objective functions' / cost, CO2emission, endogenous /
   points  'pareto points' / point1*point1000 /;

$set min -1
$set max +1

Parameter dir(k) 'direction of the objective functions 1 for max and -1 for min'
                 / cost %min%, CO2emission %min%, endogenous %max% /
          pareto_obj(points,k) 'objective values of the pareto points';

Set pheader / capacity, cost, CO2emission /;

Table pdata(pheader,p)
                         Lignite    Oil    Gas    RES
   capacity [GWh]          61000  25000  42000  20000
   cost [$/MWh]               30     75     60     90
   CO2emission [t/MWh]     %CO2%      0      0      0;

Parameter
   ad        'annual demand in GWh'          / 64000 /
   df(i)     'demand fraction for load type' / base 0.6, middle 0.3, peak 0.1 /
   demand(i) 'demand for load type in GWh';

demand(i) = ad*df(i);

Variable
   z(k)      'objective function variables';

Positive Variable
   x(p,i)    'production level of unit in load area in GWh';

Equation
   objcost   'objective for minimizing cost in K$'
   objco2    'objective for minimizing CO2 emissions in Kt'
   objes     'objective for maximizing endogenous sources in GWh'
   defcap(p) 'capacity constraint'
   defdem(i) 'demand satisfaction';

objcost..   sum(pi(p,i), pdata('cost',p)*x(pi)) =e= z('cost');

objco2..    sum(pi(p,i), pdata('CO2emission',p)*x(pi)) =e= z('CO2emission');

objes..     sum(pi(es,i), x(pi)) =e= z('endogenous');

defcap(p).. sum(pi(p,i), x(pi))  =l= pdata('capacity',p);

defdem(i).. sum(pi(p,i), x(pi))  =g= demand(i);

Model example / all /;

Set kk(k) 'active objective functions';
kk(k) = yes;
$ifE %NBOBJ%<=2 kk('endogenous') = no;
$if %NBOBJ%==1 kk('CO2emission') = no;

$libInclude moo %METHOD% example LP kk dir z points pareto_obj -iterations=10 -gridpoints=3 -solver=cplex -optfile_init=1 -optfile_main=1

pareto_obj(points,k)$(pareto_obj(points,k)<>EPS) = round(pareto_obj(points,k),6)
execute_unload 'moo', pareto_obj;
$offEcho

*** modified moo02 model ***
* runs Payoff separately
* runs EPSConstraint using min/max
$onEchoV > moo02_payoff_min_max.gms
$inlineCom [ ]

$if not set NBOBJ $set NBOBJ  3

Set
   p       'power generation units' / Lignite, Oil, Gas, RES /
   i       'load areas'             / base, middle, peak     /
   pi(p,i) 'availability of unit for load types' / Lignite.(base,middle)
                                                   Oil.(middle,peak), Gas.set.i
                                                   RES.(base, peak)            /
   es(p)   'endogenous sources'  / Lignite, RES /
   k       'objective functions' / cost, CO2emission, endogenous /
   points  'pareto points' / point1*point1000 /;

$set min -1
$set max +1

Parameter dir(k) 'direction of the objective functions 1 for max and -1 for min'
                 / cost %min%, CO2emission %min%, endogenous %max% /
          pareto_obj(points,k) 'objective values of the pareto points';

Set pheader / capacity, cost, CO2emission /;

Table pdata(pheader,p)
                         Lignite    Oil    Gas    RES
   capacity [GWh]          61000  25000  42000  20000
   cost [$/MWh]               30     75     60     90
   CO2emission [t/MWh]      1.44   0.72   0.45      0;

Parameter
   ad        'annual demand in GWh'          / 64000 /
   df(i)     'demand fraction for load type' / base 0.6, middle 0.3, peak 0.1 /
   demand(i) 'demand for load type in GWh'
   minobj(k)
   maxobj(k)
   range(k);

demand(i) = ad*df(i);

Variable
   z(k)      'objective function variables';

Positive Variable
   x(p,i)    'production level of unit in load area in GWh';

Equation
   objcost   'objective for minimizing cost in K$'
   objco2    'objective for minimizing CO2 emissions in Kt'
   objes     'objective for maximizing endogenous sources in GWh'
   defcap(p) 'capacity constraint'
   defdem(i) 'demand satisfaction';

objcost..   sum(pi(p,i), pdata('cost',p)*x(pi)) =e= z('cost');

objco2..    sum(pi(p,i), pdata('CO2emission',p)*x(pi)) =e= z('CO2emission');

objes..     sum(pi(es,i), x(pi)) =e= z('endogenous');

defcap(p).. sum(pi(p,i), x(pi))  =l= pdata('capacity',p);

defdem(i).. sum(pi(p,i), x(pi))  =g= demand(i);

Model example / all /;

Set kk(k) 'active objective functions';
kk(k) = yes;
$if %NBOBJ%==2 kk('endogenous') = no;

$onEcho.optfile > cplex.opt
threads 1
$offEcho.optfile

$libInclude moo Payoff example LP kk dir Z points pareto_obj -solver=cplex -optfile_init=1
execute_load "payoff.gdx", minobj, maxobj;

range(k) = maxobj(k) - minobj(k);
maxobj(k) = maxobj(k) - range(k)*0.5;

$libInclude moo EPSConstraint example LP kk dir Z points pareto_obj -min=minobj -max=maxobj -gridpoints=5 -solver=cplex -optfile_main=1
pareto_obj(points,k) = round(pareto_obj(points,k),6)
execute_unload 'moo', pareto_obj;
$offEcho

*** test empty dynamic objective set ***
$onEchoV > empty_set.gms
Set i / i1, i2 / , ii(i), points / p1*p5 /;
ii(i)=no;
Parameter dir(i) / i1 -1, i2 +1 /, pareto_obj(points,i);
Variable z(i);
Equation e;
e.. sum(i,z(i)) =e= 1;
Model example / all /;

$libInclude moo EpsConstraint example LP ii dir z points pareto_obj -solver=cplex -optfile_init=1 -optfile_main=1
$offEcho


*** simple moo model ***
$onEchoV > simple_moo.gms
Set i 'objectives'  / i1*i2 /
    n 'variables'   / n1*n2 /
    m 'constraints' / m1*m7 /
    p 'pareto points' / p1*p1000 /;
    
Table C(i,n) 'objective matrix'
    n1  n2
i1   3  -2
i2  -1   2;

Table A(m,n) 'constraint matrix'
    n1 n2
m1  -4 -8
m2   3 -6
m3   4 -2
m4   1  0
m5  -1  3
m6  -2  4
m7  -6  3;

Parameter b(m)      'constraint vector' / m1 -8, m2 6, m3 14, m4 6, m5 15, m6 18, m7 9 /
          dir(i)    'direction of the objective functions 1 for max and -1 for min' / #i -1 /   
          pareto_obj(p,i)  'objective values of the pareto points';

Variable Z(i);
Positive Variable X(n);

Equations obj(i)
          const(m);
          
obj(i).. Z(i) =e= sum(n, C(i,n)*X(n));
const(m).. sum(n, A(m,n)*X(n)) =l= b(m);

Model example / all /;

$libinclude moo %METHOD% example LP i dir Z p pareto_obj -iterations=10 -gridpoints=3 -solver=cplex -optfile_init=1 -optfile_main=1

pareto_obj(p,i)$(pareto_obj(p,i)<>EPS) = round(pareto_obj(p,i),6)
execute_unload 'moo', pareto_obj;
$offEcho


$log ###### Test Expected Errors ######

$log Test empty objective set
$call gams empty_set.gms lo=%gams.lo% > %system.nullfile%
$if not errorlevel 0 $abort 'Error expected'


$log ###### Test EPSConstraint ######

$log Test EPSCM model
$call.checkErrorLevel gams epscm.gms lo=%gams.lo% --method=EPSConstraint
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) /
'point1'.'cost' 3075000, 
'point1'.'CO2emission' 62460, 
'point1'.'endogenous' 31000, 
'point2'.'cost' 3078000, 
'point2'.'CO2emission' 62316, 
'point2'.'endogenous' 31200, 
'point3'.'cost' 3099000, 
'point3'.'CO2emission' 61308, 
'point3'.'endogenous' 32600, 
'point4'.'cost' 3111000, 
'point4'.'CO2emission' 60732, 
'point4'.'endogenous' 33400, 
'point5'.'cost' 3120000, 
'point5'.'CO2emission' 60300, 
'point5'.'endogenous' 34000, 
'point6'.'cost' 3141000, 
'point6'.'CO2emission' 59292, 
'point6'.'endogenous' 35400, 
'point7'.'cost' 3147000, 
'point7'.'CO2emission' 59004, 
'point7'.'endogenous' 35800, 
'point8'.'cost' 3162000, 
'point8'.'CO2emission' 58284, 
'point8'.'endogenous' 36800, 
'point9'.'cost' 3183000, 
'point9'.'CO2emission' 57276, 
'point9'.'endogenous' 38200, 
'point10'.'cost' 3204000, 
'point10'.'CO2emission' 56268, 
'point10'.'endogenous' 39600, 
'point11'.'cost' 3219000, 
'point11'.'CO2emission' 55548, 
'point11'.'endogenous' 40600, 
'point12'.'cost' 3225000, 
'point12'.'CO2emission' 55260, 
'point12'.'endogenous' 41000, 
'point13'.'cost' 3315000, 
'point13'.'CO2emission' 53820, 
'point13'.'endogenous' 39000, 
'point14'.'cost' 3423000, 
'point14'.'CO2emission' 52092, 
'point14'.'endogenous' 36600, 
'point15'.'cost' 3531000, 
'point15'.'CO2emission' 50364, 
'point15'.'endogenous' 34200, 
'point16'.'cost' 3639000, 
'point16'.'CO2emission' 48636, 
'point16'.'endogenous' 31800, 
'point17'.'cost' 3747000, 
'point17'.'CO2emission' 46908, 
'point17'.'endogenous' 29400, 
'point18'.'cost' 3855000, 
'point18'.'CO2emission' 45180, 
'point18'.'endogenous' 27000 /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(points, k)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test EPSCMMIP model
$call.checkErrorLevel gams epscmmip.gms lo=%gams.lo% --method=EPSConstraint
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) /
'point1'.'k1' 1547, 
'point1'.'k2' 2020, 
'point2'.'k1' 1636, 
'point2'.'k2' 2012, 
'point3'.'k1' 1639, 
'point3'.'k2' 2003, 
'point4'.'k1' 1711, 
'point4'.'k2' 2002, 
'point5'.'k1' 1742, 
'point5'.'k2' 1986, 
'point6'.'k1' 1755, 
'point6'.'k2' 1969, 
'point7'.'k1' 1783, 
'point7'.'k2' 1965, 
'point8'.'k1' 1814, 
'point8'.'k2' 1949, 
'point9'.'k1' 1822, 
'point9'.'k2' 1929, 
'point10'.'k1' 1826, 
'point10'.'k2' 1917, 
'point11'.'k1' 1830, 
'point11'.'k2' 1914, 
'point12'.'k1' 1862, 
'point12'.'k2' 1909, 
'point13'.'k1' 1893, 
'point13'.'k2' 1902, 
'point14'.'k1' 1931, 
'point14'.'k2' 1857, 
'point15'.'k1' 1956, 
'point15'.'k2' 1827, 
'point16'.'k1' 1973, 
'point16'.'k2' 1808, 
'point17'.'k1' 1975, 
'point17'.'k2' 1773, 
'point18'.'k1' 1982, 
'point18'.'k2' 1772, 
'point19'.'k1' 1987, 
'point19'.'k2' 1769, 
'point20'.'k1' 1993, 
'point20'.'k2' 1761, 
'point21'.'k1' 2003, 
'point21'.'k2' 1755, 
'point22'.'k1' 2009, 
'point22'.'k2' 1735, 
'point23'.'k1' 2015, 
'point23'.'k2' 1730, 
'point24'.'k1' 2028, 
'point24'.'k2' 1716, 
'point25'.'k1' 2029, 
'point25'.'k2' 1715, 
'point26'.'k1' 2038, 
'point26'.'k2' 1708, 
'point27'.'k1' 2059, 
'point27'.'k2' 1694, 
'point28'.'k1' 2062, 
'point28'.'k2' 1662, 
'point29'.'k1' 2070, 
'point29'.'k2' 1636, 
'point30'.'k1' 2075, 
'point30'.'k2' 1635, 
'point31'.'k1' 2079, 
'point31'.'k2' 1589, 
'point32'.'k1' 2087, 
'point32'.'k2' 1588, 
'point33'.'k1' 2089, 
'point33'.'k2' 1577, 
'point34'.'k1' 2090, 
'point34'.'k2' 1531, 
'point35'.'k1' 2103, 
'point35'.'k2' 1529 /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(points, K)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test moo01 model with 2 objectives
$call.checkErrorLevel gams moo01.gms lo=%gams.lo% --GRIDPOINTS=20
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) objective values of the pareto points /
'point1'.'k1' 953, 
'point1'.'k2' 1076, 
'point2'.'k1' 956, 
'point2'.'k2' 1062, 
'point3'.'k1' 972, 
'point3'.'k2' 1052, 
'point4'.'k1' 1005, 
'point4'.'k2' 1037, 
'point5'.'k1' 1030, 
'point5'.'k2' 1024, 
'point6'.'k1' 1049, 
'point6'.'k2' 1004, 
'point7'.'k1' 1063, 
'point7'.'k2' 990, 
'point8'.'k1' 1088, 
'point8'.'k2' 955, 
'point9'.'k1' 1091, 
'point9'.'k2' 946, 
'point10'.'k1' 1105, 
'point10'.'k2' 932, 
'point11'.'k1' 1121, 
'point11'.'k2' 876, 
'point12'.'k1' 1130, 
'point12'.'k2' 827, 
'point13'.'k1' 1137, 
'point13'.'k2' 783 /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(p, k)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test moo01 model with 3 objectives
$call.checkErrorLevel gams moo01.gms lo=%gams.lo% --NBOBJ=3 --GRIDPOINTS=5
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) objective values of the pareto points /
'point1'.'k1' 1042, 
'point1'.'k2' 1521, 
'point1'.'k3' 1699, 
'point2'.'k1' 1056, 
'point2'.'k2' 1877, 
'point2'.'k3' 1367, 
'point3'.'k1' 1222, 
'point3'.'k2' 1755, 
'point3'.'k3' 1522, 
'point4'.'k1' 1271, 
'point4'.'k2' 1624, 
'point4'.'k3' 1542, 
'point5'.'k1' 1283, 
'point5'.'k2' 1464, 
'point5'.'k3' 1524, 
'point6'.'k1' 1298, 
'point6'.'k2' 1757, 
'point6'.'k3' 1360, 
'point7'.'k1' 1314, 
'point7'.'k2' 1732, 
'point7'.'k3' 1305, 
'point8'.'k1' 1388, 
'point8'.'k2' 1580, 
'point8'.'k3' 1346, 
'point9'.'k1' 1420, 
'point9'.'k2' 1591, 
'point9'.'k3' 1257, 
'point10'.'k1' 1421, 
'point10'.'k2' 1439, 
'point10'.'k3' 1352, 
'point11'.'k1' 1422, 
'point11'.'k2' 1357, 
'point11'.'k3' 1360, 
'point12'.'k1' 1450, 
'point12'.'k2' 1470, 
'point12'.'k3' 1199, 
'point13'.'k1' 1467, 
'point13'.'k2' 1300, 
'point13'.'k3' 1188, 
'point14'.'k1' 1479, 
'point14'.'k2' 1283, 
'point14'.'k3' 987 /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(p, k)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test moo01 model with 3 objectives using 2 parallel jobs
$call.checkErrorLevel gams moo01.gms lo=%gams.lo% --NBOBJ=3 --GRIDPOINTS=5 --PARALLEL_JOBS=2
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) objective values of the pareto points /
'point1'.'k1' 1042, 
'point1'.'k2' 1521, 
'point1'.'k3' 1699, 
'point2'.'k1' 1056, 
'point2'.'k2' 1877, 
'point2'.'k3' 1367, 
'point3'.'k1' 1222, 
'point3'.'k2' 1755, 
'point3'.'k3' 1522, 
'point4'.'k1' 1271, 
'point4'.'k2' 1624, 
'point4'.'k3' 1542, 
'point5'.'k1' 1283, 
'point5'.'k2' 1464, 
'point5'.'k3' 1524, 
'point6'.'k1' 1298, 
'point6'.'k2' 1757, 
'point6'.'k3' 1360, 
'point7'.'k1' 1314, 
'point7'.'k2' 1732, 
'point7'.'k3' 1305, 
'point8'.'k1' 1388, 
'point8'.'k2' 1580, 
'point8'.'k3' 1346, 
'point9'.'k1' 1420, 
'point9'.'k2' 1591, 
'point9'.'k3' 1257, 
'point10'.'k1' 1421, 
'point10'.'k2' 1439, 
'point10'.'k3' 1352, 
'point11'.'k1' 1422, 
'point11'.'k2' 1357, 
'point11'.'k3' 1360, 
'point12'.'k1' 1450, 
'point12'.'k2' 1470, 
'point12'.'k3' 1199, 
'point13'.'k1' 1467, 
'point13'.'k2' 1300, 
'point13'.'k3' 1188, 
'point14'.'k1' 1479, 
'point14'.'k2' 1283, 
'point14'.'k3' 987 /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(p, k)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test moo02 model with 2 objectives
$call.checkErrorLevel gams moo02.gms lo=%gams.lo% --METHOD=EpsConstraint
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) objective values of the pareto points /
'point1'.'cost' 2112000, 
'point1'.'CO2emission' 85824, 
'point2'.'cost' 2608090.909091, 
'point2'.'CO2emission' 69453, 
'point3'.'cost' 3104181.818182, 
'point3'.'CO2emission' 53082, 
'point4'.'cost' 3757875, 
'point4'.'CO2emission' 36711, 
'point5'.'cost' 4470000, 
'point5'.'CO2emission' 20340 /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(points, k)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test moo02 model with 3 objectives
$call.checkErrorLevel gams moo02.gms lo=%gams.lo% --METHOD=EpsConstraint --NBOBJ=3
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) objective values of the pareto points /
'point1'.'cost' 2112000, 
'point1'.'CO2emission' 85824, 
'point1'.'endogenous' 57600, 
'point2'.'cost' 2356500, 
'point2'.'CO2emission' 87840, 
'point2'.'endogenous' 65750, 
'point3'.'cost' 2562272.727273, 
'point3'.'CO2emission' 70965, 
'point3'.'endogenous' 42590.909091, 
'point4'.'cost' 2651250, 
'point4'.'CO2emission' 70965, 
'point4'.'endogenous' 50500, 
'point5'.'cost' 2960625, 
'point5'.'CO2emission' 70965, 
'point5'.'endogenous' 65750, 
'point6'.'cost' 3073636.363636, 
'point6'.'CO2emission' 54090, 
'point6'.'endogenous' 25545.454545, 
'point7'.'cost' 3182812.5, 
'point7'.'CO2emission' 54090, 
'point7'.'endogenous' 35250, 
'point8'.'cost' 3354375, 
'point8'.'CO2emission' 54090, 
'point8'.'endogenous' 50500, 
'point9'.'cost' 3630000, 
'point9'.'CO2emission' 87840, 
'point9'.'endogenous' 81000, 
'point10'.'cost' 3736875, 
'point10'.'CO2emission' 37215, 
'point10'.'endogenous' 22000, 
'point11'.'cost' 3885937.5, 
'point11'.'CO2emission' 37215, 
'point11'.'endogenous' 35250, 
'point12'.'cost' 4470000, 
'point12'.'CO2emission' 20340, 
'point12'.'endogenous' 20000 /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(points, k)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test for 2 objectives where 1 objective has zero values
$call.checkErrorLevel gams moo02_zero_obj.gms lo=%gams.lo% --METHOD=EpsConstraint --NBOBJ=2
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) objective values of the pareto points /
'point1'.'cost' 2112000, 
'point1'.'CO2emission' 57600, 
'point2'.'cost' 2976000, 
'point2'.'CO2emission' 28800, 
'point3'.'cost' 4170000, 
'point3'.'CO2emission' Eps /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(points, k)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test for 3 objectives where 1 objective has zero values
$call.checkErrorLevel gams moo02_zero_obj.gms lo=%gams.lo% --METHOD=EpsConstraint --NBOBJ=3
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) objective values of the pareto points /
'point1'.'cost' 2112000, 
'point1'.'CO2emission' 57600, 
'point1'.'endogenous' 57600, 
'point2'.'cost' 2925000, 
'point2'.'CO2emission' 30500, 
'point2'.'endogenous' 30500, 
'point3'.'cost' 3525000, 
'point3'.'CO2emission' 30500, 
'point3'.'endogenous' 50500, 
'point4'.'cost' 3630000, 
'point4'.'CO2emission' 61000, 
'point4'.'endogenous' 81000, 
'point5'.'cost' 4470000, 
'point5'.'CO2emission' Eps, 
'point5'.'endogenous' 20000 /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(points, k)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test for 2 objectives with min=max where method will be skipped
$call.checkErrorLevel gams moo02_zero_obj.gms lo=%gams.lo% --METHOD=EpsConstraint --NBOBJ=2 --CO2=0
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) objective values of the pareto points /
'point1'.'cost' 2112000, 
'point1'.'CO2emission' Eps /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(points, k)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test for 3 objectives where 1 objective with min=max is skipped
$call.checkErrorLevel gams moo02_zero_obj.gms lo=%gams.lo% --METHOD=EpsConstraint --NBOBJ=3 --CO2=0
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) objective values of the pareto points /
'point1'.'cost' 2112000, 
'point1'.'endogenous' 57600, 
'point2'.'cost' 2577000, 
'point2'.'endogenous' 69300, 
'point3'.'cost' 3630000, 
'point3'.'endogenous' 81000 /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(points, k)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test for 1 objective where only a single point is returned
$call.checkErrorLevel gams moo02_zero_obj.gms lo=%gams.lo% --METHOD=EpsConstraint --NBOBJ=1
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) objective values of the pareto points /
'point1'.'cost' 2112000 /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(points, k)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test simple_moo
$call.checkErrorLevel gams simple_moo.gms lo=%gams.lo% --METHOD=EpsConstraint
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) objective values of the pareto points /
'p1'.'i1' -7, 
'p1'.'i2' 9, 
'p2'.'i1' -3.5, 
'p2'.'i2' 3.5, 
'p3'.'i1' 6, 
'p3'.'i2' -2 /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(p, i)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test moo02_payoff_min_max model with 3 objectives
$call.checkErrorLevel gams moo02_payoff_min_max.gms lo=%gams.lo% --METHOD=EpsConstraint
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) objective values of the pareto points /
'point1'.'cost' 3073636.363636, 
'point1'.'CO2emission' 54090, 
'point1'.'endogenous' 25545.454545, 
'point2'.'cost' 3097031.25, 
'point2'.'CO2emission' 54090, 
'point2'.'endogenous' 27625, 
'point3'.'cost' 3182812.5, 
'point3'.'CO2emission' 54090, 
'point3'.'endogenous' 35250, 
'point4'.'cost' 3268593.75, 
'point4'.'CO2emission' 54090, 
'point4'.'endogenous' 42875, 
'point5'.'cost' 3354375, 
'point5'.'CO2emission' 54090, 
'point5'.'endogenous' 50500, 
'point6'.'cost' 3385312.5, 
'point6'.'CO2emission' 45652.5, 
'point6'.'endogenous' 22000, 
'point7'.'cost' 3448593.75, 
'point7'.'CO2emission' 45652.5, 
'point7'.'endogenous' 27625, 
'point8'.'cost' 3534375, 
'point8'.'CO2emission' 45652.5, 
'point8'.'endogenous' 35250, 
'point9'.'cost' 3620156.25, 
'point9'.'CO2emission' 45652.5, 
'point9'.'endogenous' 42875, 
'point10'.'cost' 3736875, 
'point10'.'CO2emission' 37215, 
'point10'.'endogenous' 22000, 
'point11'.'cost' 3800156.25, 
'point11'.'CO2emission' 37215, 
'point11'.'endogenous' 27625, 
'point12'.'cost' 3885937.5, 
'point12'.'CO2emission' 37215, 
'point12'.'endogenous' 35250, 
'point13'.'cost' 4088437.5, 
'point13'.'CO2emission' 28777.5, 
'point13'.'endogenous' 22000, 
'point14'.'cost' 4151718.75, 
'point14'.'CO2emission' 28777.5, 
'point14'.'endogenous' 27625, 
'point15'.'cost' 4470000, 
'point15'.'CO2emission' 20340, 
'point15'.'endogenous' 20000 /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(points, k)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log ###### Test RandomWeighting ######

$log Test EPSCM model
$call.checkErrorLevel gams epscm.gms lo=%gams.lo% --method=RandomWeighting --iterations=50 
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) /
'point1'.'cost' 3075000, 
'point1'.'CO2emission' 62460, 
'point1'.'endogenous' 31000, 
'point2'.'cost' 3225000, 
'point2'.'CO2emission' 55260, 
'point2'.'endogenous' 41000, 
'point3'.'cost' 3855000, 
'point3'.'CO2emission' 45180, 
'point3'.'endogenous' 27000 /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(points, k)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test EPSCMMIP model
$call.checkErrorLevel gams epscmmip.gms lo=%gams.lo% --method=RandomWeighting --iterations=10
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) /
'point1'.'k1' 1547, 
'point1'.'k2' 2020, 
'point2'.'k1' 1636, 
'point2'.'k2' 2012, 
'point3'.'k1' 1711, 
'point3'.'k2' 2002, 
'point4'.'k1' 1814, 
'point4'.'k2' 1949, 
'point5'.'k1' 1893, 
'point5'.'k2' 1902, 
'point6'.'k1' 2059, 
'point6'.'k2' 1694, 
'point7'.'k1' 2103, 
'point7'.'k2' 1529 /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(points, K)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test moo02 model with 2 objectives
$call.checkErrorLevel gams moo02.gms lo=%gams.lo% --METHOD=RandomWeighting
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) objective values of the pareto points /
'point1'.'cost' 2112000, 
'point1'.'CO2emission' 85824, 
'point2'.'cost' 3180000, 
'point2'.'CO2emission' 50580, 
'point3'.'cost' 4380000, 
'point3'.'CO2emission' 21780, 
'point4'.'cost' 4470000, 
'point4'.'CO2emission' 20340 /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(points, k)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test moo02 model with 3 objectives
$call.checkErrorLevel gams moo02.gms lo=%gams.lo% --METHOD=RandomWeighting --NBOBJ=3
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) objective values of the pareto points /
'point1'.'cost' 2112000, 
'point1'.'CO2emission' 85824, 
'point1'.'endogenous' 57600, 
'point2'.'cost' 2304000, 
'point2'.'CO2emission' 82944, 
'point2'.'endogenous' 64000, 
'point3'.'cost' 2406000, 
'point3'.'CO2emission' 87840, 
'point3'.'endogenous' 67400, 
'point4'.'cost' 3120000, 
'point4'.'CO2emission' 63360, 
'point4'.'endogenous' 64000, 
'point5'.'cost' 3630000, 
'point5'.'CO2emission' 87840, 
'point5'.'endogenous' 81000, 
'point6'.'cost' 4380000, 
'point6'.'CO2emission' 21780, 
'point6'.'endogenous' 22000, 
'point7'.'cost' 4470000, 
'point7'.'CO2emission' 20340, 
'point7'.'endogenous' 20000 /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(points, k)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test for 2 objectives where 1 objective has zero values
$call.checkErrorLevel gams moo02_zero_obj.gms lo=%gams.lo% --METHOD=RandomWeighting --NBOBJ=2
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) objective values of the pareto points /
'point1'.'cost' 2112000, 
'point1'.'CO2emission' 57600, 
'point2'.'cost' 3180000, 
'point2'.'CO2emission' 22000, 
'point3'.'cost' 4170000, 
'point3'.'CO2emission' Eps /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(points, k)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test for 3 objectives where 1 objective has zero values
$call.checkErrorLevel gams moo02_zero_obj.gms lo=%gams.lo% --METHOD=RandomWeighting --NBOBJ=3
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) objective values of the pareto points /
'point1'.'cost' 2112000, 
'point1'.'CO2emission' 57600, 
'point1'.'endogenous' 57600, 
'point2'.'cost' 2304000, 
'point2'.'CO2emission' 57600, 
'point2'.'endogenous' 64000, 
'point3'.'cost' 2406000, 
'point3'.'CO2emission' 61000, 
'point3'.'endogenous' 67400, 
'point4'.'cost' 3120000, 
'point4'.'CO2emission' 44000, 
'point4'.'endogenous' 64000, 
'point5'.'cost' 3180000, 
'point5'.'CO2emission' 22000, 
'point5'.'endogenous' 22000, 
'point6'.'cost' 3630000, 
'point6'.'CO2emission' 61000, 
'point6'.'endogenous' 81000, 
'point7'.'cost' 4470000, 
'point7'.'CO2emission' Eps, 
'point7'.'endogenous' 20000 /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(points, k)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test for 2 objectives with min=max where method will be skipped
$call.checkErrorLevel gams moo02_zero_obj.gms lo=%gams.lo% --METHOD=RandomWeighting --NBOBJ=2 --CO2=0
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) objective values of the pareto points /
'point1'.'cost' 2112000, 
'point1'.'CO2emission' Eps /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(points, k)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test for 3 objectives where 1 objective with min=max is skipped
$call.checkErrorLevel gams moo02_zero_obj.gms lo=%gams.lo% --METHOD=RandomWeighting --NBOBJ=3 --CO2=0
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) objective values of the pareto points /
'point1'.'cost' 2112000, 
'point1'.'endogenous' 57600, 
'point2'.'cost' 2406000, 
'point2'.'endogenous' 67400, 
'point3'.'cost' 3630000, 
'point3'.'endogenous' 81000 /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(points, k)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test simple_moo
$call.checkErrorLevel gams simple_moo.gms lo=%gams.lo% --METHOD=RandomWeighting
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) objective values of the pareto points /
'p1'.'i1' -7, 
'p1'.'i2' 9, 
'p2'.'i1' -6, 
'p2'.'i2' 6, 
'p3'.'i1' -2, 
'p3'.'i2' 2, 
'p4'.'i1' 6, 
'p4'.'i2' -2 /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(p, i)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log ###### Test Sandwiching ######

$log Test moo02 model with 2 objectives
$call.checkErrorLevel gams moo02.gms lo=%gams.lo%
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) objective values of the pareto points /
'point1'.'cost' 2112000, 
'point1'.'CO2emission' 85824, 
'point2'.'cost' 3180000, 
'point2'.'CO2emission' 50580, 
'point3'.'cost' 4470000, 
'point3'.'CO2emission' 20340 /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(points, k)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test moo02 model with 3 objectives
$call.checkErrorLevel gams moo02.gms lo=%gams.lo% --NBOBJ=3
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) objective values of the pareto points /
'point1'.'cost' 2112000, 
'point1'.'CO2emission' 85824, 
'point1'.'endogenous' 57600, 
'point2'.'cost' 2304000, 
'point2'.'CO2emission' 82944, 
'point2'.'endogenous' 64000, 
'point3'.'cost' 2406000, 
'point3'.'CO2emission' 87840, 
'point3'.'endogenous' 67400, 
'point4'.'cost' 3120000, 
'point4'.'CO2emission' 63360, 
'point4'.'endogenous' 64000, 
'point5'.'cost' 3180000, 
'point5'.'CO2emission' 50580, 
'point5'.'endogenous' 22000, 
'point6'.'cost' 3630000, 
'point6'.'CO2emission' 87840, 
'point6'.'endogenous' 81000, 
'point7'.'cost' 4470000, 
'point7'.'CO2emission' 20340, 
'point7'.'endogenous' 20000 /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(points, k)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test moo03 model with 2 objectives
$call.checkErrorLevel gams moo03.gms lo=%gams.lo%
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) objective values of the pareto points /
'point1'.'p1' -64, 
'point1'.'p2' Eps, 
'point2'.'p1' -63, 
'point2'.'p2' -7, 
'point3'.'p1' -61, 
'point3'.'p2' -15, 
'point4'.'p1' -58, 
'point4'.'p2' -22, 
'point5'.'p1' -55, 
'point5'.'p2' -27, 
'point6'.'p1' -50, 
'point6'.'p2' -34, 
'point7'.'p1' -34, 
'point7'.'p2' -50, 
'point8'.'p1' -27, 
'point8'.'p2' -55, 
'point9'.'p1' -22, 
'point9'.'p2' -58, 
'point10'.'p1' -15, 
'point10'.'p2' -61, 
'point11'.'p1' -7, 
'point11'.'p2' -63, 
'point12'.'p1' Eps, 
'point12'.'p2' -64 /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(points, p)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test pareto points lie on edge of IPS face (EPSCM model)
$call.checkErrorLevel gams epscm.gms lo=%gams.lo% --method=Sandwiching
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) /
'point1'.'cost' 3075000, 
'point1'.'CO2emission' 62460, 
'point1'.'endogenous' 31000, 
'point2'.'cost' 3225000, 
'point2'.'CO2emission' 55260, 
'point2'.'endogenous' 41000, 
'point3'.'cost' 3855000, 
'point3'.'CO2emission' 45180, 
'point3'.'endogenous' 27000 /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(points, k)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test for 2 objectives where 1 objective has zero values
$call.checkErrorLevel gams moo02_zero_obj.gms lo=%gams.lo% --METHOD=Sandwiching --NBOBJ=2
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) objective values of the pareto points /
'point1'.'cost' 2112000, 
'point1'.'CO2emission' 57600, 
'point2'.'cost' 3180000, 
'point2'.'CO2emission' 22000, 
'point3'.'cost' 4170000, 
'point3'.'CO2emission' Eps /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(points, k)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test for 3 objectives where 1 objective has zero values
$call.checkErrorLevel gams moo02_zero_obj.gms lo=%gams.lo% --METHOD=Sandwiching --NBOBJ=3
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) objective values of the pareto points /
'point1'.'cost' 2112000, 
'point1'.'CO2emission' 57600, 
'point1'.'endogenous' 57600, 
'point2'.'cost' 2304000, 
'point2'.'CO2emission' 57600, 
'point2'.'endogenous' 64000, 
'point3'.'cost' 2406000, 
'point3'.'CO2emission' 61000, 
'point3'.'endogenous' 67400, 
'point4'.'cost' 3120000, 
'point4'.'CO2emission' 44000, 
'point4'.'endogenous' 64000, 
'point5'.'cost' 3180000, 
'point5'.'CO2emission' 22000, 
'point5'.'endogenous' 22000, 
'point6'.'cost' 3270000, 
'point6'.'CO2emission' 20000, 
'point6'.'endogenous' 20000, 
'point7'.'cost' 3630000, 
'point7'.'CO2emission' 61000, 
'point7'.'endogenous' 81000, 
'point8'.'cost' 4470000, 
'point8'.'CO2emission' Eps, 
'point8'.'endogenous' 20000 /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(points, k)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test for 2 objectives with min=max where method will be skipped
$call.checkErrorLevel gams moo02_zero_obj.gms lo=%gams.lo% --METHOD=Sandwiching --NBOBJ=2 --CO2=0
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) objective values of the pareto points /
'point1'.'cost' 2112000, 
'point1'.'CO2emission' Eps /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(points, k)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test for 3 objectives where 1 objective with min=max is skipped
$call.checkErrorLevel gams moo02_zero_obj.gms lo=%gams.lo% --METHOD=Sandwiching --NBOBJ=3 --CO2=0
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) objective values of the pareto points /
'point1'.'cost' 2112000, 
'point1'.'endogenous' 57600, 
'point2'.'cost' 2406000, 
'point2'.'endogenous' 67400, 
'point3'.'cost' 3630000, 
'point3'.'endogenous' 81000 /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(points, k)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%


$log Test simple_moo
$call.checkErrorLevel gams simple_moo.gms lo=%gams.lo% --METHOD=Sandwiching
$call.checkErrorLevel gdxdump moo > moo.txt
$call.checkErrorLevel gdxdump moo.gdx domainInfo >> moo.txt

$onEcho > mooExpected.txt
$onEmpty

Parameter pareto_obj(*,*) objective values of the pareto points /
'p1'.'i1' -7, 
'p1'.'i2' 9, 
'p2'.'i1' -6, 
'p2'.'i2' 6, 
'p3'.'i1' -2, 
'p3'.'i2' 2, 
'p4'.'i1' 6, 
'p4'.'i2' -2 /;

$offEmpty
SyNr  Type  DomInf Symbol
   1   Par Relaxed pareto_obj(p, i)
$offEcho
$call.checkErrorLevel diff -bw moo.txt mooExpected.txt > %system.NullFile%