Hi,

I'm implementing a two-phase method in CPLEX OPL.

I would like to create a set containing the unitary values of a variable obtained during my initial phase. I make a getValue(X) to recover the optimal values for that boolean variable indexed in i,j,k. Later, inside a double loop on indices "j" and "k" I try to declare the set of the unitary values of X along the i-dimension.

However, I fail to make a proper set declaration... I've already tried using:

var S = {i | i in I : X[i][j][k] == 1};

int S = {i | i in I : X[i][j][k] == 1};

{int} S = {i | i in I : X[i][j][k] == 1};

But I always get the error: "Illegal use of a reserved keyword". I know that my set declaration isn't good but have no idea of how to declare it in order to have my set S containing the values of I for which X[i][j][k] == 1.

Could you please provide some help?

Best regards

More Yasser Valcarcel's questions See All
Similar questions and discussions