How to declare a huge number of models conveniently?

Dear all,

I try to solve a stochastic problem, which includes a huge number of scenarios. Each scenario corresponds a sub-problem. It is easy to define the constraints, parameters and variables over the scenario set. But I found that it is not convenient to declare the model for each sub-problem. Say, if I have 1000 sub-problems, do I need to write model definition a thousand times?

Since I didn’t find any related information in the user’s guide, I tried a naive way:


Set Scenario /S0001*S1000/;
Model Sub_problem(Scenario) / Constraint(Scenario), Obj(Scenario)/;


But clearly it is not correct, so please tell me if you have same ideas to define this huge number of models. I am very grateful for your kind help!

Regards,

\

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 http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

Hi there,

Here is the pseudocode.

  • Define model outside the loop

constaint(sce)…
obj(sce)…
Model m /all/;

  • Solve the model in loop

loop(sce,
solve m using nlp minimizing obj;
);

Best,
Da


2013/12/20

Dear all,

I try to solve a stochastic problem, which includes a huge number of scenarios. Each scenario corresponds a sub-problem. It is easy to define the constraints, parameters and variables over the scenario set. But I found that it is not convenient to declare the model for each sub-problem. Say, if I have 1000 sub-problems, do I need to write model definition a thousand times?

Since I didn’t find any related information in the user’s guide, I tried a naive way:


Set Scenario /S0001*S1000/;
Model Sub_problem(Scenario) / Constraint(Scenario), Obj(Scenario)/;


But clearly it is not correct, so please tell me if you have same ideas to define this huge number of models. I am very grateful for your kind help!

Regards,

\

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 http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

\

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 http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

Reply-to: gamsworld@googlegroups.com

OK, thanks. Let me try this.

Regards,


On Friday, December 20, 2013 2:32:32 AM UTC-5, Da ZHANG wrote:

Hi there,

Here is the pseudocode.

  • Define model outside the loop

constaint(sce)…
obj(sce)…
Model m /all/;

  • Solve the model in loop

loop(sce,
solve m using nlp minimizing obj;
);

Best,
Da


2013/12/20

Dear all,

I try to solve a stochastic problem, which includes a huge number of scenarios. Each scenario corresponds a sub-problem. It is easy to define the constraints, parameters and variables over the scenario set. But I found that it is not convenient to declare the model for each sub-problem. Say, if I have 1000 sub-problems, do I need to write model definition a thousand times?

Since I didn’t find any related information in the user’s guide, I tried a naive way:


Set Scenario /S0001*S1000/;
Model Sub_problem(Scenario) / Constraint(Scenario), Obj(Scenario)/;


But clearly it is not correct, so please tell me if you have same ideas to define this huge number of models. I am very grateful for your kind help!

Regards,

\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

\

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 http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.