I would like to add a stochastic component to my optimization. More precisely, I would like to make the demand parameter B stochastic. It should fluctuate around the predefined value, which comes from the input GDX file, with a defined maximum percentage deviation.
Now my question which adjustments do I have to make in my model to make this possible?

I am a complete beginner in the field of stochastic optimization. If you have any questions, please contact me.
I am happy about help or suggestions

So I tried to get the model to run using emp notations. Now a syntax error appears that I don’t understand:
Error Cannot open parameter file
Error Error code = 2

I have attached the adapted code and the error message. I hope somebody can help me with this error AUGMECON_R.gms (25.2 KB) INPUT_scalar.gdx (443 Bytes) INPUT.gdx (9.05 KB)

You were almost there: a) select a EMP-SP solver to solve the EMP model: option emp=de; b) add “scenario dict” to the solve statement to indicate that this is a SP-EMP model: Solve mod_payoff using emp maximizing obj scenario dict; The second solve statement of model mod_epsmethod had this already on. If you don’t want to solve mod_payoff solved as a stochastic model, change the model type to MIP. c) The equation ObjFunction was not marked as second stage but contains second stage variables, hence DE complained. After adding ObjFunction to the list of second stage objects in the EMP file everything worked.

My problem is also that only the ObjFunction(“Cost”) depends on ud. How can I force that at least the lowest demand is served, if I optimize for example the time as objective function? Because otherwise the individual optimization of the time and the CO2e will not route any transports through the network.
And how can I set the time limit for the individual calculations in CPLEX to a maximum of 40 sec?

Can’t you just add a constraint DemandMin that uses the smallest bf (bfMin=0.5) but has no recourse/slack variable ud but must be satisfied? There is now the chance the the model can go infeasible if circumstances are that this min demand requirement can’t be fulfilled and no other “slack” is in the system. You can even have this single constraint in the first stage. I have attached the model to be clear what I mean.

Thanks already!
The new constraint works well. But I still have the problem that my ObjFunction should not be in Stage 2. I have kept to the example Transport_Stochastic. In this formulation the target function is also not in Stage 2.
How can I reformulate my model so that the equation is assigned to ObjFunction in Stage 1? Only ObjFunction(“Cost”) contains ud. So far it makes no difference at all which probabilities I enter. The result is always the same. Why?

Why sink the unsatisfied demand for Berlin, when the demand factor is increasing? This does not make sense to me. Is there an explanation for this?

I have attached my model and the example.
Thanks for your time and help

The objective function is always in the second stage, therefore it does not need to be specified in the EMP info file as 2nd stage. Your constraint ObjFunction, even though called like this, is not (at least not directly) the objective function, so no implicit assignment of the stage for this constraint.

To answer the other questions one would have to emerge in your model. Can’t help with that. Sorry.

Now it works. I had a thinking error when assigning the stages

But i have a second question:
Is it possible to read in the distribution probabilities and the corresponding discrete demand quantities from Excel? Because these have to be written directly in the following code lines: