selkie15.gms : SELKIE test suite: proximal perturbation

Description

Test various proximal perturbation. We solve the following two agent problem:

 min_u1   0.5*u1^2 - u1*u2 - 4*u1
 s.t.     u1 + u2 = 1

 min_u2   0.5*u2^2 - u1*u2 - 3*u1

Contributor: Youngdae Kim (09.28.2017)


Small Model of Type : GAMS


Category : GAMS Test library


Main file : selkie15.gms

$title 'SELKIE test suite: proximal perturbation'  (SELKIE15,SEQ=771)

$ontext

Test various proximal perturbation. We solve the following two agent problem:

 min_u1   0.5*u1^2 - u1*u2 - 4*u1
 s.t.     u1 + u2 = 1

 min_u2   0.5*u2^2 - u1*u2 - 3*u1

Contributor: Youngdae Kim (09.28.2017)

$offtext

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

set i / 1*2 /;
alias(i,j);

variable obj(i), u(i);
equation defobj(i), cons;

parameter p(i) / 1 4, 2 3 /;

defobj(i)..
    obj(i) =E= 0.5*sqr(u(i)) - prod(j, u(j)) - p(i)*u('1');

cons..
    sum(i, u(i)) =E= 1;

model m / defobj, cons /;

put info 'equilibrium';
loop(i,
    put / 'min', obj(i), u(i), defobj(i);
    if (ord(i) eq 1,
        put cons;
    );
);
putclose;

* Solve with fixed primal proximal perturbation.
putclose opt 'proximal_use {{1,2}:fixedprimal(0.1)}';
m.optfile = 1;

option emp = selkie;
solve m using emp;

abort$[ smax{i, abs(u.l(i) - 0.5)} > tol ] 'bad u.l', u.l;

$onecho > agent1_p_gms

Variables  x1,x3,x4,x5,x3_l;

Equations  e1,e3;

e1.. -(0.5*sqr(x3) - x3*x4 - 4*x3) + x1 - x5*(sqr(x3 - x3_l)) =E= 0;

e3..    x3 + x4 =E= 1;


* set non-default levels and fix prox terms
x3_l.fx = 0;
x5.fx = 0.1;

* fix levels belonging to other agents
x4.fx = 0;

Model m / e1,e3 /;

Solve m using nlp minimizing x1;

$offecho

execute 'cat agent1_p_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_p_gms

Variables  x2,x3,x4,x5,x4_l;

Equations  e2;

e2.. -(0.5*sqr(x4) - x3*x4 - 3*x3) + x2 - x5*(sqr(x4 - x4_l)) =E= 0;


* set non-default levels and fix prox terms
x4_l.fx = 0;
x5.fx = 0.1;

* fix levels belonging to other agents
x3.fx = 0;

Model m / e2 /;

Solve m using nlp minimizing x2;

$offecho

execute 'cat agent2_p_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';

obj.l(i) = 0;
defobj.m(i) = 0;
u.l(i) = 0; u.m(i) = 0;
cons.m = 0;

* Solve with fixed dual proximal perturbation.
putclose opt 'proximal_use {{1,2}:fixeddual(0.1)}';
m.optfile = 1;

option emp = selkie;
solve m using emp;

abort$[ smax{i, abs(u.l(i) - 0.5)} > tol ] 'bad u.l', u.l;

$onecho > agent1_d_gms

Variables  x3,x4,u3,u4,u3_l;

Equations  e3,dL_dx3;

e3..    x3 + x4 + u4*(u3 - u3_l) =E= 1;

dL_dx3.. (-(-4 + x3 - x4))/(-1) - u3 =E= 0;


* set non-default levels and fix prox terms
u3_l.fx = 0;
u4.fx = 0.1;

* fix levels belonging to other agents
x4.fx = 0;

Model m / e3.u3,dL_dx3.x3 /;

Solve m using mcp;

$offecho

execute 'cat agent1_d_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_d_gms

Variables  x2,x3,x4;

Equations  e2;

e2.. -(0.5*sqr(x4) - x3*x4 - 3*x3) + x2 =E= 0;



* fix levels belonging to other agents
x3.fx = 0;

Model m / e2 /;

Solve m using nlp minimizing x2;

$offecho

execute 'cat agent2_d_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';

obj.l(i) = 0;
defobj.m(i) = 0;
u.l(i) = 0; u.m(i) = 0;
cons.m = 0;

* Solve with fixed primal-dual proximal perturbation.
putclose opt 'proximal_use {{1,2}:fixedprimaldual(0.1,0.1)}';
m.optfile = 1;

option emp = selkie;
solve m using emp;

abort$[ smax{i, abs(u.l(i) - 0.5)} > tol ] 'bad u.l', u.l;

$onecho > agent1_pd_gms

Variables  x3,x4,u3,x5,x3_l,u4,u3_l;

Equations  e3,dL_dx3;

e3..    x3 + x4 + u4*(u3 - u3_l) =E= 1;

dL_dx3.. (-(-4 + x3 - x4))/(-1) - u3 + x5*(x3 - x3_l) =E= 0;


* set non-default levels and fix prox terms
x3_l.fx = 0;
u3_l.fx = 0;
x5.fx = 0.1;
u4.fx = 0.1;

* fix levels belonging to other agents
x4.fx = 0;

Model m / e3.u3,dL_dx3.x3 /;

Solve m using mcp;

$offecho

execute 'cat agent1_pd_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_pd_gms

Variables  x2,x3,x4,x5,x4_l;

Equations  e2;

e2.. -(0.5*sqr(x4) - x3*x4 - 3*x3) + x2 - x5*(sqr(x4 - x4_l)) =E= 0;


* set non-default levels and fix prox terms
x4_l.fx = 0;
x5.fx = 0.1;

* fix levels belonging to other agents
x3.fx = 0;

Model m / e2 /;

Solve m using nlp minimizing x2;

$offecho

execute 'cat agent2_pd_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';