Hi Greg

If I understand correctly, you want to make a summation on the value of the set â€œiâ€. If that is correct, the problem with that is that the sets are by definition a string. One way to do it is by creating an auxiliary parameter like the code below. There may be an easier way to do it, but this is the one I know.

parameter Ini(i) ;

Ini(‘1’)=1;

loop(i, ini(i+1)=ini(i)+1 );

SumA(i)=sum(i,ini(i));

Regards

Jose

From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of babak saleckpay

Sent: jueves, 10 de marzo de 2011 01:53 a.m.

To: gamsworld@googlegroups.com

Subject: Re: Summation Imdexing

hi

can you explain more, maybe i can help you.

you want to sum on elements of your set?

On Thu, Mar 10, 2011 at 1:13 AM, Greg K wrote:

Hi all,

I am a new user of GAMS and still trying to get all the tricks. I have

the following (hopefully easy) problem.

I have a set set(k), where k is / 0*299 /

I try to define in a simple and fast way 600 sums as following.

Pseudo-code:

For n = 0 to 299

define sumA(n) = sum (i (from 0 to n), set(i))

define sumB(n) = sum (i (from n to 299), set(i))

next n

Is there an easy way to do it without defining 600 subsets?

Thanks in advance.

## Babak Saleck Pay

M.Sc

Socio-Economic System Engineering

Group of Industrial Engineering

University of Tehran

Tehran,Iran

\

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.