The gams program generates the objective value in the list file. I want to collect this z value for running a matlab program. How can I do this?
AK
–
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.
Hi! One way is export the variables values to a gdx file. For example:
VARIABLES
z objective variable
x(i) variables of the model;
PARAMETERS
zv objective value
xv(i) variables values;
**** Rest of the model code…
zv = z.l
xv(i) = x.l(i) ;
EXECUTE_UNLOAD ‘Values’, zv xv;
In the file ‘Values.gdx’ you will find the values of your model. Then you can convert the .gdx file to a .xlsx file and use the Matlab function “XLSREAD”.
A (much) better way is use the suite GDXMRW (www.gams.com/dd/docs/tools/gdxmrw.pdf) to import or export data between Matlab and GAMS.
Hope this help you,
Fabián
2011/4/12 Abhilasha Kelkar
The gams program generates the objective value in the list file. I want to collect this z value for running a matlab program. How can I do this?
AK
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.
Thanks Fabian for your input. I will work it out. Also, the link for importing and exporting data between Matlab and GAMS is helpful.
AK
2011/4/13 Fabián Mancilla
Hi! One way is export the variables values to a gdx file. For example:
VARIABLES
z objective variable
x(i) variables of the model;
PARAMETERS
zv objective value
xv(i) variables values;
**** Rest of the model code…
zv = z.l
xv(i) = x.l(i) ;
EXECUTE_UNLOAD ‘Values’, zv xv;
In the file ‘Values.gdx’ you will find the values of your model. Then you can convert the .gdx file to a .xlsx file and use the Matlab function “XLSREAD”.
A (much) better way is use the suite GDXMRW (www.gams.com/dd/docs/tools/gdxmrw.pdf) to import or export data between Matlab and GAMS.
Hope this help you,
Fabián
2011/4/12 Abhilasha Kelkar
The gams program generates the objective value in the list file. I want to collect this z value for running a matlab program. How can I do this?
AK
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.
You can also use the “put” function to write a txt file with the value and then load it to Matlab.
Where Obj is the variable associated with your objective function.
file results /results.dat/;
put results;
put Obj.l /
putclose;
Fabián Mancilla escreveu:
Hi! One way is export the variables values to a gdx file. For example:
VARIABLES
z objective variable
x(i) variables of the model;
PARAMETERS
zv objective value
xv(i) variables values;
**** Rest of the model code…
zv = z.l
xv(i) = x.l(i) ;
EXECUTE_UNLOAD ‘Values’, zv xv;
In the file ‘Values.gdx’ you will find the values of your model. Then you can convert the .gdx file to a .xlsx file and use the Matlab function “XLSREAD”.
A (much) better way is use the suite GDXMRW (www.gams.com/dd/docs/tools/gdxmrw.pdf ) to import or export data between Matlab and GAMS.
Hope this help you,
Fabián
2011/4/12 Abhilasha Kelkar >
The gams program generates the objective value in the list file. I
want to collect this z value for running a matlab program. How can
I do this?
AK
-- You received this message because you are subscribed to the Google
Groups "gamsworld" group.
To post to this group, send email to <gamsworld@googlegroups.com>
.
To unsubscribe from this group, send email to
<gamsworld+unsubscribe@googlegroups.com>
.
For more options, visit this group at
http://groups.google.com/group/gamsworld?hl=en.
–
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.
–
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.
\