emp17.gms : Simple test of one optimizing agent

Description

Arbitrary objective coefficients c were not handled correctly prior to 24.8.
Reported in Trac #3002.

Contributors: Youngdae Kim & Steve Dirkse, June 2016


Small Model of Type : GAMS


Category : GAMS Test library


Main file : emp17.gms

$TITLE Simple test of one optimizing agent (EMP17,SEQ=693)

$ontext
Arbitrary objective coefficients c were not handled correctly prior to 24.8.
Reported in Trac #3002.

Contributors: Youngdae Kim & Steve Dirkse, June 2016
$offtext

scalars
  tol  / 1e-6 /
  c    / 1 /
  ;
variable z;
positive variable v;
equation zdef;

zdef.. c*z =E= sqr(v) - 2*v + 2;

model m / zdef /;

set k / '-8', '-1', 1, 8 /;
parameter cc(k) /
 '-8'  -8
 '-1'  -1
   1    1
   8    8
  /;

file empinfo / '%emp.info%' /;
loop {k,
  c = cc(k);
  put empinfo 'equilibrium' /;
  if {(c > 0),
    put empinfo '  min';
  else
    put empinfo '  max';
  };
  putclose ' z v zdef' /;
  solve m using emp;
  abort$(m.solvestat <> %solvestat.NormalCompletion%) 'wrong solvestat';
  abort$(m.modelstat  > %modelstat.LocallyOptimal%)   'wrong modelstat';

  abort$(abs(c*z.l - 1)     > tol)    'bad z level';
  abort$(abs(z.m - 0)       > tol)    'bad z marginal';
  abort$(abs(v.l - 1)       > tol)    'bad v level';
  abort$(abs(v.m - 0)       > tol)    'bad v marginal';

  abort$(abs(zdef.l - 2)    > tol)    'bad zdef level';
  abort$(abs(c*zdef.m - 1)  > tol)    'bad zdef marginal';
};