selkie10.gms : SELKIE test suite

Description

Test implicit feature of SELKIE of test6.gms.

Contributor: Youngdae Kim (08.12.2017)


Small Model of Type : GAMS


Category : GAMS Test library


Main file : selkie10.gms

$title 'SELKIE test suite'  (SELKIE10,SEQ=766)

$ontext

Test implicit feature of SELKIE of test6.gms.

Contributor: Youngdae Kim (08.12.2017)

$offtext

$if not set TESTTOL $set TESTTOL 1e-4
scalar tol / %TESTTOL% /;
file opt   / 'selkie.opt' /;
file info  / '%emp.info%' /;

sets i / 1*3 /;

variables obj, x(i);
equation defobj;

defobj..
    obj =e= -x('1')*x('2') - x('2')*x('3') - x('1')*x('3')
    + sqr(max(0,x('1')-1)) + sqr(max(0,-x('1')-1))
    + sqr(max(0,x('2')-1)) + sqr(max(0,-x('2')-1))
    + sqr(max(0,x('3')-1)) + sqr(max(0,-x('3')-1));

model m / defobj /;

file empinfo / '%emp.info%' /;
put empinfo 'equilibrium' /;
put 'implicit obj defobj' /;
loop(i,
    put 'min', 'dnlp', obj, x(i) /;
);
putclose;

x.lo(i) = -10;
x.up(i) = 10;

scalar epsilon / 1 /;

x.l('1') = -1 - epsilon;
x.l('2') =  1 + 0.5*epsilon;
x.l('3') = -1 - 0.25*epsilon;

option emp = selkie;

solve m using emp;
abort$[ smax{i, abs(abs(x.l(i)) - 10)} > tol ] 'bad x.l(i)', x.l;

$onecho > agent1_gms

Variables  x1,x2,x3,x4;

Equations  e1;

e1.. -(-x2*x3 - x3*x4 - x2*x4 + sqr(max(eps,(-1) + x2)) + sqr(max(eps,(-1) - x2
     )) + sqr(max(eps,(-1) + x3)) + sqr(max(eps,(-1) - x3)) + sqr(max(eps,(-1)
      + x4)) + sqr(max(eps,(-1) - x4))) + x1 =E= 0;

* set non-default bounds
x2.lo = -10; x2.up = 10;

* set non-default levels and fix prox terms
x2.l = -2;

* fix levels belonging to other agents
x3.fx = 1.5;
x4.fx = -1.25;

Model m / e1 /;

Solve m using dnlp minimizing x1;

$offecho

execute 'cat agent1_gms > agent1.gms.want';
execute 'cat "%gams.scrdir%agent1.gms" > agent1.gms.got';
execute '=diff -bw agent1.gms.want agent1.gms.got';
abort$errorlevel 'Files agent1.gms.want and agent1.gms.got differ';

$onecho > agent2_gms

Variables  x1,x2,x3,x4;

Equations  e1;

e1.. -(-x2*x3 - x3*x4 - x2*x4 + sqr(max(eps,(-1) + x2)) + sqr(max(eps,(-1) - x2
     )) + sqr(max(eps,(-1) + x3)) + sqr(max(eps,(-1) - x3)) + sqr(max(eps,(-1)
      + x4)) + sqr(max(eps,(-1) - x4))) + x1 =E= 0;

* set non-default bounds
x3.lo = -10; x3.up = 10;

* set non-default levels and fix prox terms
x3.l = 1.5;

* fix levels belonging to other agents
x2.fx = -2;
x4.fx = -1.25;

Model m / e1 /;

Solve m using dnlp minimizing x1;

$offecho

execute 'cat agent2_gms > agent2.gms.want';
execute 'cat "%gams.scrdir%agent2.gms" > agent2.gms.got';
execute '=diff -bw agent2.gms.want agent2.gms.got';
abort$errorlevel 'Files agent2.gms.want and agent2.gms.got differ';

$onecho > agent3_gms

Variables  x1,x2,x3,x4;

Equations  e1;

e1.. -(-x2*x3 - x3*x4 - x2*x4 + sqr(max(eps,(-1) + x2)) + sqr(max(eps,(-1) - x2
     )) + sqr(max(eps,(-1) + x3)) + sqr(max(eps,(-1) - x3)) + sqr(max(eps,(-1)
      + x4)) + sqr(max(eps,(-1) - x4))) + x1 =E= 0;

* set non-default bounds
x4.lo = -10; x4.up = 10;

* set non-default levels and fix prox terms
x4.l = -1.25;

* fix levels belonging to other agents
x2.fx = -2;
x3.fx = 1.5;

Model m / e1 /;

Solve m using dnlp minimizing x1;

$offecho

