how to use variable as set element?

I have a xy-coordinate. x from 0 to 100 and y from 0 to 100. On each point (x,y), there is a number n(x,y).

then I want to find several points, which has the biggest sum of n(x,y).

I plan to design the program roughly as below:

set x /0100/;
y /0
100/;
table n(x,y);
variable a, b;
equation 1;
1…sumn = n(a,b)+n(a+1,b+1);



However, gams do not accept n(a,b). Is there a way to realize the problem?

Thanks.


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.

On Wednesday, March 19, 2014 4:14:50 PM UTC-5, miner wrote:

I have a xy-coordinate. x from 0 to 100 and y from 0 to 100. On each point (x,y), there is a number n(x,y). for example

n(0,0)=1, n(0,1)=3, n(0,2)= 5, …
n(1,0)=4, n(1,1)=2, n(1,2)=11,…



then I want to find three points (x1,y1), (x2,y2), (x3,y3), which the sum of n(x1,y1) +n(x2,y2)+n(x3,y3) is largest.

I plan to design the program roughly as below:

set x /0100/;
y /0
100/;
table n(x,y);
variable x1,x2,x3,y1,y2,y3;
equation 1;
1…sumn = n(x1,y1)+n(x2,y2)+n(x3,y3);



However, gams do not read n(x1,y1). Is there a way to realize the problem?

Thanks.


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.