1

I have this situation in GAMS:

Sets
         i       mina  / m1, m2 / ;

Parameters
         k(i)  non important description
         /       m1       10
                 m2       20 /;


Variables
         x(i)  non important description;

Equations
         r1    non important description;

r1 ..            x(i) =l= k(i);

and r1 give me the error 149 Uncontrolled set entered as constant.

What can I do to fix it? I've searched all around but nothing makes sense, x(i) and k(i) have the same dimentions, I just want to say that x(i) <= k(i) for all i.

Daniel
  • 7,357
  • 7
  • 32
  • 84

1 Answers1

2

You need to declare and define your equation differently to say, that you want it for all i and not just once. Do it like this:

Equations
         r1(i)    non important description;

r1(i) ..            x(i) =l= k(i);
Lutz
  • 2,197
  • 1
  • 10
  • 12
  • Does this work for 2 variables? For example, if I have two matrices A and B with same dimension and I want to make a constraint that every `A(i,j) <= B(i,j)`, would this be right: `Equations r2(i,j)` and `r2(i,j) .. A(i,j) =l= B(i,j)` ? – Daniel Oct 19 '18 at 16:59
  • Yes, it works that way. Maybe this is interesting for you: https://www.gams.com/latest/docs/UG_Equations.html#UG_Equations_Definition_Indexed – Lutz Oct 22 '18 at 06:52