Upper bound summation GAMS

669 views
Skip to first unread message

inma.moll

unread,
Apr 24, 2011, 12:54:25 PM4/24/11
to gamsworld
Hi,

Can I put an upper bound summation?
for example:
sum(i, start i=1 to n) * prod(j, start j=1=start to i) Aj= A1 + A1*A2
+ A1*A2*A3 +.... +A2*A2*...*An

zahra adel

unread,
Apr 27, 2011, 2:40:14 AM4/27/11
to gams...@googlegroups.com
Well, first of all in GAMS sets are different from numbers. When you define "i" as a set, you can never use an expression like "i<3" or "i<n". Instead you may use "ord(i)" (Ord(i) returns the number of the element being referenced relative to the total number of elements in the set) as a counter.
Besides, You can use conditional structure for upper or lower bounds. for example, instead of
"sum(i, start i=1 to n,...)" you may write "sum( i$( ord(i)<n) ,...)" which means:" sum over set i if ord(i) is less than n".
I hope it helps you.
Zahra.


From: inma.moll <inma...@yahoo.es>
To: gamsworld <gams...@googlegroups.com>
Sent: Sun, April 24, 2011 8:24:25 PM
Subject: Upper bound summation GAMS
--
You received this message because you are subscribed to the Google Groups "gamsworld" group.
To post to this group, send email to gams...@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsub...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

Reply all
Reply to author
Forward
0 new messages