Page 1 of 1

Stochastic AUGMECON Method

Posted: Fri Feb 19, 2021 10:42 am
by Janisch
Hello all,

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 :)

Many greetings
Janisch

Re: Stochastic AUGMECON Method

Posted: Fri Feb 19, 2021 4:49 pm
by Janisch
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.22 KiB) Downloaded 185 times
INPUT.gdx
(9.05 KiB) Downloaded 175 times
INPUT_scalar.gdx
(443 Bytes) Downloaded 171 times
Error.JPG

Re: Stochastic AUGMECON Method

Posted: Sat Feb 20, 2021 6:10 am
by bussieck
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.

-Michael

Re: Stochastic AUGMECON Method

Posted: Sat Feb 20, 2021 11:08 am
by Janisch
Great, thanks for your help.

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?

Thanks already for your help!
INPUT.gdx
(9.05 KiB) Downloaded 171 times
INPUT_scalar.gdx
(443 Bytes) Downloaded 170 times
AUGMECON_R.gms
(25.23 KiB) Downloaded 168 times

Re: Stochastic AUGMECON Method

Posted: Sun Feb 21, 2021 7:23 am
by bussieck
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.

-Michael
AUGMECON_R.gms
(25.67 KiB) Downloaded 171 times

Re: Stochastic AUGMECON Method

Posted: Sun Feb 21, 2021 12:33 pm
by Janisch
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?
1.JPG
I have attached my model and the example.
Thanks for your time and help :)

Janisch


AUGMECON_R.gms
(28.73 KiB) Downloaded 178 times
INPUT.gdx
(9.05 KiB) Downloaded 161 times
INPUT_scalar.gdx
(443 Bytes) Downloaded 175 times
Transport_Stochastic.gms
(2.51 KiB) Downloaded 178 times

Re: Stochastic AUGMECON Method

Posted: Mon Feb 22, 2021 10:19 am
by bussieck
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.

-Michael

Re: Stochastic AUGMECON Method

Posted: Mon Feb 22, 2021 11:47 am
by Janisch
Thanks for your answer :)

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

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:

Code: Select all

file emp / '%emp.info%' /; put emp '* problem %gams.i%'/;
$onput
randvar bf discrete 0.3 0.95
                    0.5 1.00
                    0.2 1.05

$offput
putclose emp;
How can I implement this?

Thank you and many greetings
Janisch