How do I set the values of a multidimensional parameter step by step (to implement a cutting plane approach)?

Hi everyone,

first of all: I am new to GAMS and have only worked with OPL/CPLEX before but was not required to switch languages due to preferences of my professor.
I am currently dealing with the task of implementing a cutting plane approach for solving an LP. This means that I

  • solve a subproblem
  • evaluate the results
  • add a cutting plane (i.e. a constraint) to my problem
  • loop until an ending condition is met.

I was able to implement a few simpler problems on my own, but am now struggling with this task. The problem is that I do not know how to define a parameter step by step.
I have defined a set

Set
j
/j1 * j3/

parameter

Parameter all_g(*, j);

that has two dimensions: the first dimensions is the number of the current iteration and the second dimension is the number of dimensions that my parameter that I compute in every iteration has. In every iteration I compute one

Parameter g(j) Subgradient

like this and count up the number of iterations passed in a variable, say

Scalar k /1/;

and this scalar is incremented by 1 in each iteration.

What I need to do now is to add the computed single parameter g(j) to the “set of parameters” all_g(*,j) so what I’d like to do is something like

all_g(k, j) = g(j);

in each iteration. However, I do not manage to get this kind of expression running, there’s always a ton of errors turning up and the documentation is not really helpful at all.

Can anybody tell me what my mistake is or how I might implement such an iterative approach in GAMS?

Thanks in advance!

Hi
You could define a set i for the number of iterations. ALthough you don’t know the maximum number of iterations, you can set it to a very high number, e.g.:

set i Iterations /1*1000/

Then you can use your assignment as follows:

parameter itnr Iteration number /0/;

while(...
itnr = itnr + 1;
....
all_g(k, j)$(ord(k) = itnr) = g(j);

I am not sure, if this is what you are looking for. Otherwise, just post your complete code and I have a look at it.
CHeers
Renger