Thank you very much!
I now understand what “alias” is used for.
Thanks!
On Tuesday, January 8, 2013 11:56:10 AM UTC-3, Renger van Nieuwkoop wrote:
Hi Lucy
Try this
Set i /i1*i3/;
alias(i,j);
parameter x(j), tot;
- Give x(j) some values:
x(j) = 1;
tot = Sum(i, sum(j$(ord(j) LE ord(i)), x(j)));
display tot;
Cheers
Renger
Modelworks
Gewerbestrasse 15
3600 Thun - Switzerland
+41 79 818 53 73
In…@modelworks.ch
blog.modelworks.ch
From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of Lucy N
Sent: Dienstag, 8. Januar 2013 14:56
To: gams...@googlegroups.com
Subject: Nested summation on same set
Hello, I need help for my GAMS program.
I want to do a nested summation on the same set, as follows:
sum(i in 1…n, sum(j in i…n, x_j))
I hope you understand the summation. It is a double summation where the first index (i) goes from 1 to n, and the second index goes from i to n.
In gams I defined the set 1…n as T (it is a temporal set), and I don’t know how to write the second summation.
I hope you can help me.
Thank you very much
To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/hyIfVVZyiysJ.
To post to this group, send email to gams...@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.
–
To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/yjGJ10n2tpEJ.
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.