Any help with my problem would be greatly appreciated.
I have sets, variables, an equation, and other things which are irrelevant to this question
SETS J months /1*12/
I type /1,2/;
VARIABLES
X(I,J)
Y(I,J);
EQUATION
CONSCOND(J) conservation condition;
CONSCOND(J)… X(‘1’,J) + X(‘2’,J) + Y(‘2’,J-1) - Y(‘1’,J) - Y(‘2’,J) =E= 0;
My question is in regard to the equation. I want to limit the defined equations for J >= 2 so that CONSCOND(1) is not defined. From my reading, I thought that the following should work:
CONSCOND(J)$(J >= 2)… X(‘1’,J) + X(‘2’,J) + Y(‘2’,J-1) - Y(‘1’,J) - Y(‘2’,J) =E= 0;
I cannot get the $ operator to work for me in this way.
–
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 Bryan
j is a set and set elements are not numbers, just character strings. So if you want to use it as a number you can either use j.val (which, in case the j-elements are numerical values, changes the set element to a number) or you use ord(j) which gives you the order of the element in the set.
Hope this helps
Renger
\
Modelworks
Gewerbestrasse 15
3600 Thun – Switzerland
+41 79 818 53 73
Info@modelworks.ch
blog.modelworks.ch
From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Bryan Arguello
Sent: Donnerstag, 24. Oktober 2013 05:32
To: gamsworld@googlegroups.com
Subject: Trouble with $ operator in my model
Any help with my problem would be greatly appreciated.
I have sets, variables, an equation, and other things which are irrelevant to this question
SETS J months /1*12/
I type /1,2/;
VARIABLES
X(I,J)
Y(I,J);
EQUATION
CONSCOND(J) conservation condition;
CONSCOND(J)… X(‘1’,J) + X(‘2’,J) + Y(‘2’,J-1) - Y(‘1’,J) - Y(‘2’,J) =E= 0;
My question is in regard to the equation. I want to limit the defined equations for J >= 2 so that CONSCOND(1) is not defined. From my reading, I thought that the following should work:
CONSCOND(J)(J >= 2).. X('1',J) + X('2',J) + Y('2',J-1) - Y('1',J) - Y('2',J) =E= 0;
\
\
\
I cannot get the operator to work for me in this way.
\
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.
–
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.