qcp05.gms : Test case for poly function

Description

Compare modlib's qdemo7 with a version making use of the poly function

Contributor: Jan-Hendrik Jagla, June 2008


Small Model of Type : QCP


Category : GAMS Test library


Main file : qcp05.gms

$title 'Test case for poly function'  (QCP05,SEQ=390)

$onText
Compare modlib's qdemo7 with a version making use of the poly function

Contributor: Jan-Hendrik Jagla, June 2008
$offText

$if not set TESTTOL $set TESTTOL 1e-4

$call gamslib -q qdemo7
$call cat qdemo7.gms | grep -viw solve > qdemo7x.gms
$onEcho >> qdemo7.gms
Equation  objnpoly          objective function;

objnpoly.l = objn.l;
objnpoly.m = objn.m;
objnpoly.lo= objn.lo;
objnpoly.up= objn.up;
$offEcho

$call gams qdemo7 lo=%gams.lo% gdx=demo7n qcp=%SYSTEM.QCP% iterlim=%gams.iterlim%

$include qdemo7x.gms

Equation   objn
           objnpoly          objective function;

objnpoly.. cps =e= sum(cn, poly(natcon(cn),0,alpha(cn),.5*beta(cn)))
             + sum(ce, exports(ce)*pe(ce))
             - sum(cm, imports(cm)*pm(cm))
             - tcost;

Model demo7npoly QCP version/ landbal, laborbal, plow, ares,
                              alab, acost, dem, proc,
                              amisc, aplow, lclover, lstraw, objnpoly /;

Solve demo7npoly maximizing cps using QCP;
* Skip check if Solver cannot handle poly function
if ((demo7npoly.solvestat = %solveStat.capabilityProblems%),
  abort$(demo7npoly.modelstat <> %modelStat.noSolutionReturned%) 'bad modelstat';
else
  objn.l = objnpoly.l;
  objn.m = objnpoly.m;
  objn.lo= objnpoly.lo;
  objn.up= objnpoly.up;
  execute_unload 'demo7npoly.gdx';

  execute 'gdxdiff demo7n.gdx demo7npoly.gdx Eps=%TESTTOL% RelEps=%TESTTOL% > %system.nullfile%';
  abort$(errorlevel <> 0) 'GDXDIFF no difference expected';
);