Originally posted by: open_ball
Hi,
I take BendersATSP2 as a reference to implement Benders Decomposition. In invoke method, when I use getCandidatePoint to obtain the estimation of dual objective, I receive an error.
Before adding a lazy cut, I check whether the artificial variable used to estimate dual objective is larger than the actual objective (i.e., maximization). That's why I try to access that value.
The code successfully access the value of variables defined in master problem. In the next step, I receive an error.
In the main method, I define the artificial variable as: "final IloNumVar estObj =null;"
Then, I create the master problem createMasterILP(masterCplex, x , estObj, numNodes, adjacencyList);
Lastly, I attach the callback function;
int numThreads = masterCplex.getNumCores();
final BendersPPINCallback cb = new BendersPPINCallback(x,estObj, adjacencyList, numThreads);
long contextmask = IloCplex.Callback.Context.Id.Candidate
| IloCplex.Callback.Context.Id.ThreadUp
| IloCplex.Callback.Context.Id.ThreadDown;
masterCplex.use(cb, contextmask);
This is a code block where I get the values from the candidate point.
double[] xSol = new double[numNodes]
double Estimation =0;
if ( context.inCandidate() ) {
if ( !context.isCandidatePoint() ) // The model is always bounded
throw new IloException("Unbounded solution");
for (int i = 0; i < numNodes; ++i) {
xSol[i] = context.getCandidatePoint(x[i]);
}
try {
Estimation = context.getCandidatePoint(estObj);
}finally {
System.err.println("Error is here!");
}
This is the error that I receive.
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.
Root node processing (before b&c):
Error is here!
Real time = 0.00 sec. (0.00 ticks)
Parallel b&c, 4 threads:
Real time = 0.00 sec. (0.00 ticks)
Sync time (average) = 0.00 sec.
Wait time (average) = 0.00 sec.
------------
Total (root+branch&cut) = 0.00 sec. (0.00 ticks)
Exception in thread "main" ilog.cplex.CpxException: CPLEX Error 1006: Error during callback.
at ilog.cplex.CplexI.CALL(CplexI.java:4969)
at ilog.cplex.CplexI.setStatus(CplexI.java:6301)
at ilog.cplex.CplexI.access$500(CplexI.java:120)
at ilog.cplex.CplexI$SolveHandle.stop(CplexI.java:2941)
at ilog.cplex.CplexI.solve(CplexI.java:2964)
at ilog.cplex.IloCplex.solve(IloCplex.java:10254)
at BendersPPIN.main(BendersPPIN.java:218)
#CPLEXOptimizers#DecisionOptimization