Originally posted by: Lessi
I'm not sure why but the problem still appears. I sent you an email to your ibm account to ask for help because I sent you the whole code. Now, some nodes are being checked repeatedly.
we stop branching here because of infeasible POIs: 2 4 6 at the node 466
we stop branching here because of infeasible POIs: 2 6 8 21 49 at the node 638
we stop branching here because of infeasible POIs: 2 6 8 21 57 at the node 650
we stop branching here because of infeasible POIs: 2 4 6 at the node 466
we stop branching here because of infeasible POIs: 2 6 8 21 49 at the node 638
we stop branching here because of infeasible POIs: 2 6 8 21 57 at the node 650
This is the code template :
ILOBRANCHCALLBACK0(stopBranching)
{
if (this->getBestObjValue() < slnBest + 1 && this->getObjValue() < slnBest + 1)
{
this->abort();
return;
}
if (this->getObjValue() < slnBest + 1)
{
nbReject++;
this->prune();
return;
}
IloNumArray lbYmaster(this->getEnv());
IloNumArray ubYmaster(this->getEnv());
this->getLBs(lbYmaster, yMaster);
this->getUBs(ubYmaster, yMaster);
IloNumArray y_valBC(this->getEnv(), ttdp.N);
vector<int> fixedNodes;
long long h = 0;
for (int i = 0;i < ttdp.N;i++)
if (lbYmaster[i] == 1 && ubYmaster[i] == 1)
{
y_valBC[i] = 1;
fixedNodes.push_back(i);
}
else
y_valBC[i] = 0;
if (fixedNodes.size() == 2)
return;
updateSlaveModel(y_valBC);
cplexSlave.solve();
if (cplexSlave.getStatus() == IloAlgorithm::Infeasible)
{
cout << "we stop branching here because of infeasible POIs: ";
for (int i = 1;i + 1 < ttdp.N;i++)
if (y_valBC[i] == 1)
cout << i << " ";
cout << "at the node " << this->getNodeId() << endl;
nbReject++;
this->prune();
return;
}
}
/Lessi
#CPLEXOptimizers#DecisionOptimization