apl1pca.gms : Stochastic Programming Example for DECIS

Description

Stochastic Electric Power Expansion Planning Problem.
This is a two-stage stochastic linear program.
Facing uncertain demand, decisions about generation
capacity need to be made.

Compared to APL1P this model introduces dependent
stochastic parameters.

This model is also used as an example in the
GAMS/DECIS user's guide.


Small Model of Type : DECIS


Category : GAMS Model library


Main file : apl1pca.gms

$title APL1PCA Stochastic Programming Example for GAMS/DECIS (APL1PCA,SEQ=198)

$onText
Stochastic Electric Power Expansion Planning Problem.
This is a two-stage stochastic linear program.
Facing uncertain demand, decisions about generation
capacity need to be made.

Compared to APL1P this model introduces dependent
stochastic parameters.

This model is also used as an example in the
GAMS/DECIS user's guide.


Infanger, G, Planning Under Uncertainty - Solving Large-Scale
Stochastic Linear Programs, 1988.

Keywords: linear programming, stochastic programming, electric power generation
$offText

$if not set decisalg $set decisalg decism

Set
   g  'generators'    / g1, g2    /
   dl 'demand levels' / h , m , l /;

Parameter
   alpha(g) 'availability' / g1  0.68, g2  0.64 /
   ccmin(g) 'min capacity' / g1  1000, g2  1000 /
   ccmax(g) 'max capacity' / g1 10000, g2 10000 /
   c(g)     'investment'   / g1   4.0, g2   2.5 /;

Table f(g,dl) 'operating cost'
          h    m    l
   g1   4.3  2.0  0.5
   g2   8.7  4.0  1.0;

Parameter
   d(dl)  'demand'                  / h 1040, m 1040, l 1040 /
   us(dl) 'cost of unserved demand' / h   10, m   10, l   10 /;

* -----------------------------------------------
* define the core model
* -----------------------------------------------
Free Variable tcost 'total cost';

Positive Variable
   x(g)    'capacity of generators'
   y(g,dl) 'operation level'
   s(dl)   'unserved demand';

Equation
   cost       'total cost'
   cmin(g)    'minimum capacity'
   cmax(g)    'maximum capacity'
   omax(g)    'maximum operating level'
   demand(dl) 'satisfy demand';

cost..       tcost =e= sum(g, c(g)*x(g))
                    +  sum(g, sum(dl, f(g,dl)*y(g,dl)))
                    +  sum(dl,us(dl)*s(dl));

cmin(g)..    x(g)  =g= ccmin(g);

cmax(g)..    x(g)  =l= ccmax(g);

omax(g)..    sum(dl, y(g,dl)) =l= alpha(g)*x(g);

demand(dl).. sum(g, y(g,dl)) + s(dl) =g= d(dl);

Model apl1p / all /;

* -----------------------------------------------
* setting decision stages
* -----------------------------------------------
x.stage(g)       = 1;
y.stage(g,dl)    = 2;
s.stage(dl)      = 2;
cmin.stage(g)    = 1;
cmax.stage(g)    = 1;
omax.stage(g)    = 2;
demand.stage(dl) = 2;

* -----------------------------------------------
* defining independent stochastic parameters
* -----------------------------------------------
Set
   stoch  / out, pro /
   omega1 / o11, o12 /;

Table v1(stoch, omega1)
         o11  o12
   out   2.1  1.0
   pro   0.5  0.5;

Set omega2 / o21, o22 /;

Table v2(stoch, omega2)
         o21  o22
   out   2.0  1.0
   pro   0.2  0.8;

Parameter
   hm1(dl) / h 300, m 400, l 200 /
   hm2(dl) / h 100, m 150, l 300 /;

* -----------------------------------------------
* outputting stochastic file
* -----------------------------------------------
File stg / MODEL.STG /;
put  stg;

put "BLOCKS DISCRETE" /;

Scalar h1;

loop(omega1,
   put "BL v1 period2 ", v1("pro", omega1)/;
   loop(dl,
      h1 = hm1(dl) * v1("out", omega1);
      put "RHS demand ",dl.tl:1, " ", h1/;
   );
);

loop(omega2,
   put "BL v2 period2 ", v2("pro", omega2)/;
   loop(dl,
      h1 = hm2(dl) * v2("out", omega2);
      put "RHS demand ",dl.tl:1, " ", h1/;
   );
);

putClose;

* -----------------------------------------------
* output a MINOS option file
* -----------------------------------------------
File mopt / MINOS.SPC /;
put  mopt;
put "begin"/;
put "rows 250"/;
put "columns 250"/;
put "elements 10000"/;
put "end"/;
putClose;

* -----------------------------------------------
* solve the model
* -----------------------------------------------
option lp = %decisalg%;

solve apl1p using lp minimizing tcost;

Scalar
   ccost 'capital cost'
   ocost 'operating cost';

ccost = sum(g, c(g)*x.l(g));
ocost = tcost.l - ccost;

display x.l, tcost.l, ccost, ocost, y.l, s.l;