In the example of the news vendor for Stochastic Programming with EMP the use a code. But they only have a demand for one product. My question is: How can I put a randvar if I have two or more products and demands? Can I do that? or I need to put a diferent parameter for each one? In my gams code I need to use a set for products /a,b,c/ and a demand(productos) /a 100, b 200, c 300/ do u know how it works with EMP?
$title example
Scalar
c Purchase costs per unit / 30 /
p Penalty shortage cost per unit / 5 /
h Holding costper unit leftover / 10 /
v Revenue per unit sold / 60 /
- Random parameters
d Demand / 63 /;
Variable Z Profit;
Positive Variables
X Units bought
I Inventory
L Lost sales
S Units sold;
Equations Profit, Row1, Row2;
- Profit, to be maximized
Profit… Z =e= vS - cX - hI - pL; - demand = UnitsSold + LostSales
Row1… d =e= S + L; - Inventory = UnitsBought - UnitsSold
Row2… I =e= X - S;
Model nb / all /;
solve nb max Z use lp;
file emp / ‘%emp.info%’ /; put emp ‘* problem %gams.i%’/;
$onput
randvar d discrete 0.7 45 0.2 40 0.1 50
stage 2 I L S d
stage 2 Row1 Row2
$offput
putclose emp;
Set scen Scenarios / s1*s3 /;
Parameter
s_d(scen) Demand realization by scenario
s_x(scen) Units bought by scenario
s_s(scen) Units sold by scenario;
Set dict / scen .scenario.‘’
d .randvar .s_d
s .level .s_s
x .level .s_x /;
solve nb max z use emp scenario dict;
–
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.