I have a set of constraints like:
x1 >= x2 + x3 + x4; x2>= x3 + x4 + x7; x3 >= x4 + x5; and so on.
For each variable, there is an array that stores the list of variables that will be used in the constraint RHS. That is, for variable 1, the array includes array[1] = {2, 3, 4}. To implement this in c++, I used IloNumExpr, but it did not work:
IloNumExpr Constraint(env);
for (int i = 0; i < 3; i++){
for(int j = 0; j < array_size[i]; j++)
{
Constraint += x[array[i][j]];
}
model.add(x[i] >= Constraint);
}
What is the mistake that I am doing here?
Thanks