execute 'cat agent3_gms > agent3.gms.want';
execute 'cat "%gams.scrdir%agent3.gms" > agent3.gms.got';
execute '=diff -bw agent3.gms.want agent3.gms.got';
abort$errorlevel 'Files agent3.gms.want and agent3.gms.got differ';

* Solve it again with proximal term.

defobj.l = 0;
defobj.m = 0;
obj.l = 0;
x.m(i) = 0;

x.l('1') = -1 - epsilon;
x.l('2') =  1 + 0.5*epsilon;
x.l('3') = -1 - 0.25*epsilon;

putclose opt
   'proximal_use                 {{1..3}}'  /
   'proximal_perturbation_primal 0.5';
m.optfile = 1;

solve m using emp;
abort$[ m.modelstat > 2 ] 'model does not solve', m.modelstat;
abort$[ smax{i, abs(abs(x.l(i)) - 10)} > tol ] 'bad x.l(i)', x.l;

$onecho > agent1prox_gms

Variables  x1,x2,x3,x4,x5,x2_l;

Equations  e1;

e1.. -(-x2*x3 - x3*x4 - x2*x4 + sqr(max(eps,(-1) + x2)) + sqr(max(eps,(-1) - x2
     )) + sqr(max(eps,(-1) + x3)) + sqr(max(eps,(-1) - x3)) + sqr(max(eps,(-1)
      + x4)) + sqr(max(eps,(-1) - x4))) + x1 - x5*(sqr(x2 - x2_l)) =E= 0;

* set non-default bounds
x2.lo = -10; x2.up = 10;

* set non-default levels and fix prox terms
x2.l = -2;
x2_l.fx = -2;
x5.fx = 0.5;

* fix levels belonging to other agents
x3.fx = 1.5;
x4.fx = -1.25;

Model m / e1 /;

Solve m using dnlp minimizing x1;

$offecho

execute 'cat agent1prox_gms > agent1prox.gms.want';
execute 'cat "%gams.scrdir%agent1.gms" > agent1prox.gms.got';
execute '=diff -bw agent1prox.gms.want agent1prox.gms.got';
abort$errorlevel 'Files agent1prox.gms.want and agent1prox.gms.got differ';

$onecho > agent2prox_gms

Variables  x1,x2,x3,x4,x5,x3_l;

Equations  e1;

e1.. -(-x2*x3 - x3*x4 - x2*x4 + sqr(max(eps,(-1) + x2)) + sqr(max(eps,(-1) - x2
     )) + sqr(max(eps,(-1) + x3)) + sqr(max(eps,(-1) - x3)) + sqr(max(eps,(-1)
      + x4)) + sqr(max(eps,(-1) - x4))) + x1 - x5*(sqr(x3 - x3_l)) =E= 0;

* set non-default bounds
x3.lo = -10; x3.up = 10;

* set non-default levels and fix prox terms
x3.l = 1.5;
x3_l.fx = 1.5;
x5.fx = 0.5;

* fix levels belonging to other agents
x2.fx = -2;
x4.fx = -1.25;

Model m / e1 /;

Solve m using dnlp minimizing x1;

$offecho

execute 'cat agent2prox_gms > agent2prox.gms.want';
execute 'cat "%gams.scrdir%agent2.gms" > agent2prox.gms.got';
execute '=diff -bw agent2prox.gms.want agent2prox.gms.got';
abort$errorlevel 'Files agent2prox.gms.want and agent2prox.gms.got differ';

$onecho > agent3prox_gms

Variables  x1,x2,x3,x4,x5,x4_l;

Equations  e1;

e1.. -(-x2*x3 - x3*x4 - x2*x4 + sqr(max(eps,(-1) + x2)) + sqr(max(eps,(-1) - x2
     )) + sqr(max(eps,(-1) + x3)) + sqr(max(eps,(-1) - x3)) + sqr(max(eps,(-1)
      + x4)) + sqr(max(eps,(-1) - x4))) + x1 - x5*(sqr(x4 - x4_l)) =E= 0;

* set non-default bounds
x4.lo = -10; x4.up = 10;

* set non-default levels and fix prox terms
x4.l = -1.25;
x4_l.fx = -1.25;
x5.fx = 0.5;

* fix levels belonging to other agents
x2.fx = -2;
x3.fx = 1.5;

Model m / e1 /;

Solve m using dnlp minimizing x1;

$offecho

execute 'cat agent3prox_gms > agent3prox.gms.want';
execute 'cat "%gams.scrdir%agent3.gms" > agent3prox.gms.got';
execute '=diff -bw agent3prox.gms.want agent3prox.gms.got';
abort$errorlevel 'Files agent3prox.gms.want and agent3prox.gms.got differ';