Originally posted by: Selectedbetter
In the C++ code of Benders Decomposition, the cut is defined in the part of IloBool separate(...){...}.
And in our question, the variable of the Master question is x[k][i][j].
When we define the left hand of the cut, we need to sum a part of j for a typical couple of k and i .
We tried like this:
IloExpr expr(env);
for(j=1;j<=N;++j)
{
expr+=x[k][i][j];
}
cutLhs += val[h] * (5-M*(1-expr));
expr.end();
But we got an error says"IloExpr& IloNumExpr::operator+=const IloIntVar arg: mixing mismatch Environments" .
Could anyone tell us how to correct or use other way to define the sum?
Thank you so much !
#CPLEXOptimizers#DecisionOptimization