Originally posted by: mrmag
Dear all,
I have a problem with realizing the branch-and-cut method in CPLEX with the multiple reiterations on one particular node. The idea is the following. I have defined the model in main() and specified UserCut. In the UserCut function I generate a cut based on the values of the fractional variables and add it into the formulation. After that CPLEX resolves the LP-relaxation and goes to the branching procedure, namely to the next node. And here is the problem. Is it possible to stay in the same node and add cuts/resolve LP-relaxation until no cut which is broken, exists?
Thank you in advance!
I use the following code:
ILOUSERCUTCALLBACK1
(UserCut, IloBookVarArray&, vars
) {
IloNumArray vals;
IloNumArray obj;
IntegerFeasibilityArray feas;
try {
vals = IloNumArray(env);
obj = IloNumArray(env);
feas = IntegerFeasibilityArray(env);
getValues(vals, vars);
getObjCoefs(obj,vars);
getFeasibilities(feas, vars);
// check vals, generate a cut (lhs,rhs) and add it
IloRange cut;
cut=(lhs<=rhs);
add(cut).end();
}
catch (IloException& e) {
cout << "Concert exception in NonOverlap: " << e << endl;
}
catch (string exs) {
cout << exs << endl;
}
vals.end(); obj.end(); feas.end();
return;
}
int main(int argc, const char *argv[]) {
IloEnv env;
IloModel model(env);
IloBoolVarArray vars(env);
for (int i=0; i<m; i++) {
for (int j=0; j<m; j++) {
IloBoolVar var(env,cname);
vars.add(var);
}
}
// define model model ...
IloCplex cplex(model);
cpclex.setParam(IloCplex::MIPSearch, IloCplex::Traditional);
cplex.use(UserCut(env,vars));
cplex.solve();
} // END main
#CPLEXOptimizers#DecisionOptimization