hello everybody
i have a question.
I want to run two models in one GAMS file. The level values of variables in first model have been the initial values for second model. So I put the level variables before second solve. But I think put command execute after finishing second model. Is it correct? How can I put data during file?
Also I wrote before second solve: $include address_file
But this command read in starting compilation & GAMS can’t consider the new values. So I couldn’t read update value before second solve. How can I read one file before second solve?
Can everybody help me?
–
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 Soheila,
One way to solve your problem is to define the optimal values of the first model as parameters in the second model without using the put or the $include command.
solve model1
parmeters
Parameter1_model2=variable1_model1.l;
solve model2
Hope this helps
On Sun, Feb 24, 2013 at 9:25 AM, Soheila wrote:
hello everybody
i have a question.
I want to run two models in one GAMS file. The level values of variables in first model have been the initial values for second model. So I put the level variables before second solve. But I think put command execute after finishing second model. Is it correct? How can I put data during file?
Also I wrote before second solve: $include address_file
But this command read in starting compilation & GAMS can’t consider the new values. So I couldn’t read update value before second solve. How can I read one file before second solve?
Can everybody help me?
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.
\
Dear Soheila,
If I understand you correctly, you want to write (using the “put” facility) results of the first model in a file, prior to solving the second one.
GAMS uses buffers while writing to output files, and only actually writes to file when the buffer is full – or when it reaches the end of the code. To avoid this, you may use “putclose” in order to flush the buffer.
Try something like this :
solve model1 ;
file output1 /‘results1.txt’/;
put output1 ;
put level1.l / ;
putclose output1 ;
solve model2 ;
This should solve your first problem.
For the second, indeed, include files are parsed at compile time, not at execution time.
So I think Muha’s suggestion should work properly in most cases.
Hope this helps
cheers
dax
Le dimanche 24 février 2013 09:25:14 UTC+1, Soheila a écrit :
hello everybody
i have a question.
I want to run two models in one GAMS file. The level values of variables in first model have been the initial values for second model. So I put the level variables before second solve. But I think put command execute after finishing second model. Is it correct? How can I put data during file?
Also I wrote before second solve: $include address_file
But this command read in starting compilation & GAMS can’t consider the new values. So I couldn’t read update value before second solve. How can I read one file before second solve?
Can everybody help me?
–
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.
\