Use a table for long list of string substitutions

I have a file which calls other gams files like so:

$call gams “Filename.gms” --scenario=worlda --variableA=low --variableB=medium --variableC=medium
$call gams “Filename.gms” --scenario=worldb --variableA=low --variableB=high --variableC=medium
$call gams “Filename.gms” --scenario=worldc --variableA=medium --variableB=medium --variableC=high

There are a lot of calls and a lot of string substitutions.

Is there any way I could shorten this? For example, is it possible to set it up so the string substitutions for each call appear in a different row of a table listed at the beginning of the file?


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/d/optout.

Josh,

What about using a GAMS model as a script that creates an include file with the $call lines at execution time:

$onechoV > createrun.gms
alias (*,s,a,b,c);
set run(s,a,b,c) /
worlda . low . medium . medium
worldb . low . high . medium
worldc . medium . medium . high
/
file fx / runme.gms /; put fx;
loop(run(s,a,b,c),
put ‘$call gams “Filename.gms” --scenario=’ s.tl:0
’ --variableA=’ a.tl:0
’ --variableB=’ b.tl:0
’ --variableC=’ c.tl:0 /);
$offecho
$call gams createrun lo=%gams.lo%
$if errorlevel 1 $abort problem with createrun. check createrun.lst

$include runme

Hope this helps,
Michael

On Sunday, February 22, 2015 at 7:04:36 PM UTC-5, Josh Craig wrote:


I have a file which calls other gams files like so:

$call gams “Filename.gms” --scenario=worlda --variableA=low --variableB=medium --variableC=medium
$call gams “Filename.gms” --scenario=worldb --variableA=low --variableB=high --variableC=medium
$call gams “Filename.gms” --scenario=worldc --variableA=medium --variableB=medium --variableC=high

There are a lot of calls and a lot of string substitutions.

Is there any way I could shorten this? For example, is it possible to set it up so the string substitutions for each call appear in a different row of a table listed at the beginning of the file?


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/d/optout.

OK I’ll give that a shot. Thanks again Michael!

On Monday, February 23, 2015 at 6:29:40 PM UTC+11, Michael Bussieck wrote:

Josh,

What about using a GAMS model as a script that creates an include file with the $call lines at execution time:

$onechoV > createrun.gms
alias (*,s,a,b,c);
set run(s,a,b,c) /
worlda . low . medium . medium
worldb . low . high . medium
worldc . medium . medium . high
/
file fx / runme.gms /; put fx;
loop(run(s,a,b,c),
put ‘$call gams “Filename.gms” --scenario=’ s.tl:0
’ --variableA=’ a.tl:0
’ --variableB=’ b.tl:0
’ --variableC=’ c.tl:0 /);
$offecho
$call gams createrun lo=%gams.lo%
$if errorlevel 1 $abort problem with createrun. check createrun.lst

$include runme

Hope this helps,
Michael

On Sunday, February 22, 2015 at 7:04:36 PM UTC-5, Josh Craig wrote:


I have a file which calls other gams files like so:

$call gams “Filename.gms” --scenario=worlda --variableA=low --variableB=medium --variableC=medium
$call gams “Filename.gms” --scenario=worldb --variableA=low --variableB=high --variableC=medium
$call gams “Filename.gms” --scenario=worldc --variableA=medium --variableB=medium --variableC=high

There are a lot of calls and a lot of string substitutions.

Is there any way I could shorten this? For example, is it possible to set it up so the string substitutions for each call appear in a different row of a table listed at the beginning of the file?


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/d/optout.