landssp.gms : Optimal Investment

Description

The following two-stage problem consists of determining the optimal
capacity investment in various types of power plants so as to meet
next period demands for electricity. Four power plants are considered
and they can operate in three different modes. The next period demand
for each of the three modes are to be met. There is a budget
constraint and also a constraint on the minimum total capacity.


Small Model of Type : SP


Category : GAMS EMP library


Main file : landssp.gms

$title Optimal Investment (LANDSSP,SEQ=75)

$ontext

The following two-stage problem consists of determining the optimal
capacity investment in various types of power plants so as to meet
next period demands for electricity. Four power plants are considered
and they can operate in three different modes. The next period demand
for each of the three modes are to be met. There is a budget
constraint and also a constraint on the minimum total capacity.


Louveaux, F V, and Smeers, Y, Optimal Investments for Electricity
Generation: A Stochastic Model and a Test Problem. In
Ermoliev, Y, and Wets, R J, Eds, Numerical Techniques for
Stochastic Optimization Problems. Springer Verlag, 1988,
pp. 445-452.

$offtext

sets i  power plant type / plant-1*plant-4 /
     j  operating mode   / mode-1*mode-3 /

parameter c(i) investment cost / plant-1 10, plant-2 7, plant-3 16, plant-4 6 /
          d(j) energy demand   / mode-1 5, mode-2 3, mode-3 2 /

table f(i,j) operating cost
         mode-1 mode-2 mode-3
plant-1    40     24     4
plant-2    45     27     4.5
plant-3    32     19.2   3.2
plant-4    55     33     5.5

scalar m min installed capacity / 12 /
       b budget limit           /120 /;

Variables x(i)    capacity installed
          y(i,j)  operating level
          cost    total cost
Positive Variables x,y;

Equations defcost    definition of total cost
          mincap     minimum installed capacity
          bbal       budget constraint
          powbal(i)  power balance
          dembal(j)  demand balance;

defcost.. cost =e= sum(i, c(i)*x(i)) + sum((i,j), f(i,j)*y(i,j));

mincap..  sum(i, x(i)) =g= m;

bbal..   sum(i, c(i)*x(I)) =l= b;

powbal(i).. sum(j, y(i,j)) =l= x(i);

dembal(j).. sum(i, y(i,j)) =g= d(j);

model capinvest / all /;

set o realizations for mode-1 demand  / o1*o3 /
parameter dvar(o) / o1 3,  o2 5,  o3 7 /
          prob(o) / o1 .3, o2 .4, o3 .3 /

file emp / '%emp.info%' /; put emp '* problem %gams.i%';
put / "randvar d('mode-1') discrete";
loop(o, put prob(o):4:1 dvar(o):2:0);
putclose / "stage 2 d('mode-1') y powbal dembal";

Set s            scenarios / s1*s3 /;
Parameter
    srep(s,*)    scenario probability / #s.prob 0/ 
    s_d(s,j)     yield factor realization by scenario
    s_x(s,i), s_y(s,i,j), s_cost(s);

Set dict / s    .scenario.''
           ''   .opt     . srep
           d    .randvar . s_d
           x    .level   . s_x
           y    .level   . s_y
           cost .level   . s_cost /;

solve capinvest min cost using emp scenario dict;

* Test if y is reported as expected solution
Parameter y_ES(i,j) / #i.#j 0 /;
loop(s, y_ES(i,j) =  y_ES(i,j) + s_y(s,i,j)*srep(s,'prob'));
* Normalize if scenario probabilities do not add up to 1
y_ES(i,j) = y_ES(i,j)/sum(s,srep(s,'prob'));

* Since we don't know what scenarios DECIS used for solution the problem we can't do the check
$ifi not %gams.emp%==decis
abort$(sum((i,j), abs(y.l(i,j)-y_ES(i,j)))>1e-6) 'y.l is not expected solution';

$if not set TOL $set TOL 1e-6
abort$(abs(cost.l-381.853333)>capinvest.objval) 'wrong objective';

loop(s,
  x.fx(i) = s_x(s,i);
  y.fx(i,j) = s_y(s,i,j);
  d('mode-1') = s_d(s, 'mode-1');
  solve capinvest min cost using lp;
  abort$(capinvest.modelstat<>%modelstat.Optimal%) 'scenario not optimal';
  abort$(abs(cost.l-s_cost(s))>%TOL%) 'wrong scenario objective';
);