Check your parentheses for the $ statement…
Renger
Von: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] Im Auftrag von Bharath K
Gesendet: Wednesday, February 11, 2015 16:18
An: gamsworld@googlegroups.com
Betreff: Re: access elements of a set to subset another set for writing equations
When I rewrite the equation as follow it gives errors. Is there a syntax guidance on usage?
eq1(g)… sum(t$(k(t) = g.val(g)), n(t)) =g= 10
Errors:
8 ‘)’ expected
10 ‘,’ expected
37 ‘=l=’ or ‘=e=’ or ‘=g=’ operator expected
148 Dimension different - The symbol is referenced with more/less indices as declared
Thanks!
Bharath
On Wednesday, February 11, 2015 at 2:02:14 AM UTC-6, Renger van Nieuwkoop wrote:
Hi Bharath
You could use g.val(g) which gives, if the set elements are numbers, the value of the element g
Cheers
Renger
Von: gams...@googlegroups.com [mailto:gams...@googlegroups.com] Im Auftrag von Bharath K
Gesendet: Tuesday, February 10, 2015 21:01
An: gams...@googlegroups.com
Betreff: access elements of a set to subset another set for writing equations
set G /1,4,17,18/;
set g(G);
set T;
set t(T);
param k(T);
param n(T);
equation eq1(G);
eq1(g)… sum(t$(k(t) = ord(g)) n(t) >= 10 works. But this creates 4 equations …
sum(t$(k(t) = 1), n(t)) >= 10
sum(t$(k(t) = 2), n(t)) >= 10
sum(t$(k(t) = 3), n(t)) >= 10
sum(t$(k(t) = 4), n(t)) >= 10
since ord(g) refers to position of an item in a set but I want the value of that element. How do I do that? I want
something like …
eq1(g)… sum over t such that k(t)=g) n(t) >= 10 which does not work
I want eq1(g) to spawn 4 equations …
sum(t$(k(t) = 1), n(t)) >= 10
sum(t$(k(t) = 4), n(t)) >= 10
sum(t$(k(t) = 17), n(t)) >= 10
sum(t$(k(t) = 18), n(t)) >= 10
Thanks
Bharath
–
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@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.
–
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.