Description
Test zero function. Contributor: Youngdae Kim (06.26.2017)
Small Model of Type : GAMS
Category : GAMS Test library
Main file : selkie05.gms
$title 'SELKIE test suite' (SELKIE05,SEQ=761)
$ontext
Test zero function.
Contributor: Youngdae Kim (06.26.2017)
$offtext
$if not set TESTTOL $set TESTTOL 1e-4
scalar tol / %TESTTOL% /;
file opt / 'selkie.opt' /;
file info / '%emp.info%' /;
variables y, z;
equations
gCons
F_y
;
gCons.. y =G= sqr(z);
F_y.. sqr(y) + eps*z =N= 0;
model mVI / F_y, gCons /;
put info 'equilibrium' /;
putclose info 'vi z F_y y gCons' /;
option emp = selkie;
solve mVI using emp;
abort$[ abs(y.l) > tol ] 'bad y.l', y.l;
abort$[ abs(z.l) > tol ] 'bad z.l', z.l;
$onecho > agent1_gms
Variables x1,x2,u2;
Positive Variables u2;
Equations e1,e2,zero_x2;
e1.. sqr(x1) + eps*x2 - u2 =N= 0;
e2.. -sqr(x2) + x1 =G= 0;
zero_x2.. - (-2*x2)*u2 =E= 0;
Model m / e1.x1,e2.u2,zero_x2.x2 /;
Solve m using mcp;
$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';
$exit
* Test the model without writing agent's problem into a file.
putclose opt 'write_agent_model no';
mVI.optfile = 1;
y.l = 0;
z.l = 0;
solve mVI using emp;
abort$[ abs(y.l) > tol ] 'bad y.l', y.l;
abort$[ abs(z.l) > tol ] 'bad z.l', z.l;