Description
Test JAMS behavior on a small equilibrium model with implicit variables. Contributors: Youngdae Kim & Steve Dirkse, Dec 2016
Small Model of Type : GAMS
Category : GAMS Test library
Main file : emp24.gms
$title 'Test JAMS/EMP on implicit variable handling' (EMP24,SEQ=706)
$onText
Test JAMS behavior on a small equilibrium model with implicit variables.
Contributors: Youngdae Kim & Steve Dirkse, Dec 2016
$offText
$if not set TESTTOL $set TESTTOL 1e-3
$set P 120
scalars tol / %TESTTOL% /;
file opt / 'jams.opt' /;
file info / '%emp.info%' /;
sets i all agents / 0*5 /
j(i) generators / 1*5 /
k plants / 1 /
;
alias(j,jj);
parameters
U0
U(j,k)
M(j,k)
b(j,k)
d
a
price
total_sum
;
U0 = 5;
U(j,k) = uniform(0,10);
M(j,k) = uniform(0.4,0.8);
b(j,k) = uniform(30,60);
d = 0.8 * sum((j,k), U(j,k));
a = -%P% / (1.5 * d)**2;
* The scalar files generated depend on the variable declaration order,
* so do not change the declarations lightly
variable
isoobj ISO objective variable
agentobj(j) Agent objective variable
zExp(i) Replica of the z variable
z Implicit version
;
positive variable q0, q(j,k);
equation
defisoobjExp ISO objective equation that uses zExp in it
defisoobj ISO objective equation that uses z
defagentobjExp(j) Agent objective equation that uses zExp in it
defagentobj(j) Agent objective equation that uses z
defdemandExp(i) Demand constraint that is copied for each agent
defdemand Demand shared constraint
defzExp(i) Explicit equation for zExp variables
defz Implicit variable equation
;
q0.up = U0;
q.up(j,k) = U(j,k);
defisoobjExp..
isoobj =E= %P%*q0 + sum(j, 0.5*sum(k, M(j,k)*q(j,k)*q(j,k)) + sum(k, b(j,k)*q(j,k))) - (a*sqr(zExp('0')) + %P%)*(zExp('0'));
defagentobjExp(j)..
agentobj(j) =E= 0.5*sum(k, M(j,k)*q(j,k)*q(j,k)) + sum(k, b(j,k)*q(j,k)) - (a*sqr(zExp(j)) + %P%)*sum(k, q(j,k));
defdemandExp(i)..
q0 + sum((j,k), q(j,k)) =E= d;
defzExp(i)..
zExp(i) =E= sum((j,k), q(j,k));
model me 'explicit formulation'
/ defisoobjExp, defagentobjExp, defdemandExp, defzExp /;
put info 'equilibrium';
put / 'min', isoobj, q0;
put / defisoobjExp, defdemandExp('0');
loop(j,
put / 'min', agentobj(j);
loop(k, put / q(j,k););
put / zExp(j);
put / defagentobjExp(j), defdemandExp(j), defzExp(j);
);
put / 'vi', defzExp('0'), zExp('0');
putclose;
putclose opt
'Dict explDict.txt' /
'FileName expl.gms' ;
me.optfile = 1;
solve me using emp;
abort$[me.solvestat <> %solveStat.normalCompletion%]
'wrong me.solvestat', me.solvestat;
abort$[me.modelstat > %modelStat.locallyOptimal%]
'wrong me.modelstat', me.modelstat;
abort$[ abs(isoobj.l+267.374) > tol ] 'bad isoobj.l', isoobj.l;
abort$[ abs(agentobj.l('1')+ 10.825) > tol ] 'bad agentobj.l("1")', agentobj.l;
abort$[ abs(agentobj.l('2')+102.696) > tol ] 'bad agentobj.l("2")', agentobj.l;
abort$[ abs(agentobj.l('3')+ 21.109) > tol ] 'bad agentobj.l("3")', agentobj.l;
abort$[ abs(agentobj.l('4')+ 39.619) > tol ] 'bad agentobj.l("4")', agentobj.l;
abort$[ abs(agentobj.l('5')+ 93.125) > tol ] 'bad agentobj.l("5")', agentobj.l;
abort$[ abs(q0.l-0) > tol ] 'bad q0.l', q0.l;
abort$[ abs(q.l('1','1')-1.717) > tol ] 'bad q.l("1","1")', q.l;
abort$[ abs(q.l('2','1')-5.788) > tol ] 'bad q.l("2","1")', q.l;
abort$[ abs(q.l('3','1')-3.831) > tol ] 'bad q.l("3","1")', q.l;
abort$[ abs(q.l('4','1')-3.011) > tol ] 'bad q.l("4","1")', q.l;
abort$[ abs(q.l('5','1')-2.922) > tol ] 'bad q.l("5","1")', q.l;
abort$[ smax{i, abs(zExp.l(i)-17.269)} > tol ] 'bad zExp.l(i)', zExp.l;
abort$[ smax{i, abs(defdemandExp.m(i)-19.571)} > tol ]
'bad defdemandExp.m(i)', defdemandExp.m;
isoobj.l = 0;
agentobj.l(j) = 0;
q0.l = 0;
q.l(j,k) = 0;
defdemandExp.m(i) = 0;
$onEcho > expl_gms
***********************************************
* written by GAMS/JAMS at 12/04/16 23:32:07
* for more information use JAMS option "Dict"
***********************************************
Variables x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,x17,x18,u7,u8,u9,u10,u11,u12
,u14,u15,u16,u17,u18;
Positive Variables x13,x14,x15,x16,x17,x18;
Equations e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,dL_dx8,dL_dx9,dL_dx10
,dL_dx11,dL_dx12,dL_dx13,dL_dx14,dL_dx15,dL_dx16,dL_dx17,dL_dx18;
e7.. x13 + x14 + x15 + x16 + x17 + x18 =E= 17.269913736;
e8.. x13 + x14 + x15 + x16 + x17 + x18 =E= 17.269913736;
e9.. x13 + x14 + x15 + x16 + x17 + x18 =E= 17.269913736;
e10.. x13 + x14 + x15 + x16 + x17 + x18 =E= 17.269913736;
e11.. x13 + x14 + x15 + x16 + x17 + x18 =E= 17.269913736;
e12.. x13 + x14 + x15 + x16 + x17 + x18 =E= 17.269913736;
e13.. x7 - x14 - x15 - x16 - x17 - x18 =E= 0;
e14.. x8 - x14 - x15 - x16 - x17 - x18 =E= 0;
e15.. x9 - x14 - x15 - x16 - x17 - x18 =E= 0;
e16.. x10 - x14 - x15 - x16 - x17 - x18 =E= 0;
e17.. x11 - x14 - x15 - x16 - x17 - x18 =E= 0;
e18.. x12 - x14 - x15 - x16 - x17 - x18 =E= 0;
dL_dx8.. (-0.357641894777802*x8*x14)/(-1) - u14 =E= 0;
dL_dx9.. (-0.357641894777802*x9*x15)/(-1) - u15 =E= 0;
dL_dx10.. (-0.357641894777802*x10*x16)/(-1) - u16 =E= 0;
dL_dx11.. (-0.357641894777802*x11*x17)/(-1) - u17 =E= 0;
dL_dx12.. (-0.357641894777802*x12*x18)/(-1) - u18 =E= 0;
dL_dx13.. 120 - u7 + eps*x13 =N= 0;
dL_dx14.. (-(59.94352881 + 0.5*(0.4896211468*x14 + 0.4896211468*x14) - (120 -
0.178820947388901*sqr(x8))))/(-1) - u8 + u14 =N= 0;
dL_dx15.. (-(47.36200134 + 0.5*(0.5399322016*x15 + 0.5399322016*x15) - (120 -
0.178820947388901*sqr(x9))))/(-1) - u9 + u15 =N= 0;
dL_dx16.. (-(59.73399117 + 0.5*(0.7425081388*x16 + 0.7425081388*x16) - (120 -
0.178820947388901*sqr(x10))))/(-1) - u10 + u16 =N= 0;
dL_dx17.. (-(52.86751401 + 0.5*(0.4268454892*x17 + 0.4268454892*x17) - (120 -
0.178820947388901*sqr(x11))))/(-1) - u11 + u17 =N= 0;
dL_dx18.. (-(33.92077449 + 0.5*(0.6000842676*x18 + 0.6000842676*x18) - (120 -
0.178820947388901*sqr(x12))))/(-1) - u12 + u18 =N= 0;
* set non-default bounds
x13.up = 5;
x14.up = 1.71747132;
x15.up = 8.43266708;
x16.up = 5.50375356;
x17.up = 3.01137904;
x18.up = 2.92212117;
Model m / e7.u7,e8.u8,e9.u9,e10.u10,e11.u11,e12.u12,e13.x7,e14.u14,e15.u15
,e16.u16,e17.u17,e18.u18,dL_dx8.x8,dL_dx9.x9,dL_dx10.x10
,dL_dx11.x11,dL_dx12.x12,dL_dx13.x13,dL_dx14.x14,dL_dx15.x15
,dL_dx16.x16,dL_dx17.x17,dL_dx18.x18 /;
m.limrow=0; m.limcol=0;
Solve m using MCP;
$offEcho
execute 'grep -v " written by GAMS" expl_gms > expl.gms.want'
execute 'grep -v " written by GAMS" expl.gms > expl.gms.got'
execute '=diff -I reslim -bw expl.gms.want expl.gms.got'
abort$errorlevel 'Files expl.gms.want and expl.gms.got differ';
$onEcho > expl_dict
* written by GAMS/JAMS at 12/04/16 23:32:07
********************************************************************************
Contents
1 Content of EMP Information File
2 Processed EMP Information
3 Dictionary
3.1 Constraints
3.2 Variables
********************************************************************************
1 Content of EMP Information File
---------------------------------
1:equilibrium
2:min isoobj q0
3:defisoobjExp defdemandExp('0')
4:min agentobj('1')
5:q('1','1')
6:zExp('1')
7:defagentobjExp('1') defdemandExp('1') defzExp('1')
8:min agentobj('2')
9:q('2','1')
10:zExp('2')
11:defagentobjExp('2') defdemandExp('2') defzExp('2')
12:min agentobj('3')
13:q('3','1')
14:zExp('3')
15:defagentobjExp('3') defdemandExp('3') defzExp('3')
16:min agentobj('4')
17:q('4','1')
18:zExp('4')
19:defagentobjExp('4') defdemandExp('4') defzExp('4')
20:min agentobj('5')
21:q('5','1')
22:zExp('5')
23:defagentobjExp('5') defdemandExp('5') defzExp('5')
24:vi defzExp('0') zExp('0')
2 Processed EMP Information
---------------------------
Number of VI functions specified = 1
* e13 is VI Func and perpendicular to x7
3 Dictionary
------------
3.1 Constraints
---------------
{reformulated} defisoobjExp
{reformulated} defagentobjExp(1)
{reformulated} defagentobjExp(2)
{reformulated} defagentobjExp(3)
{reformulated} defagentobjExp(4)
{reformulated} defagentobjExp(5)
e7 defdemandExp(0)
e8 defdemandExp(1)
e9 defdemandExp(2)
e10 defdemandExp(3)
e11 defdemandExp(4)
e12 defdemandExp(5)
e13 defzExp(0)
e14 defzExp(1)
e15 defzExp(2)
e16 defzExp(3)
e17 defzExp(4)
e18 defzExp(5)
dL_dx8 {new}
dL_dx9 {new}
dL_dx10 {new}
dL_dx11 {new}
dL_dx12 {new}
dL_dx13 {new}
dL_dx14 {new}
dL_dx15 {new}
dL_dx16 {new}
dL_dx17 {new}
dL_dx18 {new}
3.2 Variables
--------------
{reformulated} isoobj
{reformulated} agentobj(1)
{reformulated} agentobj(2)
{reformulated} agentobj(3)
{reformulated} agentobj(4)
{reformulated} agentobj(5)
x7 zExp(0)
x8 zExp(1)
x9 zExp(2)
x10 zExp(3)
x11 zExp(4)
x12 zExp(5)
x13 q0
x14 q(1,1)
x15 q(2,1)
x16 q(3,1)
x17 q(4,1)
x18 q(5,1)
u7 {new}
u8 {new}
u9 {new}
u10 {new}
u11 {new}
u12 {new}
u14 {new}
u15 {new}
u16 {new}
u17 {new}
u18 {new}
$offEcho
execute 'grep -v " written by GAMS" expl_dict > expldict.txt.want'
execute 'grep -v " written by GAMS" explDict.txt > expldict.txt.got'
execute '=diff -bw expldict.txt.want expldict.txt.got'
abort$errorlevel 'Files expldict.txt.want and expldict.txt.got differ';
defisoobj..
isoobj =E= %P%*q0 + sum(j, 0.5*sum(k, M(j,k)*q(j,k)*q(j,k)) + sum(k, b(j,k)*q(j,k))) - (a*sqr(z) + %P%)*(z);
defagentobj(j)..
agentobj(j) =E= 0.5*sum(k, M(j,k)*q(j,k)*q(j,k)) + sum(k, b(j,k)*q(j,k)) - (a*sqr(z) + %P%)*sum(k, q(j,k));
defz..
z =E= sum((j,k), q(j,k));
model mi 'implicit formulation'
/ defisoobj, defagentobj, defdemandExp, defz /;
put info 'equilibrium';
put / 'implicit', z, defz;
put / 'min', isoobj, q0;
put / defisoobj, defdemandExp('0');
loop(j,
put / 'min', agentobj(j);
loop(k, put / q(j,k););
put / z;
put / defagentobj(j), defdemandExp(j);
);
putclose;
* Test with substitution.
putclose opt
'Dict implDict.txt' /
'FileName impl.gms' /
'ImplVarModel substitution' ;
mi.optfile = 1;
solve mi using emp;
abort$[mi.solvestat <> %solveStat.normalCompletion%]
'wrong mi.solvestat', mi.solvestat;
abort$[mi.modelstat > %modelStat.locallyOptimal%]
'wrong mi.modelstat', mi.modelstat;
abort$[ abs(isoobj.l+267.374) > tol ] 'bad isoobj.l', isoobj.l;
abort$[ abs(agentobj.l('1')+ 10.825) > tol ] 'bad agentobj.l("1")', agentobj.l;
abort$[ abs(agentobj.l('2')+102.696) > tol ] 'bad agentobj.l("2")', agentobj.l;
abort$[ abs(agentobj.l('3')+ 21.109) > tol ] 'bad agentobj.l("3")', agentobj.l;
abort$[ abs(agentobj.l('4')+ 39.619) > tol ] 'bad agentobj.l("4")', agentobj.l;
abort$[ abs(agentobj.l('5')+ 93.125) > tol ] 'bad agentobj.l("5")', agentobj.l;
abort$[ abs(q0.l-0) > tol ] 'bad q0.l', q0.l;
abort$[ abs(q.l('1','1')-1.717) > tol ] 'bad q.l("1","1")', q.l;
abort$[ abs(q.l('2','1')-5.788) > tol ] 'bad q.l("2","1")', q.l;
abort$[ abs(q.l('3','1')-3.831) > tol ] 'bad q.l("3","1")', q.l;
abort$[ abs(q.l('4','1')-3.011) > tol ] 'bad q.l("4","1")', q.l;
abort$[ abs(q.l('5','1')-2.922) > tol ] 'bad q.l("5","1")', q.l;
abort$[ abs(z.l-17.269) > tol ] 'bad z.l', z.l;
abort$[ smax{i, abs(defdemandExp.m(i)-19.571)} > tol ]
'bad defdemandExp.m(i)', defdemandExp.m;
isoobj.l = 0;
agentobj.l(j) = 0;
q0.l = 0;
q.l(j,k) = 0;
z.l = 0;
defisoobj.m = 0;
defagentobj.m(j) = 0;
defdemandExp.m(i) = 0;
defz.m = 0;
$onEchoV > impl_gms
***********************************************
* written by GAMS/JAMS at 11/15/17 22:32:41
* for more information use JAMS option "Dict"
***********************************************
Variables x7,x8,x9,x10,x11,x12,x13,u7,u8,u9,u10,u11,u12;
Positive Variables x8,x9,x10,x11,x12,x13;
Equations e7,e8,e9,e10,e11,e12,e13,dL_dx8,dL_dx9,dL_dx10,dL_dx11,dL_dx12
,dL_dx13;
e7.. x8 + x9 + x10 + x11 + x12 + x13 =E= 17.269913736;
e8.. x8 + x9 + x10 + x11 + x12 + x13 =E= 17.269913736;
e9.. x8 + x9 + x10 + x11 + x12 + x13 =E= 17.269913736;
e10.. x8 + x9 + x10 + x11 + x12 + x13 =E= 17.269913736;
e11.. x8 + x9 + x10 + x11 + x12 + x13 =E= 17.269913736;
e12.. x8 + x9 + x10 + x11 + x12 + x13 =E= 17.269913736;
e13.. x7 - x9 - x10 - x11 - x12 - x13 =E= 0;
dL_dx8.. 120 - u7 + eps*x8 =N= 0;
dL_dx9.. (-(59.94352881 + 0.5*(0.4896211468*x9 + 0.4896211468*x9) - (120 -
0.178820947388901*sqr(x7))))/(-1) + ((-0.357641894777802*x7*x9)/(-1)
)*(1) - u8 =N= 0;
dL_dx10.. (-(47.36200134 + 0.5*(0.5399322016*x10 + 0.5399322016*x10) - (120 -
0.178820947388901*sqr(x7))))/(-1) + ((-0.357641894777802*x7*x10)/(-1)
)*(1) - u9 =N= 0;
dL_dx11.. (-(59.73399117 + 0.5*(0.7425081388*x11 + 0.7425081388*x11) - (120 -
0.178820947388901*sqr(x7))))/(-1) + ((-0.357641894777802*x7*x11)/(-1)
)*(1) - u10 =N= 0;
dL_dx12.. (-(52.86751401 + 0.5*(0.4268454892*x12 + 0.4268454892*x12) - (120 -
0.178820947388901*sqr(x7))))/(-1) + ((-0.357641894777802*x7*x12)/(-1)
)*(1) - u11 =N= 0;
dL_dx13.. (-(33.92077449 + 0.5*(0.6000842676*x13 + 0.6000842676*x13) - (120 -
0.178820947388901*sqr(x7))))/(-1) + ((-0.357641894777802*x7*x13)/(-1)
)*(1) - u12 =N= 0;
* set non-default bounds
x8.up = 5;
x9.up = 1.71747132;
x10.up = 8.43266708;
x11.up = 5.50375356;
x12.up = 3.01137904;
x13.up = 2.92212117;
Model m / e7.u7,e8.u8,e9.u9,e10.u10,e11.u11,e12.u12,e13.x7,dL_dx8.x8
,dL_dx9.x9,dL_dx10.x10,dL_dx11.x11,dL_dx12.x12,dL_dx13.x13 /;
File implvarfile / '%gams.scrdir%implvar.dat' /;
Put implvarfile;
$onPutV
x7
$offPut
m.limrow=0; m.limcol=0;
Solve m using MCP;
$offEcho
execute 'grep -v " written by GAMS" impl_gms > impl.gms.want'
execute 'grep -v " written by GAMS" impl.gms > impl.gms.got'
execute '=diff -I reslim -bw impl.gms.want impl.gms.got'
abort$errorlevel 'Files impl.gms.want and impl.gms.got differ';
$onEcho > impl_dict
* written by GAMS/JAMS at 12/04/16 23:37:58
********************************************************************************
Contents
1 Content of EMP Information File
2 Processed EMP Information
3 Dictionary
3.1 Constraints
3.2 Variables
********************************************************************************
1 Content of EMP Information File
---------------------------------
1:equilibrium
2:implicit z defz
3:min isoobj q0
4:defisoobj defdemandExp('0')
5:min agentobj('1')
6:q('1','1')
7:z
8:defagentobj('1') defdemandExp('1')
9:min agentobj('2')
10:q('2','1')
11:z
12:defagentobj('2') defdemandExp('2')
13:min agentobj('3')
14:q('3','1')
15:z
16:defagentobj('3') defdemandExp('3')
17:min agentobj('4')
18:q('4','1')
19:z
20:defagentobj('4') defdemandExp('4')
21:min agentobj('5')
22:q('5','1')
23:z
24:defagentobj('5') defdemandExp('5')
2 Processed EMP Information
---------------------------
3 Dictionary
------------
3.1 Constraints
---------------
{reformulated} defisoobj
{reformulated} defagentobj(1)
{reformulated} defagentobj(2)
{reformulated} defagentobj(3)
{reformulated} defagentobj(4)
{reformulated} defagentobj(5)
e7 defdemandExp(0)
e8 defdemandExp(1)
e9 defdemandExp(2)
e10 defdemandExp(3)
e11 defdemandExp(4)
e12 defdemandExp(5)
e13 defz
dL_dx8 {new}
dL_dx9 {new}
dL_dx10 {new}
dL_dx11 {new}
dL_dx12 {new}
dL_dx13 {new}
3.2 Variables
--------------
{reformulated} isoobj
{reformulated} agentobj(1)
{reformulated} agentobj(2)
{reformulated} agentobj(3)
{reformulated} agentobj(4)
{reformulated} agentobj(5)
x7 z
x8 q0
x9 q(1,1)
x10 q(2,1)
x11 q(3,1)
x12 q(4,1)
x13 q(5,1)
u7 {new}
u8 {new}
u9 {new}
u10 {new}
u11 {new}
u12 {new}
$offEcho
execute 'grep -v " written by GAMS" impl_dict > impldict.txt.want'
execute 'grep -v " written by GAMS" implDict.txt > impldict.txt.got'
execute '=diff -bw impldict.txt.want impldict.txt.got'
abort$errorlevel 'Files impldict.txt.want and impldict.txt.got differ';
* Test with switching.
putclose opt
'Dict implSwitchingDict.txt' /
'FileName implSwitching.gms' /
'ImplVarModel switching' ;
solve mi using emp;
abort$[mi.solvestat <> %solveStat.normalCompletion%]
'wrong mi.solvestat', mi.solvestat;
abort$[mi.modelstat > %modelStat.locallyOptimal%]
'wrong mi.modelstat', mi.modelstat;
abort$[ abs(isoobj.l+267.374) > tol ] 'bad isoobj.l', isoobj.l;
abort$[ abs(agentobj.l('1')+ 10.825) > tol ] 'bad agentobj.l("1")', agentobj.l;
abort$[ abs(agentobj.l('2')+102.696) > tol ] 'bad agentobj.l("2")', agentobj.l;
abort$[ abs(agentobj.l('3')+ 21.109) > tol ] 'bad agentobj.l("3")', agentobj.l;
abort$[ abs(agentobj.l('4')+ 39.619) > tol ] 'bad agentobj.l("4")', agentobj.l;
abort$[ abs(agentobj.l('5')+ 93.125) > tol ] 'bad agentobj.l("5")', agentobj.l;
abort$[ abs(q0.l-0) > tol ] 'bad q0.l', q0.l;
abort$[ abs(q.l('1','1')-1.717) > tol ] 'bad q.l("1","1")', q.l;
abort$[ abs(q.l('2','1')-5.788) > tol ] 'bad q.l("2","1")', q.l;
abort$[ abs(q.l('3','1')-3.831) > tol ] 'bad q.l("3","1")', q.l;
abort$[ abs(q.l('4','1')-3.011) > tol ] 'bad q.l("4","1")', q.l;
abort$[ abs(q.l('5','1')-2.922) > tol ] 'bad q.l("5","1")', q.l;
abort$[ abs(z.l-17.269) > tol ] 'bad z.l', z.l;
abort$[ smax{i, abs(defdemandExp.m(i)-19.571)} > tol ]
'bad defdemandExp.m(i)', defdemandExp.m;
isoobj.l = 0;
agentobj.l(j) = 0;
q0.l = 0;
q.l(j,k) = 0;
z.l = 0;
defisoobj.m = 0;
defagentobj.m(j) = 0;
defdemandExp.m(i) = 0;
defz.m = 0;
$onEchoV > implSwitching_gms
***********************************************
* for more information use JAMS option "Dict"
***********************************************
Variables x7,x8,x9,x10,x11,x12,x13,u7,u8,u9,u10,u11,u12,u13_5,u13_6,u13_7
,u13_8,u13_9;
Positive Variables x8,x9,x10,x11,x12,x13;
Equations e7,e8,e9,e10,e11,e12,e13,dL_dx7_5,dL_dx8,dL_dx9,dL_dx10,dL_dx11
,dL_dx12,dL_dx13,dL_dx7_6,dL_dx7_7,dL_dx7_8,dL_dx7_9;
e7.. x8 + x9 + x10 + x11 + x12 + x13 =E= 17.269913736;
e8.. x8 + x9 + x10 + x11 + x12 + x13 =E= 17.269913736;
e9.. x8 + x9 + x10 + x11 + x12 + x13 =E= 17.269913736;
e10.. x8 + x9 + x10 + x11 + x12 + x13 =E= 17.269913736;
e11.. x8 + x9 + x10 + x11 + x12 + x13 =E= 17.269913736;
e12.. x8 + x9 + x10 + x11 + x12 + x13 =E= 17.269913736;
e13.. x7 - x9 - x10 - x11 - x12 - x13 =E= 0;
dL_dx7_5.. (-0.357641894777802*x7*x9)/(-1) - u13_5 =E= 0;
dL_dx8.. 120 - u7 + eps*x8 =N= 0;
dL_dx9.. (-(59.94352881 + 0.5*(0.4896211468*x9 + 0.4896211468*x9) - (120 -
0.178820947388901*sqr(x7))))/(-1) - u8 + u13_5 =N= 0;
dL_dx10.. (-(47.36200134 + 0.5*(0.5399322016*x10 + 0.5399322016*x10) - (120 -
0.178820947388901*sqr(x7))))/(-1) - u9 + u13_6 =N= 0;
dL_dx11.. (-(59.73399117 + 0.5*(0.7425081388*x11 + 0.7425081388*x11) - (120 -
0.178820947388901*sqr(x7))))/(-1) - u10 + u13_7 =N= 0;
dL_dx12.. (-(52.86751401 + 0.5*(0.4268454892*x12 + 0.4268454892*x12) - (120 -
0.178820947388901*sqr(x7))))/(-1) - u11 + u13_8 =N= 0;
dL_dx13.. (-(33.92077449 + 0.5*(0.6000842676*x13 + 0.6000842676*x13) - (120 -
0.178820947388901*sqr(x7))))/(-1) - u12 + u13_9 =N= 0;
dL_dx7_6.. (-0.357641894777802*x7*x10)/(-1) - u13_6 =E= 0;
dL_dx7_7.. (-0.357641894777802*x7*x11)/(-1) - u13_7 =E= 0;
dL_dx7_8.. (-0.357641894777802*x7*x12)/(-1) - u13_8 =E= 0;
dL_dx7_9.. (-0.357641894777802*x7*x13)/(-1) - u13_9 =E= 0;
* set non-default bounds
x8.up = 5;
x9.up = 1.71747132;
x10.up = 8.43266708;
x11.up = 5.50375356;
x12.up = 3.01137904;
x13.up = 2.92212117;
Model m / e7.u7,e8.u8,e9.u9,e10.u10,e11.u11,e12.u12,e13.x7,dL_dx7_5.u13_5
,dL_dx8.x8,dL_dx9.x9,dL_dx10.x10,dL_dx11.x11,dL_dx12.x12
,dL_dx13.x13,dL_dx7_6.u13_6,dL_dx7_7.u13_7,dL_dx7_8.u13_8
,dL_dx7_9.u13_9 /;
File implvarfile / '%gams.scrdir%implvar.dat' /;
Put implvarfile;
$onPutV
x7
u13_5
u13_6
u13_7
u13_8
u13_9
$offPut
m.limrow=0; m.limcol=0;
Solve m using MCP;
$offEcho
execute 'grep -v " written by GAMS" implSwitching_gms > implSwitching.gms.want'
execute 'grep -v " written by GAMS" implSwitching.gms > implSwitching.gms.got'
execute '=diff -I reslim -bw implSwitching.gms.want implSwitching.gms.got'
abort$errorlevel 'Files implSwitching.gms.want and implSwitching.gms.got differ';
$onEcho > implSwitching_dict
********************************************************************************
Contents
1 Content of EMP Information File
2 Processed EMP Information
3 Dictionary
3.1 Constraints
3.2 Variables
********************************************************************************
1 Content of EMP Information File
---------------------------------
1:equilibrium
2:implicit z defz
3:min isoobj q0
4:defisoobj defdemandExp('0')
5:min agentobj('1')
6:q('1','1')
7:z
8:defagentobj('1') defdemandExp('1')
9:min agentobj('2')
10:q('2','1')
11:z
12:defagentobj('2') defdemandExp('2')
13:min agentobj('3')
14:q('3','1')
15:z
16:defagentobj('3') defdemandExp('3')
17:min agentobj('4')
18:q('4','1')
19:z
20:defagentobj('4') defdemandExp('4')
21:min agentobj('5')
22:q('5','1')
23:z
24:defagentobj('5') defdemandExp('5')
2 Processed EMP Information
---------------------------
3 Dictionary
------------
3.1 Constraints
---------------
{reformulated} defisoobj
{reformulated} defagentobj(1)
{reformulated} defagentobj(2)
{reformulated} defagentobj(3)
{reformulated} defagentobj(4)
{reformulated} defagentobj(5)
e7 defdemandExp(0)
e8 defdemandExp(1)
e9 defdemandExp(2)
e10 defdemandExp(3)
e11 defdemandExp(4)
e12 defdemandExp(5)
e13 defz
dL_dx7_5 {new}
dL_dx8 {new}
dL_dx9 {new}
dL_dx10 {new}
dL_dx11 {new}
dL_dx12 {new}
dL_dx13 {new}
dL_dx7_6 {new}
dL_dx7_7 {new}
dL_dx7_8 {new}
dL_dx7_9 {new}
3.2 Variables
--------------
{reformulated} isoobj
{reformulated} agentobj(1)
{reformulated} agentobj(2)
{reformulated} agentobj(3)
{reformulated} agentobj(4)
{reformulated} agentobj(5)
x7 z
x8 q0
x9 q(1,1)
x10 q(2,1)
x11 q(3,1)
x12 q(4,1)
x13 q(5,1)
u7 {new}
u8 {new}
u9 {new}
u10 {new}
u11 {new}
u12 {new}
u13_5 {new}
u13_6 {new}
u13_7 {new}
u13_8 {new}
u13_9 {new}
$offEcho
execute 'grep -v " written by GAMS" implSwitching_dict > implSwitchingDict.txt.want'
execute 'grep -v " written by GAMS" implSwitchingDict.txt > implSwitchingDict.txt.got'
execute '=diff -bw implSwitchingDict.txt.want implSwitchingDict.txt.got'
abort$errorlevel 'Files implSwitchingDict.txt.want and implSwitchingDict.txt.got differ';
* Test with implicit and GNEP shared constraint.
defdemand..
q0 + sum((j,k), q(j,k)) =E= d;
model ms 'implicit with GNEP shared constraint'
/ defisoobj, defagentobj, defdemand, defz /;
put info 'equilibrium';
put / 'implicit', z, defz;
put / 'min', isoobj, q0;
put / defisoobj, defdemand;
loop(j,
put / 'min', agentobj(j);
loop(k, put / q(j,k););
put / z;
put / defagentobj(j), defdemand;
);
putclose;
putclose opt
'Dict implGNEPDict.txt' /
'FileName implGNEP.gms' /
'ImplVarModel substitution' /
'SharedEqu' ;
ms.optfile = 1;
solve ms using emp;
abort$[ms.solvestat <> %solveStat.normalCompletion%]
'wrong ms.solvestat', ms.solvestat;
abort$[ms.modelstat > %modelStat.locallyOptimal%]
'wrong ms.modelstat', ms.modelstat;
abort$[ abs(isoobj.l+267.374) > tol ] 'bad isoobj.l', isoobj.l;
abort$[ abs(agentobj.l('1')+ 10.825) > tol ] 'bad agentobj.l("1")', agentobj.l;
abort$[ abs(agentobj.l('2')+102.696) > tol ] 'bad agentobj.l("2")', agentobj.l;
abort$[ abs(agentobj.l('3')+ 21.109) > tol ] 'bad agentobj.l("3")', agentobj.l;
abort$[ abs(agentobj.l('4')+ 39.619) > tol ] 'bad agentobj.l("4")', agentobj.l;
abort$[ abs(agentobj.l('5')+ 93.125) > tol ] 'bad agentobj.l("5")', agentobj.l;
abort$[ abs(q0.l-0) > tol ] 'bad q0.l', q0.l;
abort$[ abs(q.l('1','1')-1.717) > tol ] 'bad q.l("1","1")', q.l;
abort$[ abs(q.l('2','1')-5.788) > tol ] 'bad q.l("2","1")', q.l;
abort$[ abs(q.l('3','1')-3.831) > tol ] 'bad q.l("3","1")', q.l;
abort$[ abs(q.l('4','1')-3.011) > tol ] 'bad q.l("4","1")', q.l;
abort$[ abs(q.l('5','1')-2.922) > tol ] 'bad q.l("5","1")', q.l;
abort$[ abs(z.l-17.269) > tol ] 'bad z.l', z.l;
set ag / 1*6 /;
parameter defdemand_m(ag);
execute_load '%gams.scrdir%/ugdx.dat', defdemand_m=defdemand;
abort$[ smax{ag, abs(defdemand_m(ag)-19.571)} > tol ]
'bad defdemand_m(ag)', defdemand_m;
isoobj.l = 0;
agentobj.l(j) = 0;
q0.l = 0;
q.l(j,k) = 0;
z.l = 0;
defisoobj.m = 0;
defagentobj.m(j) = 0;
defdemand.m = 0;
defz.m = 0;
$onEchoV > implGNEP_gms
***********************************************
* written by GAMS/JAMS at 11/15/17 22:33:31
* for more information use JAMS option "Dict"
***********************************************
Variables x7,x8,x9,x10,x11,x12,x13,u7_4,u7_5,u7_6,u7_7,u7_8,u7_9;
Positive Variables x8,x9,x10,x11,x12,x13;
Equations e7_4,e8,e7_5,e7_6,e7_7,e7_8,e7_9,dL_dx8,dL_dx9,dL_dx10,dL_dx11
,dL_dx12,dL_dx13;
e7_4.. x8 + x9 + x10 + x11 + x12 + x13 =E= 17.269913736;
e8.. x7 - x9 - x10 - x11 - x12 - x13 =E= 0;
e7_5.. x8 + x9 + x10 + x11 + x12 + x13 =E= 17.269913736;
e7_6.. x8 + x9 + x10 + x11 + x12 + x13 =E= 17.269913736;
e7_7.. x8 + x9 + x10 + x11 + x12 + x13 =E= 17.269913736;
e7_8.. x8 + x9 + x10 + x11 + x12 + x13 =E= 17.269913736;
e7_9.. x8 + x9 + x10 + x11 + x12 + x13 =E= 17.269913736;
dL_dx8.. 120 - u7_4 + eps*x8 =N= 0;
dL_dx9.. (-(59.94352881 + 0.5*(0.4896211468*x9 + 0.4896211468*x9) - (120 -
0.178820947388901*sqr(x7))))/(-1) + ((-0.357641894777802*x7*x9)/(-1)
)*(1) - u7_5 =N= 0;
dL_dx10.. (-(47.36200134 + 0.5*(0.5399322016*x10 + 0.5399322016*x10) - (120 -
0.178820947388901*sqr(x7))))/(-1) + ((-0.357641894777802*x7*x10)/(-1)
)*(1) - u7_6 =N= 0;
dL_dx11.. (-(59.73399117 + 0.5*(0.7425081388*x11 + 0.7425081388*x11) - (120 -
0.178820947388901*sqr(x7))))/(-1) + ((-0.357641894777802*x7*x11)/(-1)
)*(1) - u7_7 =N= 0;
dL_dx12.. (-(52.86751401 + 0.5*(0.4268454892*x12 + 0.4268454892*x12) - (120 -
0.178820947388901*sqr(x7))))/(-1) + ((-0.357641894777802*x7*x12)/(-1)
)*(1) - u7_8 =N= 0;
dL_dx13.. (-(33.92077449 + 0.5*(0.6000842676*x13 + 0.6000842676*x13) - (120 -
0.178820947388901*sqr(x7))))/(-1) + ((-0.357641894777802*x7*x13)/(-1)
)*(1) - u7_9 =N= 0;
* set non-default bounds
x8.up = 5;
x9.up = 1.71747132;
x10.up = 8.43266708;
x11.up = 5.50375356;
x12.up = 3.01137904;
x13.up = 2.92212117;
Model m / e7_4.u7_4,e8.x7,e7_5.u7_5,e7_6.u7_6,e7_7.u7_7,e7_8.u7_8,e7_9.u7_9
,dL_dx8.x8,dL_dx9.x9,dL_dx10.x10,dL_dx11.x11,dL_dx12.x12
,dL_dx13.x13 /;
File implvarfile / '%gams.scrdir%implvar.dat' /;
Put implvarfile;
$onPutV
x7
$offPut
m.limrow=0; m.limcol=0;
Solve m using MCP;
$offEcho
execute 'grep -v " written by GAMS" implGNEP_gms > implGNEP.gms.want'
execute 'grep -v " written by GAMS" implGNEP.gms > implGNEP.gms.got'
execute '=diff -I reslim -bw implGNEP.gms.want implGNEP.gms.got'
abort$errorlevel 'Files implGNEP.gms.want and implGNEP.gms.got differ';
$onEcho > implGNEP_dict
* written by GAMS/JAMS at 12/05/16 14:43:13
********************************************************************************
Contents
1 Content of EMP Information File
2 Processed EMP Information
3 Dictionary
3.1 Constraints
3.2 Variables
********************************************************************************
1 Content of EMP Information File
---------------------------------
1:equilibrium
2:implicit z defz
3:min isoobj q0
4:defisoobj defdemand
5:min agentobj('1')
6:q('1','1')
7:z
8:defagentobj('1') defdemand
9:min agentobj('2')
10:q('2','1')
11:z
12:defagentobj('2') defdemand
13:min agentobj('3')
14:q('3','1')
15:z
16:defagentobj('3') defdemand
17:min agentobj('4')
18:q('4','1')
19:z
20:defagentobj('4') defdemand
21:min agentobj('5')
22:q('5','1')
23:z
24:defagentobj('5') defdemand
2 Processed EMP Information
---------------------------
3 Dictionary
------------
3.1 Constraints
---------------
{reformulated} defisoobj
{reformulated} defagentobj(1)
{reformulated} defagentobj(2)
{reformulated} defagentobj(3)
{reformulated} defagentobj(4)
{reformulated} defagentobj(5)
e7_4 defdemand
e8 defz
e7_5 defdemand
e7_6 defdemand
e7_7 defdemand
e7_8 defdemand
e7_9 defdemand
dL_dx8 {new}
dL_dx9 {new}
dL_dx10 {new}
dL_dx11 {new}
dL_dx12 {new}
dL_dx13 {new}
3.2 Variables
--------------
{reformulated} isoobj
{reformulated} agentobj(1)
{reformulated} agentobj(2)
{reformulated} agentobj(3)
{reformulated} agentobj(4)
{reformulated} agentobj(5)
x7 z
x8 q0
x9 q(1,1)
x10 q(2,1)
x11 q(3,1)
x12 q(4,1)
x13 q(5,1)
u7_4 {new}
u7_5 {new}
u7_6 {new}
u7_7 {new}
u7_8 {new}
u7_9 {new}
$offEcho
execute 'grep -v " written by GAMS" implGNEP_dict > implGNEPDict.txt.want'
execute 'grep -v " written by GAMS" implGNEPDict.txt > implGNEPDict.txt.got'
execute '=diff -bw implGNEPDict.txt.want implGNEPDict.txt.got'
abort$errorlevel 'Files implGNEPDict.txt.want and implGNEPDict.txt.got differ';
* Test with implicit and VI shared constraint.
put info 'equilibrium';
put / 'implicit', z, defz;
put / 'visol', defdemand;
put / 'min', isoobj, q0;
put / defisoobj, defdemand;
loop(j,
put / 'min', agentobj(j);
loop(k, put / q(j,k););
put / z;
put / defagentobj(j), defdemand;
);
putclose;
putclose opt
'Dict implVIDict.txt' /
'FileName implVI.gms' /
'ImplVarModel substitution' /
'SharedEqu';
ms.optfile = 1;
solve ms using emp;
abort$[ms.solvestat <> %solveStat.normalCompletion%]
'wrong ms.solvestat', ms.solvestat;
abort$[ms.modelstat > %modelStat.locallyOptimal%]
'wrong ms.modelstat', ms.modelstat;
abort$[ abs(isoobj.l+267.374) > tol ] 'bad isoobj.l', isoobj.l;
abort$[ abs(agentobj.l('1')+ 10.825) > tol ] 'bad agentobj.l("1")', agentobj.l;
abort$[ abs(agentobj.l('2')+102.696) > tol ] 'bad agentobj.l("2")', agentobj.l;
abort$[ abs(agentobj.l('3')+ 21.109) > tol ] 'bad agentobj.l("3")', agentobj.l;
abort$[ abs(agentobj.l('4')+ 39.619) > tol ] 'bad agentobj.l("4")', agentobj.l;
abort$[ abs(agentobj.l('5')+ 93.125) > tol ] 'bad agentobj.l("5")', agentobj.l;
abort$[ abs(q0.l-0) > tol ] 'bad q0.l', q0.l;
abort$[ abs(q.l('1','1')-1.717) > tol ] 'bad q.l("1","1")', q.l;
abort$[ abs(q.l('2','1')-5.788) > tol ] 'bad q.l("2","1")', q.l;
abort$[ abs(q.l('3','1')-3.831) > tol ] 'bad q.l("3","1")', q.l;
abort$[ abs(q.l('4','1')-3.011) > tol ] 'bad q.l("4","1")', q.l;
abort$[ abs(q.l('5','1')-2.922) > tol ] 'bad q.l("5","1")', q.l;
abort$[ abs(z.l-17.269) > tol ] 'bad z.l', z.l;
abort$[ abs(defdemand.m-19.571) > tol ] 'bad defdemand.m', defdemand.m;
isoobj.l = 0;
agentobj.l(j) = 0;
q0.l = 0;
q.l(j,k) = 0;
z.l = 0;
defisoobj.m = 0;
defagentobj.m(j) = 0;
defdemand.m = 0;
defz.m = 0;
$onEchoV > implVI_gms
***********************************************
* written by GAMS/JAMS at 11/15/17 22:34:05
* for more information use JAMS option "Dict"
***********************************************
Variables x7,x8,x9,x10,x11,x12,x13,u7;
Positive Variables x8,x9,x10,x11,x12,x13;
Equations e7,e8,dL_dx8,dL_dx9,dL_dx10,dL_dx11,dL_dx12,dL_dx13;
e7.. x8 + x9 + x10 + x11 + x12 + x13 =E= 17.269913736;
e8.. x7 - x9 - x10 - x11 - x12 - x13 =E= 0;
dL_dx8.. 120 - u7 + eps*x8 =N= 0;
dL_dx9.. (-(59.94352881 + 0.5*(0.4896211468*x9 + 0.4896211468*x9) - (120 -
0.178820947388901*sqr(x7))))/(-1) + ((-0.357641894777802*x7*x9)/(-1)
)*(1) - u7 =N= 0;
dL_dx10.. (-(47.36200134 + 0.5*(0.5399322016*x10 + 0.5399322016*x10) - (120 -
0.178820947388901*sqr(x7))))/(-1) + ((-0.357641894777802*x7*x10)/(-1)
)*(1) - u7 =N= 0;
dL_dx11.. (-(59.73399117 + 0.5*(0.7425081388*x11 + 0.7425081388*x11) - (120 -
0.178820947388901*sqr(x7))))/(-1) + ((-0.357641894777802*x7*x11)/(-1)
)*(1) - u7 =N= 0;
dL_dx12.. (-(52.86751401 + 0.5*(0.4268454892*x12 + 0.4268454892*x12) - (120 -
0.178820947388901*sqr(x7))))/(-1) + ((-0.357641894777802*x7*x12)/(-1)
)*(1) - u7 =N= 0;
dL_dx13.. (-(33.92077449 + 0.5*(0.6000842676*x13 + 0.6000842676*x13) - (120 -
0.178820947388901*sqr(x7))))/(-1) + ((-0.357641894777802*x7*x13)/(-1)
)*(1) - u7 =N= 0;
* set non-default bounds
x8.up = 5;
x9.up = 1.71747132;
x10.up = 8.43266708;
x11.up = 5.50375356;
x12.up = 3.01137904;
x13.up = 2.92212117;
Model m / e7.u7,e8.x7,dL_dx8.x8,dL_dx9.x9,dL_dx10.x10,dL_dx11.x11
,dL_dx12.x12,dL_dx13.x13 /;
File implvarfile / '%gams.scrdir%implvar.dat' /;
Put implvarfile;
$onPutV
x7
$offPut
m.limrow=0; m.limcol=0;
Solve m using MCP;
$offEcho
execute 'grep -v " written by GAMS" implVI_gms > implVI.gms.want'
execute 'grep -v " written by GAMS" implVI.gms > implVI.gms.got'
execute '=diff -I reslim -bw implVI.gms.want implVI.gms.got'
abort$errorlevel 'Files implVI.gms.want and implVI.gms.got differ';
$onEcho > implVI_dict
* written by GAMS/JAMS at 12/05/16 00:11:35
********************************************************************************
Contents
1 Content of EMP Information File
2 Processed EMP Information
3 Dictionary
3.1 Constraints
3.2 Variables
********************************************************************************
1 Content of EMP Information File
---------------------------------
1:equilibrium
2:implicit z defz
3:visol defdemand
4:min isoobj q0
5:defisoobj defdemand
6:min agentobj('1')
7:q('1','1')
8:z
9:defagentobj('1') defdemand
10:min agentobj('2')
11:q('2','1')
12:z
13:defagentobj('2') defdemand
14:min agentobj('3')
15:q('3','1')
16:z
17:defagentobj('3') defdemand
18:min agentobj('4')
19:q('4','1')
20:z
21:defagentobj('4') defdemand
22:min agentobj('5')
23:q('5','1')
24:z
25:defagentobj('5') defdemand
2 Processed EMP Information
---------------------------
3 Dictionary
------------
3.1 Constraints
---------------
{reformulated} defisoobj
{reformulated} defagentobj(1)
{reformulated} defagentobj(2)
{reformulated} defagentobj(3)
{reformulated} defagentobj(4)
{reformulated} defagentobj(5)
e7 defdemand
e8 defz
dL_dx8 {new}
dL_dx9 {new}
dL_dx10 {new}
dL_dx11 {new}
dL_dx12 {new}
dL_dx13 {new}
3.2 Variables
--------------
{reformulated} isoobj
{reformulated} agentobj(1)
{reformulated} agentobj(2)
{reformulated} agentobj(3)
{reformulated} agentobj(4)
{reformulated} agentobj(5)
x7 z
x8 q0
x9 q(1,1)
x10 q(2,1)
x11 q(3,1)
x12 q(4,1)
x13 q(5,1)
u7 {new}
$offEcho
execute 'grep -v " written by GAMS" implVI_dict > implVIDict.txt.want'
execute 'grep -v " written by GAMS" implVIDict.txt > implVIDict.txt.got'
execute '=diff -bw implVIDict.txt.want implVIDict.txt.got'
abort$errorlevel 'Files implVIDict.txt.want and implVIDict.txt.got differ';
* Test with GNEP with implicit z being appeared in it.
equation
defdemandz
;
defdemandz..
q0 + z =E= d;
model msz 'GNEP shared constraint with implicit in it'
/ defisoobj, defagentobj, defdemandz, defz /;
put info 'equilibrium';
put / 'implicit', z, defz;
put / 'min', isoobj, q0;
put / defisoobj, defdemandz;
loop(j,
put / 'min', agentobj(j);
loop(k, put / q(j,k););
put / z;
put / defagentobj(j), defdemandz;
);
putclose;
putclose opt
'Dict implSubstitutionGNEPMixDict.txt' /
'FileName implSubstitutionGNEPMix.gms' /
'ImplVarModel substitution' /
'SharedEqu'
;
msz.optfile = 1;
solve msz using emp;
abort$[msz.solvestat <> %solveStat.normalCompletion%]
'wrong msz.solvestat', msz.solvestat;
abort$[msz.modelstat > %modelStat.locallyOptimal%]
'wrong msz.modelstat', msz.modelstat;
abort$[ abs(isoobj.l+267.374) > tol ] 'bad isoobj.l', isoobj.l;
abort$[ abs(agentobj.l('1')+ 10.825) > tol ] 'bad agentobj.l("1")', agentobj.l;
abort$[ abs(agentobj.l('2')+102.696) > tol ] 'bad agentobj.l("2")', agentobj.l;
abort$[ abs(agentobj.l('3')+ 21.109) > tol ] 'bad agentobj.l("3")', agentobj.l;
abort$[ abs(agentobj.l('4')+ 39.619) > tol ] 'bad agentobj.l("4")', agentobj.l;
abort$[ abs(agentobj.l('5')+ 93.125) > tol ] 'bad agentobj.l("5")', agentobj.l;
abort$[ abs(q0.l-0) > tol ] 'bad q0.l', q0.l;
abort$[ abs(q.l('1','1')-1.717) > tol ] 'bad q.l("1","1")', q.l;
abort$[ abs(q.l('2','1')-5.788) > tol ] 'bad q.l("2","1")', q.l;
abort$[ abs(q.l('3','1')-3.831) > tol ] 'bad q.l("3","1")', q.l;
abort$[ abs(q.l('4','1')-3.011) > tol ] 'bad q.l("4","1")', q.l;
abort$[ abs(q.l('5','1')-2.922) > tol ] 'bad q.l("5","1")', q.l;
abort$[ abs(z.l-17.269) > tol ] 'bad z.l', z.l;
set agz / 1*6 /;
parameter defdemandz_m(agz);
execute_load '%gams.scrdir%/ugdx.dat', defdemandz_m=defdemandz;
abort$[ smax{agz, abs(defdemandz_m(agz)-19.571)} > tol ]
'bad defdemandz_m(agz)', defdemandz_m;
isoobj.l = 0;
agentobj.l(j) = 0;
q0.l = 0;
q.l(j,k) = 0;
z.l = 0;
defisoobj.m = 0;
defagentobj.m(j) = 0;
defdemandz.m = 0;
defz.m = 0;
putclose opt
'Dict implSwitchingGNEPMixDict.txt' /
'FileName implSwitchingGNEPMix.gms' /
'ImplVarModel switching' /
'SharedEqu'
;
msz.optfile = 1;
solve msz using emp;
abort$[msz.solvestat <> %solveStat.normalCompletion%]
'wrong msz.solvestat', msz.solvestat;
abort$[msz.modelstat > %modelStat.locallyOptimal%]
'wrong msz.modelstat', msz.modelstat;
abort$[ abs(isoobj.l+267.374) > tol ] 'bad isoobj.l', isoobj.l;
abort$[ abs(agentobj.l('1')+ 10.825) > tol ] 'bad agentobj.l("1")', agentobj.l;
abort$[ abs(agentobj.l('2')+102.696) > tol ] 'bad agentobj.l("2")', agentobj.l;
abort$[ abs(agentobj.l('3')+ 21.109) > tol ] 'bad agentobj.l("3")', agentobj.l;
abort$[ abs(agentobj.l('4')+ 39.619) > tol ] 'bad agentobj.l("4")', agentobj.l;
abort$[ abs(agentobj.l('5')+ 93.125) > tol ] 'bad agentobj.l("5")', agentobj.l;
abort$[ abs(q0.l-0) > tol ] 'bad q0.l', q0.l;
abort$[ abs(q.l('1','1')-1.717) > tol ] 'bad q.l("1","1")', q.l;
abort$[ abs(q.l('2','1')-5.788) > tol ] 'bad q.l("2","1")', q.l;
abort$[ abs(q.l('3','1')-3.831) > tol ] 'bad q.l("3","1")', q.l;
abort$[ abs(q.l('4','1')-3.011) > tol ] 'bad q.l("4","1")', q.l;
abort$[ abs(q.l('5','1')-2.922) > tol ] 'bad q.l("5","1")', q.l;
abort$[ abs(z.l-17.269) > tol ] 'bad z.l', z.l;
execute_load '%gams.scrdir%/ugdx.dat', defdemandz_m=defdemandz;
abort$[ smax{agz, abs(defdemandz_m(agz)-19.571)} > tol ]
'bad defdemandz_m(agz)', defdemandz_m;
isoobj.l = 0;
agentobj.l(j) = 0;
q0.l = 0;
q.l(j,k) = 0;
z.l = 0;
defisoobj.m = 0;
defagentobj.m(j) = 0;
defdemandz.m = 0;
defz.m = 0;
$onEchoV > implSwitchingGNEPMix_gms
***********************************************
* written by GAMS/JAMS at 11/12/17 21:06:29
* for more information use JAMS option "Dict"
***********************************************
Variables x7,x8,x9,x10,x11,x12,x13,u7_4,u8_5,u7_5,u7_6,u7_7,u7_8,u7_9,u8_6
,u8_7,u8_8,u8_9;
Positive Variables x8,x9,x10,x11,x12,x13;
Equations e7_4,e8,e7_5,e7_6,e7_7,e7_8,e7_9,dL_dx7_5,dL_dx8,dL_dx9,dL_dx10
,dL_dx11,dL_dx12,dL_dx13,dL_dx7_6,dL_dx7_7,dL_dx7_8,dL_dx7_9;
e7_4.. x7 + x8 =E= 17.269913736;
e8.. x7 - x9 - x10 - x11 - x12 - x13 =E= 0;
e7_5.. x7 + x8 =E= 17.269913736;
e7_6.. x7 + x8 =E= 17.269913736;
e7_7.. x7 + x8 =E= 17.269913736;
e7_8.. x7 + x8 =E= 17.269913736;
e7_9.. x7 + x8 =E= 17.269913736;
dL_dx7_5.. (-0.357641894777802*x7*x9)/(-1) - u7_5 - u8_5 =E= 0;
dL_dx8.. 120 - u7_4 + eps*x8 =N= 0;
dL_dx9.. (-(59.94352881 + 0.5*(0.4896211468*x9 + 0.4896211468*x9) - (120 -
0.178820947388901*sqr(x7))))/(-1) + u8_5 =N= 0;
dL_dx10.. (-(47.36200134 + 0.5*(0.5399322016*x10 + 0.5399322016*x10) - (120 -
0.178820947388901*sqr(x7))))/(-1) + u8_6 =N= 0;
dL_dx11.. (-(59.73399117 + 0.5*(0.7425081388*x11 + 0.7425081388*x11) - (120 -
0.178820947388901*sqr(x7))))/(-1) + u8_7 =N= 0;
dL_dx12.. (-(52.86751401 + 0.5*(0.4268454892*x12 + 0.4268454892*x12) - (120 -
0.178820947388901*sqr(x7))))/(-1) + u8_8 =N= 0;
dL_dx13.. (-(33.92077449 + 0.5*(0.6000842676*x13 + 0.6000842676*x13) - (120 -
0.178820947388901*sqr(x7))))/(-1) + u8_9 =N= 0;
dL_dx7_6.. (-0.357641894777802*x7*x10)/(-1) - u7_6 - u8_6 =E= 0;
dL_dx7_7.. (-0.357641894777802*x7*x11)/(-1) - u7_7 - u8_7 =E= 0;
dL_dx7_8.. (-0.357641894777802*x7*x12)/(-1) - u7_8 - u8_8 =E= 0;
dL_dx7_9.. (-0.357641894777802*x7*x13)/(-1) - u7_9 - u8_9 =E= 0;
* set non-default bounds
x8.up = 5;
x9.up = 1.71747132;
x10.up = 8.43266708;
x11.up = 5.50375356;
x12.up = 3.01137904;
x13.up = 2.92212117;
Model m / e7_4.u7_4,e8.x7,e7_5.u7_5,e7_6.u7_6,e7_7.u7_7,e7_8.u7_8,e7_9.u7_9
,dL_dx7_5.u8_5,dL_dx8.x8,dL_dx9.x9,dL_dx10.x10,dL_dx11.x11
,dL_dx12.x12,dL_dx13.x13,dL_dx7_6.u8_6,dL_dx7_7.u8_7,dL_dx7_8.u8_8
,dL_dx7_9.u8_9 /;
File implvarfile / '%gams.scrdir%implvar.dat' /;
Put implvarfile;
$onPutV
x7
u8_5
u8_6
u8_7
u8_8
u8_9
$offPut
m.limrow=0; m.limcol=0;
Solve m using MCP;
$offEcho
execute 'grep -v " written by GAMS" implSwitchingGNEPMix_gms > implSwitchingGNEPMix.gms.want'
execute 'grep -v " written by GAMS" implSwitchingGNEPMix.gms > implSwitchingGNEPMix.gms.got'
execute '=diff -I reslim -bw implSwitchingGNEPMix.gms.want implSwitchingGNEPMix.gms.got'
abort$errorlevel 'Files implSwitchingGNEPMix.gms.want and implSwitchingGNEPMix.gms.got differ';
$onEcho > implSwitchingGNEPMix_dict
* written by GAMS/JAMS at 11/12/17 21:07:57
********************************************************************************
Contents
1 Content of EMP Information File
2 Processed EMP Information
3 Dictionary
3.1 Constraints
3.2 Variables
********************************************************************************
1 Content of EMP Information File
---------------------------------
1:equilibrium
2:implicit z defz
3:min isoobj q0
4:defisoobj defdemandz
5:min agentobj('1')
6:q('1','1')
7:z
8:defagentobj('1') defdemandz
9:min agentobj('2')
10:q('2','1')
11:z
12:defagentobj('2') defdemandz
13:min agentobj('3')
14:q('3','1')
15:z
16:defagentobj('3') defdemandz
17:min agentobj('4')
18:q('4','1')
19:z
20:defagentobj('4') defdemandz
21:min agentobj('5')
22:q('5','1')
23:z
24:defagentobj('5') defdemandz
2 Processed EMP Information
---------------------------
3 Dictionary
------------
3.1 Constraints
---------------
{reformulated} defisoobj
{reformulated} defagentobj(1)
{reformulated} defagentobj(2)
{reformulated} defagentobj(3)
{reformulated} defagentobj(4)
{reformulated} defagentobj(5)
e7_4 defdemandz
e8 defz
e7_5 defdemandz
e7_6 defdemandz
e7_7 defdemandz
e7_8 defdemandz
e7_9 defdemandz
dL_dx7_5 {new}
dL_dx8 {new}
dL_dx9 {new}
dL_dx10 {new}
dL_dx11 {new}
dL_dx12 {new}
dL_dx13 {new}
dL_dx7_6 {new}
dL_dx7_7 {new}
dL_dx7_8 {new}
dL_dx7_9 {new}
3.2 Variables
--------------
{reformulated} isoobj
{reformulated} agentobj(1)
{reformulated} agentobj(2)
{reformulated} agentobj(3)
{reformulated} agentobj(4)
{reformulated} agentobj(5)
x7 z
x8 q0
x9 q(1,1)
x10 q(2,1)
x11 q(3,1)
x12 q(4,1)
x13 q(5,1)
u7_4 {new}
u8_5 {new}
u8_6 {new}
u8_7 {new}
u8_8 {new}
u8_9 {new}
u7_5 {new}
u7_6 {new}
u7_7 {new}
u7_8 {new}
u7_9 {new}
$offEcho
execute 'grep -v " written by GAMS" implSwitchingGNEPMix_dict > implSwitchingGNEPMixDict.txt.want'
execute 'grep -v " written by GAMS" implSwitchingGNEPMixDict.txt > implSwitchingGNEPMixDict.txt.got'
execute '=diff -bw implSwitchingGNEPMixDict.txt.want implSwitchingGNEPMixDict.txt.got'
abort$errorlevel 'Files implSwitchingGNEPMixDict.txt.want and implSwitchingGNEPMixDict.txt.got differ';
* Test with VISOL with implicit z being appeared in it.
put info 'equilibrium';
put / 'implicit', z, defz;
put / 'visol', defdemandz;
put / 'min', isoobj, q0;
put / defisoobj, defdemandz;
loop(j,
put / 'min', agentobj(j);
loop(k, put / q(j,k););
put / z;
put / defagentobj(j), defdemandz;
);
putclose;
putclose opt
'Dict implSwitchingVIDict.txt' /
'FileName implSwitchingVI.gms' /
'ImplVarModel switching' /
'SharedEqu';
msz.optfile = 1;
solve msz using emp;
abort$[msz.solvestat <> %solveStat.normalCompletion%]
'wrong msz.solvestat', msz.solvestat;
abort$[msz.modelstat > %modelStat.locallyOptimal%]
'wrong msz.modelstat', msz.modelstat;
abort$[ abs(isoobj.l+267.374) > tol ] 'bad isoobj.l', isoobj.l;
abort$[ abs(agentobj.l('1')+ 10.825) > tol ] 'bad agentobj.l("1")', agentobj.l;
abort$[ abs(agentobj.l('2')+102.696) > tol ] 'bad agentobj.l("2")', agentobj.l;
abort$[ abs(agentobj.l('3')+ 21.109) > tol ] 'bad agentobj.l("3")', agentobj.l;
abort$[ abs(agentobj.l('4')+ 39.619) > tol ] 'bad agentobj.l("4")', agentobj.l;
abort$[ abs(agentobj.l('5')+ 93.125) > tol ] 'bad agentobj.l("5")', agentobj.l;
abort$[ abs(q0.l-0) > tol ] 'bad q0.l', q0.l;
abort$[ abs(q.l('1','1')-1.717) > tol ] 'bad q.l("1","1")', q.l;
abort$[ abs(q.l('2','1')-5.788) > tol ] 'bad q.l("2","1")', q.l;
abort$[ abs(q.l('3','1')-3.831) > tol ] 'bad q.l("3","1")', q.l;
abort$[ abs(q.l('4','1')-3.011) > tol ] 'bad q.l("4","1")', q.l;
abort$[ abs(q.l('5','1')-2.922) > tol ] 'bad q.l("5","1")', q.l;
abort$[ abs(z.l-17.269) > tol ] 'bad z.l', z.l;
abort$[ abs(defdemandz.m-19.571) > tol ] 'bad defdemandz.m', defdemandz.m;
isoobj.l = 0;
agentobj.l(j) = 0;
q0.l = 0;
q.l(j,k) = 0;
z.l = 0;
defisoobj.m = 0;
defagentobj.m(j) = 0;
defdemandz.m = 0;
defz.m = 0;
$onEchoV > implSwitchingVI_gms
***********************************************
* written by GAMS/JAMS at 11/12/17 21:13:41
* for more information use JAMS option "Dict"
***********************************************
Variables x7,x8,x9,x10,x11,x12,x13,u7,u8_5,u8_6,u8_7,u8_8,u8_9;
Positive Variables x8,x9,x10,x11,x12,x13;
Equations e7,e8,dL_dx7_5,dL_dx8,dL_dx9,dL_dx10,dL_dx11,dL_dx12,dL_dx13
,dL_dx7_6,dL_dx7_7,dL_dx7_8,dL_dx7_9;
e7.. x7 + x8 =E= 17.269913736;
e8.. x7 - x9 - x10 - x11 - x12 - x13 =E= 0;
dL_dx7_5.. (-0.357641894777802*x7*x9)/(-1) - u7 - u8_5 =E= 0;
dL_dx8.. 120 - u7 + eps*x8 =N= 0;
dL_dx9.. (-(59.94352881 + 0.5*(0.4896211468*x9 + 0.4896211468*x9) - (120 -
0.178820947388901*sqr(x7))))/(-1) + u8_5 =N= 0;
dL_dx10.. (-(47.36200134 + 0.5*(0.5399322016*x10 + 0.5399322016*x10) - (120 -
0.178820947388901*sqr(x7))))/(-1) + u8_6 =N= 0;
dL_dx11.. (-(59.73399117 + 0.5*(0.7425081388*x11 + 0.7425081388*x11) - (120 -
0.178820947388901*sqr(x7))))/(-1) + u8_7 =N= 0;
dL_dx12.. (-(52.86751401 + 0.5*(0.4268454892*x12 + 0.4268454892*x12) - (120 -
0.178820947388901*sqr(x7))))/(-1) + u8_8 =N= 0;
dL_dx13.. (-(33.92077449 + 0.5*(0.6000842676*x13 + 0.6000842676*x13) - (120 -
0.178820947388901*sqr(x7))))/(-1) + u8_9 =N= 0;
dL_dx7_6.. (-0.357641894777802*x7*x10)/(-1) - u7 - u8_6 =E= 0;
dL_dx7_7.. (-0.357641894777802*x7*x11)/(-1) - u7 - u8_7 =E= 0;
dL_dx7_8.. (-0.357641894777802*x7*x12)/(-1) - u7 - u8_8 =E= 0;
dL_dx7_9.. (-0.357641894777802*x7*x13)/(-1) - u7 - u8_9 =E= 0;
* set non-default bounds
x8.up = 5;
x9.up = 1.71747132;
x10.up = 8.43266708;
x11.up = 5.50375356;
x12.up = 3.01137904;
x13.up = 2.92212117;
Model m / e7.u7,e8.x7,dL_dx7_5.u8_5,dL_dx8.x8,dL_dx9.x9,dL_dx10.x10
,dL_dx11.x11,dL_dx12.x12,dL_dx13.x13,dL_dx7_6.u8_6,dL_dx7_7.u8_7
,dL_dx7_8.u8_8,dL_dx7_9.u8_9 /;
File implvarfile / '%gams.scrdir%implvar.dat' /;
Put implvarfile;
$onPutV
x7
u8_5
u8_6
u8_7
u8_8
u8_9
$offPut
m.limrow=0; m.limcol=0;
Solve m using MCP;
$offEcho
execute 'grep -v " written by GAMS" implSwitchingVI_gms > implSwitchingVI.gms.want'
execute 'grep -v " written by GAMS" implSwitchingVI.gms > implSwitchingVI.gms.got'
execute '=diff -I reslim -bw implSwitchingVI.gms.want implSwitchingVI.gms.got'
abort$errorlevel 'Files implSwitchingVI.gms.want and implSwitchingVI.gms.got differ';
$onEcho > implSwitchingVI_dict
* written by GAMS/JAMS at 11/12/17 21:14:58
********************************************************************************
Contents
1 Content of EMP Information File
2 Processed EMP Information
3 Dictionary
3.1 Constraints
3.2 Variables
********************************************************************************
1 Content of EMP Information File
---------------------------------
1:equilibrium
2:implicit z defz
3:visol defdemandz
4:min isoobj q0
5:defisoobj defdemandz
6:min agentobj('1')
7:q('1','1')
8:z
9:defagentobj('1') defdemandz
10:min agentobj('2')
11:q('2','1')
12:z
13:defagentobj('2') defdemandz
14:min agentobj('3')
15:q('3','1')
16:z
17:defagentobj('3') defdemandz
18:min agentobj('4')
19:q('4','1')
20:z
21:defagentobj('4') defdemandz
22:min agentobj('5')
23:q('5','1')
24:z
25:defagentobj('5') defdemandz
2 Processed EMP Information
---------------------------
3 Dictionary
------------
3.1 Constraints
---------------
{reformulated} defisoobj
{reformulated} defagentobj(1)
{reformulated} defagentobj(2)
{reformulated} defagentobj(3)
{reformulated} defagentobj(4)
{reformulated} defagentobj(5)
e7 defdemandz
e8 defz
dL_dx7_5 {new}
dL_dx8 {new}
dL_dx9 {new}
dL_dx10 {new}
dL_dx11 {new}
dL_dx12 {new}
dL_dx13 {new}
dL_dx7_6 {new}
dL_dx7_7 {new}
dL_dx7_8 {new}
dL_dx7_9 {new}
3.2 Variables
--------------
{reformulated} isoobj
{reformulated} agentobj(1)
{reformulated} agentobj(2)
{reformulated} agentobj(3)
{reformulated} agentobj(4)
{reformulated} agentobj(5)
x7 z
x8 q0
x9 q(1,1)
x10 q(2,1)
x11 q(3,1)
x12 q(4,1)
x13 q(5,1)
u7 {new}
u8_5 {new}
u8_6 {new}
u8_7 {new}
u8_8 {new}
u8_9 {new}
$offEcho
execute 'grep -v " written by GAMS" implSwitchingVI_dict > implSwitchingVIDict.txt.want'
execute 'grep -v " written by GAMS" implSwitchingVIDict.txt > implSwitchingVIDict.txt.got'
execute '=diff -bw implSwitchingVIDict.txt.want implSwitchingVIDict.txt.got'
abort$errorlevel 'Files implSwitchingVIDict.txt.want and implSwitchingVIDict.txt.got differ';