mpec04.gms : MPEC model testing free rows

Description

Free rows can come up in a variety of ways.  Since some solvers don't
handle free rows, we need to be sure we catch all the possible cases
where they can arise in the code that squeezes them out.

Contributor: Steve Dirkse, Aug 2013


Small Model of Type : MPEC


Category : GAMS Test library


Main file : mpec04.gms

$TITLE MPEC model testing free rows (MPEC04,SEQ=615)

$ontext
Free rows can come up in a variety of ways.  Since some solvers don't
handle free rows, we need to be sure we catch all the possible cases
where they can arise in the code that squeezes them out.

Contributor: Steve Dirkse, Aug 2013
$offtext

scalars z0, x0 /1/, yN0 /2/, yE0 /2/, yG0 /2/, yL0 /2/;
z0 = sqr(x0-2) + sqr(yN0-1) + sqr(yE0-1) + sqr(yG0-1) + sqr(yL0-1);
variables  x, yN, yE, yG, yL, z;
x.fx = x0;
yN.fx = yN0;
yE.fx = yE0;
yG.fx = yG0;
yL.fx = yL0;
equations
  f  'free row not matched'
  gN 'free row matched to fixed var'
  gE 'equality row matched to fixed var'
  gG '=G= row matched to fixed var'
  gL '=L= row matched to fixed var'
  o;

f  .. exp(x) =N= 0;
gN .. rpower(yN,1.5) =N= 7;
gE .. rpower(yE,0.5) =E= 322;
gG .. rpower(yE,0.6) =G= 20;
gL .. rpower(yE,0.7) =L= 22;
o  .. sqr(x-2) + sqr(yN-1) + sqr(yE-1) + sqr(yG-1) + sqr(yL-1) =e= z;

model m / f, gN.yN, gE.yE, gG.yG, gL.yL, o /;

solve m using mpec min z;
abort$[m.solvestat <> %solvestat.NormalCompletion%] 'bad solvestat',
  m.solvestat;
abort$[abs(z.l-z0) > 1e-5] 'bad z', z.l, z0;

m.holdfixed = 1;
solve m using mpec min z;
abort$[m.solvestat <> %solvestat.NormalCompletion%] 'bad solvestat',
  m.solvestat;
abort$[abs(z.l-z0) > 1e-5] 'bad z', z.l, z0;