Assignment from different set

Hello, all,

I met a small issue need people’s help.

I have a parameter M(g) which is value is given.

And I have another P(t) and I want to assign to M(‘g1’) into P(t).

I wrote P(t)=M(g)$(ord(g) eq 1);

the GAMS feed back the message " uncontrolled set entered as constant"

What is the right syntax to assign the value from different set?

\

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.

Hi Gary



You could write P(t)=sum(g$ord(g) eq 1), M(g));

You assign something to a parameter over a set t, but on the right hand side, you use g. If you write it your way, Gams has to be told to loop over all g and pick the one where the dollar condition is met.

So you could write it also like this



Loop(g$ord(g) eq 1), P(t)= M(g));



Here you restrict the loop over the first element and all values of P get the same value of M



Hope this helps

Renger



From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Gary
Sent: Montag, 11. Mai 2015 00:57
To: gamsworld@googlegroups.com
Subject: Assignment from different set



Hello, all,



I met a small issue need people’s help.



I have a parameter M(g) which is value is given.



And I have another P(t) and I want to assign to M(‘g1’) into P(t).



I wrote P(t)=M(g)$(ord(g) eq 1);



the GAMS feed back the message " uncontrolled set entered as constant"



What is the right syntax to assign the value from different set?




\

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.


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.