Originally posted by: Lessi
I have three callbacks:
cplexMaster.use(feasibilityCheck(env));
cplexMaster.use(lazyconstraintCallback(env));
cplexMaster.use(removeViolatedCandidate(env, violatedCandidate));
In the feasiblityCheck callback, I have the following piece of code wherein I want to call two other callbacks
if (cplexSlave.isPrimalFeasible())
{
cout << "Has a feasible solution with value = " << this->getObjValue() << endl;
slnCount++;
slnBest = max(slnBest, this->getObjValue());
feasibleCut = true; => I want to call the lazy cut here
infeasibleCut = false;
//exit(0);
}
else
{
cout << "It is not a good candidate" << endl;
infeasibleCut = true; => I want to call the lazy cut callback here
feasibleCut = false;
violatedCandidate.clear();
for (int i = 1;i + 1 < ttdp.N;i++)
if (y_val[i] == 1)
violatedCandidate.push_back(i);
}
------------------------------------------------
This is the log I have, the lazycut have not been called yet.
Total (root+branch&cut) = 0.00 sec. (4.41 ticks)
Has a feasible solution with value = 270 => here I have a feasible solution with objective value = 270, so I do not want to enumerate solutions with objective value < 270.
Nodes Cuts/
Node Left Objective IInf Best Integer Best Bound ItCnt Gap Variable B NodeID Parent Depth
* 0 0 integral 0 270.0000 270.0000 1 0.00%
Root node processing (before b&c):
Real time = 0.01 sec. (4.79 ticks)
Sequential b&c:
Real time = 0.00 sec. (0.00 ticks)
------------
Total (root+branch&cut) = 0.01 sec. (4.79 ticks)
Populate: phase II
Lazy constraint(s) or lazy constraint callback is present.
Disabling dual reductions (CPX_PARAM_REDUCE) in presolve.
Disabling non-linear reductions (CPX_PARAM_PRELINEAR) in presolve.
MIP emphasis: balance optimality and feasibility.
MIP search method: traditional branch-and-cut.
Parallel mode: none, using 1 thread.
We have a solution with value 270
Reject an incumbent
Nodes Cuts/
Node Left Objective IInf Best Integer Best Bound ItCnt Gap Variable B NodeID Parent Depth
0 2 270.0000 1 270.0000 270.0000 1 0.00% 0 0
Elapsed time = 0.01 sec. (4.95 ticks, tree = 0.01 MB, solutions = 1)
We have a solution with value 60 => it means that the lazycutcallback has not been called yet.
Reject an incumbent
We have a solution with value 230
Reject an incumbent
We have a solution with value 40
Reject an incumbent
We have a solution with value 20
Reject an incumbent
We have a solution with value 0
Reject an incumbent
-----------------------------------
Thank for your help.
/Lessi
#CPLEXOptimizers#DecisionOptimization