Hi Julia
In general there seems to be a lot of misunderstanding on using sets in equations.
Keep in mind:
-
If a set is named in the definition of the equation, this set should appear in the equation.
-
Do not use the set name over which the equation is defined for operations like summing in the equation itself. Instead use an alias for the set.
Your equations conflict with both rules:
The first problem (Error 125):
Equationone(i,j)… sum(i,x(i,j)) =e= d(i,j) ;
This equation is in conflict with principle 2: you defined the equation over I and j and in the equation itself you sum over i. This would only work if you defined an alias for I and sum over this alias:
alias(I, ai);
Equationone(i,j)… sum(ai,x(ai,j)) =e= d(i,j) ;
Now both principles are fine: you define over I and j, both indices appear in the equation and you don’t do an operation like summing using the set name of the definition.
The second problem equation (error 147) conflicts with principle number 1 (and eventually with number 2 depending on the correction):
Equationone(j)… sum(i,x(i,j)) =e= d(i,j) ;
You define the equation over j, but in the equation itself you have the index I, which appears in d(I,j). (It also appears in the summation, but this would be OK as I it is not mentioned in the equation definition).
This would work if, you either define the definition over I as well as j (and then use the trick for the summation with alias) or if you sum over d(i.j) over i.
Hope this helps
Cheers
Renger van Nieuwkoop
Modelworks
Gewerbestrasse 15
3600 Thun – Switzerland
+41 79 818 53 73
Info@modelworks.ch
blog.modelworks.ch
Von: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] Im Auftrag von Julia
Gesendet: Donnerstag, 22. November 2012 16:42
An: gamsworld@googlegroups.com
Betreff: error 125 and error 149
Hello,
I’ve got a problem with the definition of sets. If an equation has a sum and a constant paramter, I don’t know how to control the sets. For example:
error 125: set is under control already, when
Equationone(i,j)… sum(i,x(i,j)) =e= d(i,j) ;
Equationtwo(i,j)… sum(j,x(i,j)) =e= d(i,j) ;
error 149: uncontrolled set entered as constant, when
Equationone(j)… sum(i,x(i,j)) =e= d(i,j) ;
Equationtwo(i)… sum(j,x(i,j)) =e= d(i,j) ;
The same problem appears for this equation:
TourMax(i,j)… x(i,j)*(sum(i,s(i))+sum((i,j),t(i,j))) =l= durmax
How do I define the sets in those cases (a constant set and a sum)?
–
To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/Z_Z_97N3gjYJ.
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.
–
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.