nbdiscindep.gms : Newsboy problem, discrete and independent distribution

Description

```Newsboy problem from Lindo manual
Random parameters D and R are discrete and independently distributed

Reference: LINDO API 7.0 User Manual
```

Small Model of Type : SP

Category : GAMS EMP library

Main file : nbdiscindep.gms

``````\$Title Newsboy problem, discrete and independent distribution (NBDISCINDEP,SEQ=78)

\$ontext

Newsboy problem from Lindo manual
Random parameters D and R are discrete and independently distributed

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 cost per 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 discrete 0.4 90
0.3 60
0.3 30
randvar r discrete 0.7 9
0.3 -15
stage 2 d
stage 3 r
stage 2 I L S
stage 3 Z Y E
stage 2 Row2 Row3
stage 3 Profit Row4
\$offput
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;
``````