if-statement

Dear community,
by trying to run the following source-code…:


set i /1 * 3/ ;

parameter Ton(i)
/1 5
2 7
3 9/;

parameter x(i);
x(i) = ord(i);

scalar crit;
crit=1;

variable ON(i);
ON.fx(i)=5;

if( ON.l(i)$(x(i)=crit) >= Ton(i), );


…I always get the Error 149 (Uncontrolled set entered as constant):
18 if( ON.l(i)$(x(i)=crit) >= Ton(i), );
**** $149 $149 $149.

Does anybody know what I can do?!

Thanks in advance!!


–~–~---------~–~----~------------~-------~–~----~
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 cannot define the set ‘i’ on its own.

Try this one:

If ( sum(i$(ord(i)=crit),ON.l(i)) >= Ton(i), ):

This way, you sum over set ‘i’ so that it is now controlled but fix it at the desired element using the $ condition.

  • Yogendra.

On Wed, Aug 5, 2009 at 7:21 AM, tobster wrote:


Dear community,
by trying to run the following source-code…:


set i /1 * 3/ ;

parameter Ton(i)
/1 5
2 7
3 9/;

parameter x(i);
x(i) = ord(i);

scalar crit;
crit=1;

variable ON(i);
ON.fx(i)=5;

if( ON.l(i)$(x(i)=crit) >= Ton(i), );


…I always get the Error 149 (Uncontrolled set entered as constant):
18 if( ON.l(i)$(x(i)=crit) >= Ton(i), );
**** $149 $149 $149.

Does anybody know what I can do?!

Thanks in advance!!





–~–~---------~–~----~------------~-------~–~----~
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
-~----------~----~----~----~------~----~------~–~—

Dear all members,

I have a problem with if-statement and I get “uncontrolled set entered as constant” error when I want to control and compare the value of a set"l" with value of another set. As following:
i , j and l are my sets
d(i,j) distance between i and j
Set i /n1n6/
l /1
6/;
If (d(i,j) = R(l),
If d(i,j)= R(“4”),
l_opt(i,j)=Etx(“5”);
elseif d(i,j)= R(“3”),
l_opt(i,j)=Etx(“4”);
);
Does anyone can help?


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.