EMP Question

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.

Gustavo,

You don’t need to specify a separate parameter for each product, but you need to specify the distribution for each of the products used with demand. You can look at the example “airlift” from the GAMS EMP Model Library. There the same is done for the parameter d(j):

randvar d(‘r1’) lognormal 1000 50
randvar d(‘r2’) lognormal 1500 300

Alternatively, if you have a factor that modifies your demand for all products in the same way for your scenarios, you could define this factor as a random variable. This is done for example in the model “farmsp” from the GAMS EMP Model Library.

I hope that helps!
Lutz


Am 1/29/2014 12:47 PM, schrieb Gustavo Gallardo:

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;


You received this message because you are subscribed to the Google
Groups “gamsworld” group.
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.



Lutz Westermann LWestermann@gams.com
GAMS Development Corporation GAMS Software GmbH
1217 Potomac St. NW, P.O. Box 40 59
Washington DC, 20007, USA 50216 Frechen, Germany
Fon/Fax: +1 202 342-0180/1 Fon/Fax: +49 221 949-9170/1
http://www.gams.com


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.