selkie19.gms : SELKIE test suite: equation marginal values

Description

```Test if we set the marginal values of equations when we group agents.

Contributor: Youngdae Kim (02.06.2018)
```

Small Model of Type : GAMS

Category : GAMS Test library

Main file : selkie19.gms

``````\$title 'SELKIE test suite: equation marginal values'  (SELKIE19,SEQ=775)

\$ontext

Test if we set the marginal values of equations when we group agents.

Contributor: Youngdae Kim (02.06.2018)

\$offtext

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

set i / 1*2 /;

variable obj(i);
equation cons(i);

cons(i)..
sqr(obj(i)-2) =l= 1;

model m / cons /;

put info 'equilibrium';
loop(i,
put / 'min', obj(i), cons(i);
);
putclose;

* Test if we generate a correct MCP model when we group them.

cons.m(i) = -0.1;

option emp = selkie;
putclose opt 'agent_group {{1,2}}';
m.optfile = 1;

solve m using emp;
abort\$[ smax{i, abs(obj.l(i)  -   1)} > tol    ] 'bad obj.l(i)', obj.l;
abort\$[ smax{i, abs(cons.l(i) -   1)} > tol ] 'bad cons.l(i)', cons.l;
abort\$[ smax{i, abs(cons.m(i) + 0.5)} > tol ] 'bad cons.m(i)', cons.m;

\$onecho > agent3_gms

Variables  x1,x2,u1,u2;

Negative Variables  u1,u2;

Equations  e1,e2,dL_dx1,dL_dx2;

e1.. sqr((-2) + x1) =L= 1;

e2.. sqr((-2) + x2) =L= 1;

dL_dx1.. 1 - (2*(-2 + x1))*u1 =E= 0;

dL_dx2.. 1 - (2*(-2 + x2))*u2 =E= 0;

* set non-default levels and fix prox terms
u1.l = -0.1;
u2.l = -0.1;

Model m / e1.u1,e2.u2,dL_dx1.x1,dL_dx2.x2 /;

Solve m using mcp;

\$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';
``````
GAMS Development Corp.
GAMS Software GmbH

General Information and Sales
U.S. (+1) 202 342-0180
Europe: (+49) 221 949-9170