GAMS中索引为“ i”和“ i + 1”的求和

时间:2018-06-29 11:47:18

标签: gams-math

我不知道如何在GAMS中编写此求和,因为它的索引的差为一。

我的意思是我有索引 i i + 1 。对于“ i = 1,.. 54;

i,j是集合,a(i),b(i),c是参数,x,y是变量

sum(j, a(i)*x(i,j))-b(i)*y(i)+ c * (sum(j, a(i+1)*x(i+1,j))-b(i+1)*y(i)) <= 136

换句话说,我想拥有

 sum(j, a(1)*x(1,j))-b(1)*y(1)+ c * (sum(j, a(2)*x(2,j))-b(2)*y(2) )<= 136

 sum(j, a(3)*x(3,j))-b(3)*y(3)+ c * (sum(j, a(4)*x(4,j))-b(4)*y(4) )<= 136
 .
 .
 .


 sum(j, a(53)*x(53,j))-b(53)*y(53)+ c * (sum(j, a(54)*x(54,j))-b(54)*y(54) )<= 136

1 个答案:

答案 0 :(得分:0)

那呢?

eq1(i)$mod(ord(i),2).. sum(j, a(i)*x(i,j))-b(i)*y(i)+ c * (sum(j, a(i+1)*x(i+1,j))-b(i+1)*y(i)) =L= 136;