0

I have been trying to do the below code, which attempts to set the upper bound of every element of set J to 3.

set J /a1, a2, a3/;
positive variables b(J);
variable obj;

equations cons1, goal;

cons1..
b.up(J) =e= 3;

The rest of the GAMS code just runs the model. However, the generated error statement says "Uncontrolled set entered as constant". I have also tried "b.up(J) = 3;" -- Get the same problem. Does anyone know how to solve this? This problem is similar (How to set upper and lower bounds for each element in a set?), but is actually not my solution.

django_moose
  • 355
  • 1
  • 4
  • 10

1 Answers1

2

You can define upper bounds in two ways: Formulating an equation or using the .up suffix. You mixed the two ways which causes problems.

This is the first way, defining an equation:

Equation cons1(J);
cons1(J)..
b(J) =l= 3;

If you use the suffix approach (which is the niceer one), you should not use an equation, just do:

b.up(J) = 3;
Lutz
  • 2,197
  • 1
  • 10
  • 12