Originally posted by: SystemAdmin
[claud10 said:]
Hi, I'm trying to realize how to include NodeData information during the branch callback for use in the cut callback. Mainly, the C++ structure cplex uses I do not get it 100% (My background is mainly in maths more than CS). For simplifying the reading, supose that I have already implemented a subclass of NodeData called MyNodeData. I have a constructor that receives one extra parameter (vector<IloRange> V), as well as two functions, get() (that returns an object of the class IloRange) and empty() (that is true if the vector V is empty).
In the BranchCallback I do
NodeData* MND1 = new (getEnv()) MyNodeData(IR1);
NodeData* MND2 = new (getEnv()) MyNodeData(IR2);
makeBranch(z[i] <= 0, objval1, MND1);<br />makeBranch(z[i] >= 1, objval2, MND2);
while in the cut callback I have tried several combinations but I do not get the good one. The one I wrote now is
NodeData* ND = getNodeData();
if(ND != 0)
{
MyNodeData* MND = (MyNodeData*) ND;
while(!(*MND).empty())
{
IloRange rng((*MND).get());
add(rng);
}
ND = 0;
return;
}
The error I get is
Exception: CPLEX Error 1200: Index is outside range of valid values
And this error appears just after calling the function getNodeData().
Thanks for your help,
Claudio
#CPLEXOptimizers#DecisionOptimization