1

I have this situation in GAMS:

sets
   i index of resource location  /i1*i6/
   j index of disaster location  /j1*j7/
;

...

binary variable x(i,j);

parameter 
   M(j)  /j1 5,j2 4,j3 6,j4 7,j5 6,j6 2,j7 1/
   ch(i) /i1 10,i2 5,i3 10,i4 15,i5 6,i6 12/
;
...

equations 
...

co8(i) 
;

co8(i)..M(j)=l=sum(j,ch(i)*x(i,j));  

and co8(i) give me the error 149 Uncontrolled set entered as constant.

I searched,but I did not find solution. How can I fix it?

thanks

Lutz
  • 2,197
  • 1
  • 10
  • 12
n.e
  • 83
  • 1
  • 8

1 Answers1

1

The j in M(j) is not controlled. So, it depends on what you want to do, how to fix this. E.g. if you want a sum over all j, you should add that sum (sum(j,M(j))). Or do you want this equation for every j? Then adjust the declaration and definition accordingly.

Lutz
  • 2,197
  • 1
  • 10
  • 12
  • Thanks,I want this equation for every j. how to fix it? – n.e Dec 13 '19 at 13:33
  • Declare and define it as `co8(i,j)`. Though, you will get errors for the RHS, since you cannot define the equation for every `j` and sum over all `j`s at the same time. If you want to do that, you need to introduce an Alias for `j` (see: https://www.gams.com/latest/docs/UG_SetDefinition.html#INDEX_alias_22_statement) – Lutz Dec 13 '19 at 14:23