Inline evaluation question v21.5
Inline evaluation question v21.5
Hi
Using gams v21.5
Is there a way to get inline evaluation (correct term?) of a parameter
so I can use the value of that parameter to do things like set a
global value or in a set declaration.
As a dummy example:
parameter myValues(*);
myValues("1") = 10;
myValues("2") = 20;
myValues("3") = 30;
$setglobal g_ten myValues("1");
set sTwentyToThirty
/ myValues("2") * myValues("3") /;
If this is not possible how do I get around this?
I tried using $batinclude but it is passing "myValues("1")" etc at %1,
%2 %3 and not the *value* stored in myValues("1")
Thanks
AndyC
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Re: Inline evaluation question v21.5
Andy,
You cannot use runtime data like myValues to change compile time
behavior of GAMS. The GAMS way is to have a superset
set s / 1*100/
and then define the sets like sTwentyToThirty as dynamic sets:
set sTwentyToThirty(s);
set sTwentyToThirty(s) = myValues("2") wrote:
> > Hi
> >
> > Using gams v21.5
> >
> > Is there a way to get inline evaluation (correct term?) of a parameter
> > so I can use the value of that parameter to do things like set a
> > global value or in a set declaration.
> >
> > As a dummy example:
> >
> > parameter myValues(*);
> > myValues("1") = 10;
> > myValues("2") = 20;
> > myValues("3") = 30;
> >
> > $setglobal g_ten myValues("1");
> > set sTwentyToThirty
> > / myValues("2") * myValues("3") /;
> >
> > If this is not possible how do I get around this?
> >
> > I tried using $batinclude but it is passing "myValues("1")" etc at %1,
> > %2 %3 and not the *value* stored in myValues("1")
> >
> > Thanks
> > AndyC
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---