Dear Antho,
Please tell me the best answer you find. Many of us would like to do the same problem, something like running a base model, then looping over scenarios, such as
\
-
Alternative prices
-
Alternative production costs
-
Alternative water supplies/climate scenarios
-
Alternative technical advance possibilities
-
Alternative government policy proposals
Looping over all those sets is a common need many of us have. It lets us find optimized response patterns to a bundle of future uncertainties.
Frank
From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Anthony
Sent: Thursday, February 04, 2016 12:22 PM
To: gamsworld
Subject: How to quickly load data over a loop (different scenarios)???
Dear Gents,
All I need is to run 1000 scenarios on a model with various values for two parameters (a(i) and b(j)) in each run and save the results of each run separately. In need to set a mechanism so that GAMS read and put each row of the parameter in the model in each run and save the results to end.
For example in the Transport example, I need to run the model in 1000 different scenarios (1000 different problem sizes defined in excel rows) with different value for a(i) and b(j) over a loop and save the Z.L to different rows in a spreadsheet.
/////////////////////////////////////////////////////////
a(i) = /
i1 i2 i3
Scenario1 100 200 300
Scenario2 120 240 270
. . .
. . .
. . .
Scenario1000 115 213 310
///////////////////////////////////////////////////////////////////
b(j)
J1 J2 J3
Scenario1 100 200 300
Scenario2 120 240 270
. . .
. . .
. . .
Scenario1000 115 213 310
//////////////////////////////////////////////////////////////////
Consider the code is like below:
Set sc /Scenario1*Scenario1000/
Parameter A(i),B(j), Total_cost;
Equatios;
Objective Max X =z.l;
Cons1… A(i)x < B(j)
Loop(sc,
A(i) = A(scenario(sc))
B(j) = B(scenario(sc))
Solve model MIP Maximising Total_cost;
Total_cost(sc,“Z.L”)=z.l;
);
Putclose;
Display Total_cost;
Execute_Unload “All_scenarios.gdx”,Total_cost;
Execute ‘GDXXRW.EXE All_scenarios.gdx epsOut=0 par=Total_cost rng=Total_costs!a1 trace=0’
Just wondering how to import each row to the model in each scenario(sc)? Is there any proper trick?
Looking forward to hearing back from you guys.
Cheers,
Antho
\
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
–
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.