scensol4.gms : Basic GUSS Test

Description

```Contributor: Michael Bussieck, February 2014
```

Small Model of Type : GAMS

Category : GAMS Test library

Main file : scensol4.gms

``````\$Title 'Basic GUSS Test' (SCENSOL4,SEQ=642)

\$Ontext
Contributor: Michael Bussieck, February 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.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),  f * d(i,j) / 1000 *x(i,j)) ;

supply(i) ..   sum(j, x(i,j))  =l=  a(i) ;

demand(j) ..   sum(i, x(i,j))  =g=  b(j) ;

Equation e dummy n row;  e.. sum((i,j), x(i,j)) =n= 3;

Model transport /all/ ;

* The DICT set has three dimensions
* 1 Model symbol
* 2 Action type
* 3 Update parameter
* DICT needs to be specified by a data statement

set dict   / s.scenario   . ''
o.   opt     .srep
d.   param   .ds
a.   param   .as
x.   upper   .xup
f.   param   .fs
cost.marginal.xcost
x.   level   .xx /

* Problems:
*   1 QCP will not work, nor MCP, MPECS.

set s /s1*s10/;

Parameter
ds(s,i,j)  updater for d
as(s,i)    updater for a
xup(s,i,j) updater for x.up
fs(s)      updater for f
xcost(s)   collector for marginal of cost
xx(s,i,j)  collector for level of x

\$eolcom //
Set ma GUSS Model Attributes / system.GUSSModelAttributes /;
Parameter
o(*)         GUSS options
/ OptfileInit  0   // Read solver options for initial solve
Optfile      0   // Read solver options for successive solves
LogOption    0   // 0 - Moderate log (default)
// 1 - Minimal log
// 2 - Detailed log
SkipBaseCase 1   // Switch for solving the base case
UpdateType   0   // Scenario update mechanism:
// 0 - set everything to 0 and apply changes
// 1 - reestablish base case and apply changes
// 2 - build on top of last scenario and apply changes
/
srep(s,ma)  Solution attributes / #s.(ModelStat na) /;

ds(s,i,j)  = max(0,uniform(-5,2)) + eps;
as(s,i)    = a(i)*(1+normal(0.05,0.1));
xup(s,i,j) = uniform(120,300);
fs(s)      = uniform(80,100);

* Run GUSS
Solve transport using lp minimizing z scenario dict;

display srep;
``````
GAMS Development Corp.
GAMS Software GmbH

General Information and Sales
U.S. (+1) 202 342-0180
Europe: (+49) 221 949-9170