emp13.gms : Test of EMP equilibrium models and fixed vars

Description

Problem with JAMS: tests EMP equilibrium model case where some agents
have all variables fixed and some constraints involve only fixed
vars.

Contributor: Steve Dirkse, February 2013


Small Model of Type : GAMS


Category : GAMS Test library


Main file : emp13.gms

$title Test of EMP equilibrium models and fixed vars (EMP13,SEQ=599)

$onText

Problem with JAMS: tests EMP equilibrium model case where some agents
have all variables fixed and some constraints involve only fixed
vars.

Contributor: Steve Dirkse, February 2013
$offText

set
  i / i1 * i4 /
  ;
parameter c(i);
c(i) = 1+ord(I)/10;

equations objDef, ss(i);
variables x(i), z;

objDef..  z =E= sum{i, sqr(x(i)-c(i))};
ss(I)$[ord(I) <= 2]..  x(I) =e= x(I+1);

x.fx('i1') = 2;
x.fx('i2') = 2;

model m / all /;

solve m using nlp min z;
abort$[m.modelstat > 2] 'bad NLP modelstat', m.modelstat;
abort$[x.l('i1') <> 2] 'bad NLP x level for i1', x.l;
abort$[x.l('i2') <> 2] 'bad NLP x level for i2', x.l;
abort$[x.l('i3') <> 2] 'bad NLP x level for i3', x.l;
abort$[abs(x.l('i4')-c('i4')) > 1e-5] 'bad NLP x level for i4', x.l;

file einfo / 'empinfo.txt' /;
putclose einfo
  'equilibrium' /
  '  min z * objDef ss' /
  ;
file jamsopt / 'jams.op5' /;
putclose jamsopt 'EMPInfoFile empinfo.txt'
               / 'fileName mcpTmpScalar.gms'
               / 'dict dict.txt'
               /;
m.optfile = 5;
* m.holdfixed = 1;
solve m using emp;
abort$[m.modelstat > 2] 'bad NLP modelstat', m.modelstat;
abort$[x.l('i1') <> 2] 'bad NLP x level for i1', x.l;
abort$[x.l('i2') <> 2] 'bad NLP x level for i2', x.l;
abort$[x.l('i3') <> 2] 'bad NLP x level for i3', x.l;
abort$[abs(x.l('i4')-c('i4')) > 1e-5] 'bad NLP x level for i4', x.l;

execute 'rm mcpTmpScalar*.* dict.txt empinfo.txt jams.op5';