loop index????

Hi All,
I need some help through this Error "Loop controlling index…"Error 50.
I can not remove this error, It means loop index should not be used in Equation???
My codes is as following :


SETS s /1119/;
.
.
.
EQUATIONS
const_w(s)
Objective;
.
.
.
.
MODEL Problem /All/;
PARAMETER WW(s) /11 200,12 400,13 60,14 800,15 100,16 120,7 1400,18 160,19 1800/;
Parameter res(
,s);
PARAMETER sayeh(s);
LOOP(s,
W=WW(s);
SOLVE Problem USING NLP MAXIMIZING Obj;
**** $50,256
.
.
.
.);


Thank you.
MANa


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/groups/opt_out.

\

Hi Mana

Le dimanche 21 juillet 2013 18:35:44 UTC+2, Mana_gms a écrit :

Hi All,
I need some help through this Error "Loop controlling index…"Error 50.
I can not remove this error, It means loop index should not be used in Equation???



Yes, that’s exactly what it means.

Out of two things, one is possible :

  • either you want to solve your model for each elements of the set S, and for each solve you just need one constraint CONST_W, the coefficients of which depend on the current set element S : in this case, you have to define a constraint CONST_W which is not indexed on S, but you adapt its coefficients in the loop, just like W = WW(s) ;

  • or you need, for each solve in the loop, to have all nine constraints over each possible value of S. Then you need to use aliases : define your constraint over S, as is. But then, before the loop, use :

ALIAS (S,S2) ;
LOOP(S2,
W = WW(S2);
SOLVE Problem…

which will avoid using the same index in the controlling loop and in the constraint definition.
Hope this helps,
cheers
dax


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/groups/opt_out.

\

Hi Dax,
Thank you for your help. It was really useful.
Mana

On Sunday, July 21, 2013 9:05:44 PM UTC+4:30, Mana_gms wrote:

Hi All,
I need some help through this Error "Loop controlling index…"Error 50.
I can not remove this error, It means loop index should not be used in Equation???
My codes is as following :


SETS s /1119/;
.
.
.
EQUATIONS
const_w(s)
Objective;
.
.
.
.
MODEL Problem /All/;
PARAMETER WW(s) /11 200,12 400,13 60,14 800,15 100,16 120,7 1400,18 160,19 1800/;
Parameter res(
,s);
PARAMETER sayeh(s);
LOOP(s,
W=WW(s);
SOLVE Problem USING NLP MAXIMIZING Obj;
**** $50,256
.
.
.
.);


Thank you.
MANa


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/groups/opt_out.

\