gamschk2.gms : GAMSCHK test suite - use of scale factors

Description


Small Model of Type : GAMS


Category : GAMS Test library


Main file : gamschk2.gms

$title 'GAMSCHK test suite - use of scale factors' (GAMSCHK2,SEQ=959)

$onCheckErrorLevel

$onEchoV > solo.gms
sets      items            names of variables   /x1*x4/
          resources        names of constraints /r1*r4/

parameter objcoef(items)   objective function coeficients
                    /x1 1, x2 -500, x3 -400, x4 -5000/
          rhs(resources)   resource availabilities
                    /r3 6000,r4 300/;

Table amatrix(resources,items) aij matrix
       x1      x2     x3     x4
  r1    1    -10000  -8000
  r2            5     4     -50
  r3          1500   2000
  r4            50     45          ;

variables          z;
positive variables xvar(items);
equations          objfun
                   avail(resources);

objfun..   z =e= sum(items,objcoef(items)*xvar(items));
avail(resources).. sum(items,amatrix(resources,items)*xvar(items))
                           =l= rhs(resources);
option limrow=4;
option limcol=4;
model scalemod /all/;

option lp=gamschk;

$ifthen set SETSCALES
  display "Setting scales to non-default values";
  objfun.scale=10000;
  z.scale=objfun.scale;
  avail.scale("r1")=10000;
  xvar.scale("x1")= avail.scale("r1");
  avail.scale("r3")=1000;
  avail.scale("r4")=50;
$else
  display "All scales left at default values";
$endif

scalemod.scaleopt=0;
solve scalemod using lp maximizing z;
$offEcho

$onEchoV > solo.gck
displaycr
Equation
avail*
postopt
Equation
avail*
$offEcho

* ------------------------------------------------------------------

$call =gams solo.gms lo=0 pw=80                o=gamschk2_noscales.lst
$call =gams solo.gms lo=0 pw=80 --SETSCALES=1  o=gamschk2_setscales.lst

$call cd . && "%gams.sysdir%GMSPython%system.dirsep%python" ./lstGrabber.py gamschk2_noscales.lst  "### Executing DISPLAYCR"  86 noscales.txt  > %system.nullFile%
$call cd . && "%gams.sysdir%GMSPython%system.dirsep%python" ./lstGrabber.py gamschk2_setscales.lst "### Executing DISPLAYCR"  86 setscales.txt  > %system.nullFile%

$offCheckErrorLevel

$call diff noscales.txt setscales.txt > %system.nullFile%
$if errorlevel 1 $abort 'ERROR: unexpected differences found in GAMSCHK output'

$log Test %system.fn% completed successfully