### Stochastic Programming with multiple stochastic parameters

Posted:

**Fri Mar 16, 2018 9:34 pm**Hi dudes,

I have one problem with the SP in GAMS. When I run a simple code with multiple stochastic terms, denoted by n, such as d(n), the output returns "System Failure", which I could not identify what happened. Here is my part of stochastic definition:

File emp / '%emp.info%' /;

put emp '* problem %gams.i%'/;

$onput

randvar d(n) discrete 0.25 70 0.5 100 0.25 130

stage 1 y(n)

stage 2 u(n) v(n) d(n) w(m)

stage 2 row1 row2

$offput

putclose emp;

Set scen "scenarios" / s1*s9 /;

Parameter

s_d(scen,n) "demand realization by scenario"

s_u(scen,n) "units bought by scenario"

s_v(scen,n) "units sold by scenario"

s_w(scen,m) "units substituted by scenario"

s_rep(scen,*) "scenario probability" / #scen.prob 0/;

Set dict / scen .scenario.''

d .randvar .s_d

w .level .s_w

v .level .s_v

u .level .s_u

'' .opt .s_rep /;

Since I have two sets, it is impossible to eliminate (n) and (m) in the definition, which would trigger "domain violation".

I have checked the output, and it returned System Failure, and it had a hint:

*** emp.info line 2: Unknown uel: n

Hint: EMP keys like Chance, Stage, VaR, ... are not allowed as symbol names

So does it mean I could not use inside set identifier like d(n) in the stochastic definition? Then how could I establsih a multi-randomness model? In my case, I have two variables which both obey the discrete distribution.

Thank you guys!

Cheers!

I have one problem with the SP in GAMS. When I run a simple code with multiple stochastic terms, denoted by n, such as d(n), the output returns "System Failure", which I could not identify what happened. Here is my part of stochastic definition:

File emp / '%emp.info%' /;

put emp '* problem %gams.i%'/;

$onput

randvar d(n) discrete 0.25 70 0.5 100 0.25 130

stage 1 y(n)

stage 2 u(n) v(n) d(n) w(m)

stage 2 row1 row2

$offput

putclose emp;

Set scen "scenarios" / s1*s9 /;

Parameter

s_d(scen,n) "demand realization by scenario"

s_u(scen,n) "units bought by scenario"

s_v(scen,n) "units sold by scenario"

s_w(scen,m) "units substituted by scenario"

s_rep(scen,*) "scenario probability" / #scen.prob 0/;

Set dict / scen .scenario.''

d .randvar .s_d

w .level .s_w

v .level .s_v

u .level .s_u

'' .opt .s_rep /;

Since I have two sets, it is impossible to eliminate (n) and (m) in the definition, which would trigger "domain violation".

I have checked the output, and it returned System Failure, and it had a hint:

*** emp.info line 2: Unknown uel: n

Hint: EMP keys like Chance, Stage, VaR, ... are not allowed as symbol names

So does it mean I could not use inside set identifier like d(n) in the stochastic definition? Then how could I establsih a multi-randomness model? In my case, I have two variables which both obey the discrete distribution.

Thank you guys!

Cheers!