nbcontjoint.gms : Newsboy problem, continuous and joint distribution

Description

Newsboy problem from Lindo manual
Random paramters D and R are continuous distributed with a certain correlation

Reference: LINDO API 7.0 User Manual


Small Model of Type : SP


Category : GAMS EMP library


Main file : nbcontjoint.gms

$title Newsboy problem, continuous and joint distribution (NBCONTJOINT,SEQ=77)

$onText

Newsboy problem from Lindo manual
Random paramters D and R are continuous distributed with a certain correlation

Reference: LINDO API 7.0 User Manual

$offText

Scalar  c       Purchase costs per unit                                 / 30 /
        p       Penalty shortage cost per unit unsatisfied demand       /  5 /
        h       Holding costper unit leftover                           / 10 /
        v       Revenue per unit sold                                   / 60 /
*       Random parameters
        d       Demand                                                  / 63 /
        r       Refund per unit                                         /  9 /;

Variable Z Profit;
Positive Variables
         X Units bought
         I Inventory
         L Lost sales
         S Units sold
         Y Units returned
         E Units kept;

Equations Row1, Row2, Row3, Row4, Profit;

* Units bought, X, Buy at least 1 (serves as a dummy constraint for stage 1);
Row1.. X =g= 1;

* Inventory (I) and Lost Sales (L);
Row2.. I =e= X + L - d;

* Units sold S, and inventory left over, I;
Row3.. S =e= X - I;

* Y units returned to vendor for a possible refund, and E kept;
Row4.. Y + E =e= I;

* Profit, to be maximized;
Profit..  Z =e= v*S - c*X - h*I - p*L + r*Y - h*E;

Model nb / all /;

file emp / '%emp.info%' /; put emp '* problem %gams.i%'/;
$onPut
randvar d normal 45 10
randvar r normal -3 2
stage 2 d
stage 3 r
stage 2 I L S
stage 3 Z Y E
stage 2 Row2 Row3
stage 3 Profit Row4
correlation d r 0.5
$offPut
* Lindo can handle continuous distributions directly
* For other EMPSP solvers d and r need to be sampled aqead of time
$if not '%gams.emp%'==lindo put 'sample d r 6';
putclose emp;

Set scen        scenarios / s1*s36 /;
Parameter
    s_d(scen)   demand realization by scenario
    s_r(scen)   refund realization by scenario
    s_x(scen)
    s_s(scen) ;

Set dict / scen .scenario.''
           d    .randvar .s_d
           r    .randvar .s_r
           s    .level   .s_s
           x    .level   .s_x /;

solve nb max z use emp scenario dict;

display s_d, s_r, s_s, s_x;