Description
Previous to 24.2.3 GUSS only solved scenarios that had some update data. Now GUSS accepts a parameter SolveEmpty that determines the maximum number of solves without update data. In case of an "empty" solver it depends on the update type what scenario we solve. Contributor: Michael Bussieck, March 2014
Small Model of Type : GAMS
Category : GAMS Test library
Main file : scenempty.gms
$title Empty scenario GUSS Test (SCENEMPTY,SEQ=648)
$onText
Previous to 24.2.3 GUSS only solved scenarios that had some update data.
Now GUSS accepts a parameter SolveEmpty that determines the maximum number of
solves without update data. In case of an "empty" solver it depends on the
update type what scenario we solve.
Contributor: Michael Bussieck, March 2014
$offText
Sets
i canning plants / seattle, san-diego /
j markets / new-york, chicago, topeka / ;
Parameters
a(i) capacity of plant i in cases
/ seattle 350
san-diego 600 /
b(j) demand at market j in cases
/ new-york 325
chicago 300
topeka 275 / ;
Table d(i,j) distance in thousands of miles
new-york chicago topeka
seattle 2.5 1.7 1.8
san-diego 2.5 1.8 1.4 ;
Scalar f freight in dollars per case per thousand miles /90/ ;
Parameter c(i,j) transport cost in thousands of dollars per case ;
c(i,j) = f * d(i,j) / 1000 ;
Variables
x(i,j) shipment quantities in cases
z total transportation costs in thousands of dollars ;
Positive Variable x ;
Equations
cost define objective function
supply(i) observe supply limit at plant i
demand(j) satisfy demand at market j ;
cost .. z =e= sum((i,j), c(i,j)*x(i,j)) ;
supply(i) .. sum(j, x(i,j)) =l= a(i) ;
scalar bmod /0.1/;
demand(j) .. sum(i, x(i,j)) =g= (1-bmod)*b(j) ;
Model transport /all/ ;
set ss / s0*s100 /, s(ss) /s4,s6*s9/;
$eval CardS card(s)
parameter
sbmod(ss) / s4 0, s6 0.2, s7 0, s8 -0.01, s9 0 /
srep(ss,*) / #s.modelstat 0, #s.solvestat 0 /
sopt0(*) / UpdateType 0, SolveEmpty %CardS% /
sopt1(*) / UpdateType 1, SolveEmpty %CardS% /
sopt2(*) / UpdateType 2, SolveEmpty %CardS% /
sz(ss);
set dict0 / s .scenario . ''
sopt0 .opt .srep
bmod .param .sbmod
z .level .sz /
set dict1 / s .scenario . ''
sopt1 .opt .srep
bmod .param .sbmod
z .level .sz /
set dict2 / s .scenario . ''
sopt2 .opt .srep
bmod .param .sbmod
z .level .sz /
* UpdateType Zero + Scenario Data
Solve transport using lp minimizing z scenario dict0;
abort$(card(srep)<>card(s)*2) 'wrong srep', srep;
abort$(smin(s,srep(s,'solvestat'))<>1 or
smax(s,srep(s,'solvestat'))<>1) 'wrong solvestat', srep;
abort$(abs(153.675-sz('s4'))>1e-6) 'wrong s4', sz;
abort$(abs(153.675-sz('s7'))>1e-6) 'wrong s7', sz;
abort$(abs(153.675-sz('s9'))>1e-6) 'wrong s9', sz;
* UpdateType BaseCase + Scenario data
Solve transport using lp minimizing z scenario dict1;
abort$(card(srep)<>card(s)*2) 'wrong srep', srep;
abort$(smin(s,srep(s,'solvestat'))<>1 or
smax(s,srep(s,'solvestat'))<>1) 'wrong solvestat', srep;
abort$(abs(138.3075-sz('s4'))>1e-6) 'wrong s4', sz;
abort$(abs(138.3075-sz('s7'))>1e-6) 'wrong s7', sz;
abort$(abs(138.3075-sz('s9'))>1e-6) 'wrong s9', sz;
* UpdateType Previous Scenario + Scenario data
Solve transport using lp minimizing z scenario dict2;
abort$(card(srep)<>card(s)*2) 'wrong srep', srep;
abort$(smin(s,srep(s,'solvestat'))<>1 or
smax(s,srep(s,'solvestat'))<>1) 'wrong solvestat', srep;
abort$(abs(138.3075 -sz('s4'))>1e-6) 'wrong s4', sz;
abort$(abs(122.94 -sz('s7'))>1e-6) 'wrong s7', sz;
abort$(abs(155.21175-sz('s9'))>1e-6) 'wrong s9', sz;