build a string for a text argument

Hi,

I have a loop that is running a bunch of nonlinear optimizations.
Usually the optimization fails, and I collect data on the failure in a
parameter table. At the end, I execute_unload a table of summary
stats on the trials. However, within each loop, I would like to have
a separate execute_unload that will store all of the other data only
for the runs that are successful. And I’d like to do it without
dramatically disturbing what I already have.

One way would be to have the execute_unload statement have a different
file name that changes for each run. So my solve loop is indexed as
xx = xx00001, xx00002, xx00003, …, xx00100. Is there a way to make
xx the name of the file I want to save? I tried the following, but it
didn’t work.

execute_unload xx;

Thanks,
Emily

\

Emily,

You can make use of put_utility ‘gdxout’. Find below a small example

file dummy; put dummy;
set i /i1*i10/;
scalar a;

loop(i,
put_utility ‘gdxout’ / ‘file’ i.tl:0;
a = uniform(0,1);
execute_unload a;
);

Jan


On 12/6/2010 3:18 PM, emily wrote:

Hi,

I have a loop that is running a bunch of nonlinear optimizations.
Usually the optimization fails, and I collect data on the failure in a
parameter table. At the end, I execute_unload a table of summary
stats on the trials. However, within each loop, I would like to have
a separate execute_unload that will store all of the other data only
for the runs that are successful. And I’d like to do it without
dramatically disturbing what I already have.

One way would be to have the execute_unload statement have a different
file name that changes for each run. So my solve loop is indexed as
xx = xx00001, xx00002, xx00003, …, xx00100. Is there a way to make
xx the name of the file I want to save? I tried the following, but it
didn’t work.

execute_unload xx;

Thanks,
Emily


Jan-Hendrik Jagla
jhjagla@gams.com
www.gams.com


GAMS Development Corporation
1217 Potomac St. NW
Washington DC, 20007, USA
Fon/Fax: +1 202 342-0180/1

GAMS Software GmbH
Eupener Str. 135-137
50933 Köln, Deutschland
Fon/Fax: +49 221 949-9170/1



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.

\