Use GAMS solution in GAMS model

Hi everyone!

Quick question: Is it possible to (automatically) use the solution of a GAMS model as initial solution to another GAMS model and run it at once?
I know how to include an initial solution in the model and how to run batches. But how can I link two GAMS files, so that the second one uses the solution of the first one as its starting point?
Could I even do that in one combined GAMS file?

Thanks for your support!


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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\

Hi
It is some thing, i use now. I hope it is helpful.
You can define all equations (associated to both models) in one file, suppose

Equations
cost_1 define objective function of model 1
con_Model_1(i,j)

cost_2 define objective function of model 2
con_Model_2(i,j);

Model Tran_1 /cost, con_Model_1/ ;
Model Tran_2 /cost, con_Model_2/ ;

Solve Tran_1 using lp maximizing …;

  • then save result of Tran_1 in some parameter, say A. Note that constraints or objective of model 2 are defined using parameter A. Then solve Tran_2.



    Another way is, model Tran_1 is defined in separate file and the its results are saved in a gdx file. Then, model of Tran_2 call Tran_2 (assume model of Tran_2 is saved as Untitled.gms)
    $call gams Untitled.gms
    After that its results are loaded in file of Tran_2.

From: JapanGo
To: gamsworld@googlegroups.com
Sent: Tuesday, February 26, 2013 6:05 PM
Subject: Use GAMS solution in GAMS model

Hi everyone!

Quick question: Is it possible to (automatically) use the solution of a GAMS model as initial solution to another GAMS model and run it at once?
I know how to include an initial solution in the model and how to run batches. But how can I link two GAMS files, so that the second one uses the solution of the first one as its starting point?
Could I even do that in one combined GAMS file?

Thanks for your support!

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?hl=en.
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\

Usually ,I’ll use two gams file,each for a model and write and read the solution into an excel or txt file with $inlcude command.
all you need to do is click twice in the gamside .
Hope it’ll help!

On Tuesday, February 26, 2013 10:35:33 PM UTC+8, JapanGo wrote:

Hi everyone!

Quick question: Is it possible to (automatically) use the solution of a GAMS model as initial solution to another GAMS model and run it at once?
I know how to include an initial solution in the model and how to run batches. But how can I link two GAMS files, so that the second one uses the solution of the first one as its starting point?
Could I even do that in one combined GAMS file?

Thanks for your support!


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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\

Thanks to both of you!
So what I will do is to use two GAMS files.

File 1 will calculate the initial solution and store it into a GDX file. That’s an easy one so far: execute_unload “results.gdx” x.L y.L

File 2 then should use the information stored.

Here is my setup: x and y are binary variables of Set I resp. J. The result is then x1=0, x2=0, x3=1, x4=0, x5=0, x6=1 (and for y accordingly).
In File two I have again set I, but then divide it into two subsets: I_A and I_B.
I_A contains all x that equal 1 and I_B contains all x that equal zero.

To load the file I assume it’s the command execute_load “results.gdx” x.L y.L (with sets I (for variable x) and J (for variable y) defined before in File 2)

How can I then split the loaded results into my subset?

Thanks again to all!


Am Mittwoch, 27. Februar 2013 08:39:52 UTC+1 schrieb Brook Philms:

Usually ,I’ll use two gams file,each for a model and write and read the solution into an excel or txt file with $inlcude command.
all you need to do is click twice in the gamside .
Hope it’ll help!

On Tuesday, February 26, 2013 10:35:33 PM UTC+8, JapanGo wrote:

Hi everyone!

Quick question: Is it possible to (automatically) use the solution of a GAMS model as initial solution to another GAMS model and run it at once?
I know how to include an initial solution in the model and how to run batches. But how can I link two GAMS files, so that the second one uses the solution of the first one as its starting point?
Could I even do that in one combined GAMS file?

Thanks for your support!


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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\

Hello,
if I dont understand wrong,$ here is useful(dynamic sets):

sets I_A(I),I_B(I);
I_A(I)(x.l(I)eq 1)=yes; I_B(I)(x.l(I)eq 0)=yes;

