Stochastic AUGMECON Method Topic is solved

Problems with syntax of GAMS
Post Reply
Janisch
User
User
Posts: 36
Joined: 3 months ago

Stochastic AUGMECON Method

Post by Janisch » 6 days ago

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
Last edited by Janisch 6 days ago, edited 2 times in total.

Janisch
User
User
Posts: 36
Joined: 3 months ago

Re: Stochastic AUGMECON Method

Post by Janisch » 6 days ago

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 12 times
INPUT.gdx
(9.05 KiB) Downloaded 9 times
INPUT_scalar.gdx
(443 Bytes) Downloaded 6 times
Error.JPG

User avatar
bussieck
Moderator
Moderator
Posts: 553
Joined: 4 years ago

Re: Stochastic AUGMECON Method

Post by bussieck » 5 days ago

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

Janisch
User
User
Posts: 36
Joined: 3 months ago

Re: Stochastic AUGMECON Method

Post by Janisch » 5 days ago

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 6 times
INPUT_scalar.gdx
(443 Bytes) Downloaded 6 times
AUGMECON_R.gms
(25.23 KiB) Downloaded 8 times

User avatar
bussieck
Moderator
Moderator
Posts: 553
Joined: 4 years ago

Re: Stochastic AUGMECON Method

Post by bussieck » 4 days ago

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 7 times

Janisch
User
User
Posts: 36
Joined: 3 months ago

Re: Stochastic AUGMECON Method

Post by Janisch » 4 days ago

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 7 times
INPUT.gdx
(9.05 KiB) Downloaded 6 times
INPUT_scalar.gdx
(443 Bytes) Downloaded 6 times
Transport_Stochastic.gms
(2.51 KiB) Downloaded 6 times

User avatar
bussieck
Moderator
Moderator
Posts: 553
Joined: 4 years ago

Re: Stochastic AUGMECON Method

Post by bussieck » 3 days ago

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

Janisch
User
User
Posts: 36
Joined: 3 months ago

Re: Stochastic AUGMECON Method

Post by Janisch » 3 days ago

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

Post Reply