0

I am trying to make a matrix (currently as a table) in which I have constant values and values depending on a decision variables defined later. It kind looks like this:

table g(i,j) limits
     1    2
1    1    0.5*x("1",j)
2    1    0.5*x("2",j);

positive variables
x(i, j) number of workers in skill level i in period j
t(i, j) number of retraining of worker in skill level i period j

equations

t(i, j) =L= g(i,j)

Now obviously this doesn't work and I can't figure out a solution how to do it. Is there actually a way to use decision variables in such a way in gams? In principle, I just want to make a nice matrix in which I can store them for later use in the equations.

Hope that anyone can help me.

mpromonet
  • 11,326
  • 43
  • 62
  • 91
Sebastian E
  • 135
  • 5

1 Answers1

1

There is no way to mix up variables and parameters (or tables) in the definition. Because parameters (or tables) are constant and shouldn't contain a variable part. So you basically you can't make a nice and clear matrix - you've to connect the variable to the parameters in the equation part, with something like:

t(i, j) =L= g(i,j)*x(i, j)

If your matrix is more complex and not every colum or row is associated with the variable(like your example),you can probably use conditionals for a more clear formulation of your model, like:

con1(i,j)$(ord(i) eq 2)..
t(i, j) =L= g(i,j)*x(i, j)

con2(i,j)$(ord(i) eq 1)..
t(i, j) =L= g(i,j)

for not appending the x to the first colum of the table.

Paul G.
  • 632
  • 6
  • 16