I am new to Stochastic Programming in GAMS, so sorry if this question is dumb.
I have one small and simple linear programming problem with 16 variables and 9 constraints. Three of the 9 constraints have their right hand side parameters random, which are also obeying a discrete distribution. Then I modeled this problem and used the following codes trying to solve them.
The codes are nothing new. I just copied and pasted the two-stage SP problem codes in the documentation. Then I ran the codes and found that it returned no solution, saying that “Random variable d3_var in stage 1 with fixed value 3” and “Stage 1 RV [d1] with more than one realization”, “cannot build regular tree from random variables”.
Actually I thought my problem is a one-stage problem so I did not define stages. And I also defined d1, d2, d3 as scalars giving them values as 5, 4 and 3 at the beginning of the model.
There are two problems which I found in your model:
The first one is an easy one, probably just a typo: In the emp.info file you defined “randvar d2 …” twice. I guess the second one should actually be “randvar d3 …”.
The second problems seems to be deeper: You say that your model should be a 1-stage model. However, in the way GAMS looks at SP problems, there cannot be uncertainty in stage 1 (if we ignore chance constraints for now). So it is not really clear to me, how you want to model uncertainty here in stage 1? Maybe you can also find some useful information here: https://www.gams.com/latest/docs/UG_EMP_SP.html
Thank you so much Lutz. I have solved this problem by using just a deterministic equivalent form, since it just involves a simple LP and discrete uncertainty. But still I have some questions regarding GAMS’ Stochastic Programming (SP). Let me reply your answer first.
Yeah that is a typo…sorry for that…
I managed to make it a 2-stage problem in the end, and used deterministic equivalent form (just probability multiply with discrete scenarios) to solve it.
Now my question is, what actually does GAMS EMS solver solve, a mean-value problem? a deterministic equivalent problem? a wait-and-see problem? I am not really sure how EMS dictionary solve, especially for continuous distribution. Does EMS do sampling automatically if I call a dictionary to deal with a continuous-distributed uncertainty without identifying the sampling information? I can hardly find information in the SP documentation of GAMS about it.
First, EMP is not a solver itself, it is a model class. This class can be solved by three different Solvers which are part of GAMS: DE, DECIS and LINDO. Note that dependent on the solver selected limitations what can be solved might apply (see https://www.gams.com/latest/docs/UG_EMP_EMPKeywords.html#UG_EMP_EMPKeywords_SP).
In general you can select, if you want to optimize the expected value problem (default), value at risk or conditional value at risk.
DE is basically a reformulation tool. It automatically formulates the deterministic equivalent of your problem and calls another solver to solve this.
DECIS employs Benders decomposition and advanced Monte Carlo sampling techniques.
These two solvers cannot deal with continuous distribution functions directly and need additional sampling information.
LINDO in contrast does the sampling on its own if needed (but gives the users some options to influence the sampling). I has different ways to solve the problem, e.g. deterministic equivalent and Benders decomposition, which can be triggered through options.
More info about these solvers can be found in the solvers manual: