Description
With GAMS 31 we introduced the capability to limit the domain of variables in the model statement. This test uses a dummy model to verify that this new feature leads to the same result as using explicit dollar conditions or explicit subsets. Also it checks, that the model generation time of the new method is not worse than the one of the existing methods, if doTimeTest is set. Contributor: Lutz Westermann, March 2020
Large Model of Type : GAMS
Category : GAMS Test library
Main file : limdom02.gms
$title Test performance of limited domains for variables in model (limdom02,SEQ=813)
$onText
With GAMS 31 we introduced the capability to limit the domain of variables
in the model statement. This test uses a dummy model to verify that this new
feature leads to the same result as using explicit dollar conditions or explicit
subsets. Also it checks, that the model generation time of the new method is
not worse than the one of the existing methods, if doTimeTest is set.
Contributor: Lutz Westermann, March 2020
$offText
Set i / i1 * i300 /;
Alias (i,j,k);
Set sub(i,j,k);
sub(i,j,k)$(uniform(0,1)<0.1) = yes;
Positive Variable x(i,j,k);
Variable z;
Equation objDLV Dummy objective function used with Domain Limited Variables
objDOL Dummy objective function used explicit DOLlar condition
objSUB Dummy objective function used SUBset;
objDLV.. z =e= sum((i,j,k), x(i,j,k));
objDOL.. z =e= sum((i,j,k), x(i,j,k)$sub(i,j,k));
objSUB.. z =e= sum(sub, x(sub));
Model mDLV / objDLV, x(sub) /;
Model mDOL / objDOL /;
Model mSUB / objSUB /;
$echo gams=gams.gms > convert.opt
mDLV.optfile = 1;
mDOL.optfile = 1;
mSUB.optfile = 1;
Scalar genTimeDLV
genTimeDOL
genTimeSUB;
option limrow = 0,
limcol = 0,
solprint = off,
lp = convert;
solve mDLV min z use lp;
genTimeDLV = mDLV.resGen;
execute.CheckErrorLevel 'grep -v "LP written by GAMS" gams.gms > mDLV.gms';
solve mDOL min z use lp;
genTimeDOL = mDOL.resGen;
execute.CheckErrorLevel 'grep -v "LP written by GAMS" gams.gms > mDOL.gms';
solve mSUB min z use lp;
genTimeSUB = mSUB.resGen;
execute.CheckErrorLevel 'grep -v "LP written by GAMS" gams.gms > mSUB.gms';
execute.CheckErrorLevel '=diff -b mDLV.gms mDOL.gms';
execute.CheckErrorLevel '=diff -b mDLV.gms mSUB.gms';
display genTimeDLV, genTimeDOL, genTimeSUB;
$if set doTimeTest abort$(genTimeDLV > genTimeDOL*1.1) 'DLV generation time too high';