Is this right?

Hope it helps!

Philms

On Wed, Feb 27, 2013 at 6:24 PM, JapanGo wrote:

Thanks to both of you!
So what I will do is to use two GAMS files.

File 1 will calculate the initial solution and store it into a GDX file. That’s an easy one so far: execute_unload “results.gdx” x.L y.L

File 2 then should use the information stored.

Here is my setup: x and y are binary variables of Set I resp. J. The result is then x1=0, x2=0, x3=1, x4=0, x5=0, x6=1 (and for y accordingly).
In File two I have again set I, but then divide it into two subsets: I_A and I_B.
I_A contains all x that equal 1 and I_B contains all x that equal zero.

To load the file I assume it’s the command execute_load “results.gdx” x.L y.L (with sets I (for variable x) and J (for variable y) defined before in File 2)

How can I then split the loaded results into my subset?

Thanks again to all!


Am Mittwoch, 27. Februar 2013 08:39:52 UTC+1 schrieb Brook Philms:

Usually ,I’ll use two gams file,each for a model and write and read the solution into an excel or txt file with $inlcude command.
all you need to do is click twice in the gamside .
Hope it’ll help!

On Tuesday, February 26, 2013 10:35:33 PM UTC+8, JapanGo wrote:

Hi everyone!

Quick question: Is it possible to (automatically) use the solution of a GAMS model as initial solution to another GAMS model and run it at once?
I know how to include an initial solution in the model and how to run batches. But how can I link two GAMS files, so that the second one uses the solution of the first one as its starting point?
Could I even do that in one combined GAMS file?

Thanks for your support!


You received this message because you are subscribed to a topic in the Google Groups “gamsworld” group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gamsworld/fwbS0fXHI6M/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, 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?hl=en.
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\

Superb!
After a little trial and error I finally made it work with your help. Great!

Thanks again to both of you!

Am Mittwoch, 27. Februar 2013 12:55:11 UTC+1 schrieb Brook Philms:

Hello,
if I dont understand wrong,$ here is useful(dynamic sets):

sets I_A(I),I_B(I);
I_A(I)(x.l(I)eq 1)=yes; I_B(I)(x.l(I)eq 0)=yes;

Is this right?

Hope it helps!

Philms

On Wed, Feb 27, 2013 at 6:24 PM, JapanGo wrote:

Thanks to both of you!
So what I will do is to use two GAMS files.

File 1 will calculate the initial solution and store it into a GDX file. That’s an easy one so far: execute_unload “results.gdx” x.L y.L

File 2 then should use the information stored.

Here is my setup: x and y are binary variables of Set I resp. J. The result is then x1=0, x2=0, x3=1, x4=0, x5=0, x6=1 (and for y accordingly).
In File two I have again set I, but then divide it into two subsets: I_A and I_B.
I_A contains all x that equal 1 and I_B contains all x that equal zero.

To load the file I assume it’s the command execute_load “results.gdx” x.L y.L (with sets I (for variable x) and J (for variable y) defined before in File 2)

How can I then split the loaded results into my subset?

Thanks again to all!


Am Mittwoch, 27. Februar 2013 08:39:52 UTC+1 schrieb Brook Philms:

Usually ,I’ll use two gams file,each for a model and write and read the solution into an excel or txt file with $inlcude command.
all you need to do is click twice in the gamside .
Hope it’ll help!

On Tuesday, February 26, 2013 10:35:33 PM UTC+8, JapanGo wrote:

Hi everyone!

Quick question: Is it possible to (automatically) use the solution of a GAMS model as initial solution to another GAMS model and run it at once?
I know how to include an initial solution in the model and how to run batches. But how can I link two GAMS files, so that the second one uses the solution of the first one as its starting point?
Could I even do that in one combined GAMS file?

Thanks for your support!


You received this message because you are subscribed to a topic in the Google Groups “gamsworld” group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gamsworld/fwbS0fXHI6M/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, 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?hl=en.
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\