empvi01.gms : Simple test for variational inequalities through EMP

Description

This model checks the correctness of the models generated by EMP for two simple
variational inequalities models.

Contributor: Jan-H. Jagla, January 2009


Small Model of Type : GAMS


Category : GAMS Test library


Main file : empvi01.gms

$title Simple test for variational inequalities through EMP (EMPVI01,SEQ=423)

$onText

This model checks the correctness of the models generated by EMP for two simple
variational inequalities models.

Contributor: Jan-H. Jagla, January 2009

$offText

$eolCom //

Equations defvi, e1, e0;
Variable x,z,y;

y.lo=1;

e0..      y =n= 0;
e1..      x =e= z + 3;
defvi.. 2*x =e= z;

model test /all/;

$onEcho > "%gams.scrdir%reset.%gams.scrext%"
x.l=0; x.m=0;
y.l=1; y.m=0;
z.l=0; z.m=0;
e0.l=0; e0.m=0;
e1.l=0; e1.m=0;
defvi.l=0; defvi.m=0;
$offEcho

$include "%gams.scrdir%reset.%gams.scrext%"
$call echo FileName vitest1.gms > jams.opt
execute 'echo vi e0 y > "%emp.info%"';
test.optfile=1;
solve test using emp;

*Diff generated files with reference files
execute 'sed "2d" vitest1.gms > vitest1.txt';
execute 'sed "2d" vitest1ref.gms > vitest1ref.txt';
execute '=diff -I reslim -bw vitest1.txt vitest1ref.txt';
abort$errorlevel 'vitest1 and vitest1ref differ';

$include "%gams.scrdir%reset.%gams.scrext%"
$call echo FileName vitest2.gms > jams.op2
execute 'echo vi e0 y defvi x > "%emp.info%"';
test.optfile=2;
solve test using emp;

*Diff generated files with reference files
execute 'sed "2d" vitest2.gms > vitest2.txt';
execute 'sed "2d" vitest2ref.gms > vitest2ref.txt';
execute '=diff -I reslim -bw vitest2.txt vitest2ref.txt';
abort$errorlevel 'vitest2 and vitest2ref differ';

execute 'rm -f vitest1* vitest2*'
execute 'rm -f jams.opt jams.op2'

* Reference files
$onEcho > vitest1ref.gms
***********************************************
* written by GAMS/EMP at 09/02/09 04:52:46
* for more information use JAMS option "Dict"
***********************************************

Variables  x1,x2,x3,u1,u2;

Equations  e1,e2,e3,zero_x1,zero_x2;


e1..    2*x1 - x2 =E= 0;

e2..    x1 - x2 =E= 3;

e3..    x3 =N= 0;

zero_x1..  - 2*u1 - u2 =E= 0;

zero_x2.. u1 + u2 =E= 0;

* set non-default bounds
x3.lo = 1;

* set non-default levels
x3.l = 1;

Model m / e1.u1,e2.u2,e3.x3,zero_x1.x1,zero_x2.x2 /;

m.limrow=0; m.limcol=0;

Solve m using MCP;
$offEcho

$onEcho > vitest2ref.gms
***********************************************
* written by GAMS/EMP at 09/02/09 04:52:46
* for more information use JAMS option "Dict"
***********************************************

Variables  x1,x2,x3,u2;

Equations  e1,e2,e3,zero_x2;


e1..    2*x1 - x2 - u2 =E= 0;

e2..    x1 - x2 =E= 3;

e3..    x3 =N= 0;

zero_x2.. u2 =E= 0;

* set non-default bounds
x3.lo = 1;

* set non-default levels
x3.l = 1;

Model m / e1.x1,e2.u2,e3.x3,zero_x2.x2 /;

m.limrow=0; m.limcol=0;

Solve m using MCP;
$offEcho