Originally posted by: SystemAdmin
I am not used to the Java API, so I discuss C here instead. I hope that it is relatively easy to translate this to Java.
Here is the relevant part from the C API documentation:
ILOG CPLEX calls the solve callback before ILOG CPLEX solves the subproblem defined by the current node. The user can choose to solve the subproblem in the solve callback instead by setting the user action argument of the callback. The optimization that the user provides to solve the subproblem must provide a CPLEX solution. That is, the Callable Library routine CPXgetstat must return a nonzero value. The user may access the lp pointer of the subproblem with the Callable Library routine CPXgetcallbacknodelp.
In other words: the solve callback provides a way to use an alternative algorithm to solve the LP relaxation at the current node. But in the end you have to install this solution into the CPLEX LP solver.
This means, you cannot solve a different relaxation; you can only use a different algorithm to solve the LP relaxation. For example, you could implement some algorithm based on decomposition that has nothing to do with the simplex algorithm to find a solution to the LP relaxation. Then, you would use this solution as a warm start for CPLEX primal or dual simplex (in Java by means of setvectors()), and finally call the simplex solver to construct the necessary solution information inside CPLEX. Ultimately, everything you do in the solve callback is just a way to provide a good (or even optimal) starting point for the CPLEX LP solver in the hope that this combination will solve the nodelps faster than the standard dual simplex.
If you really want to use a different relaxation than the canonical LP relaxation for your problem, you need to use a different framework. CPLEX is really hard-wired to the LP relaxation. SCIP can use other relaxation types, at least in the newer versions of SCIP. Gerald Gamrath from ZIB successfully implemented a Dantzig-Wolfe decomposition which I think should in principle be similar to what you want to do. You may want to ask him directly or post your question again on the SCIP mailing list.
You say that you want to solve the LP-relaxed problem by your solve callback. If this is true, then you can use CPLEX. As far as I understand the Java API, you need to first call setVectors(), then solve(), and then useSolution(). Maybe, you just forgot the solve() call.
Since the object oriented APIs always work in the original problem space, I think that you cannot access the nodelp (which is defined in the presolved space). This would be needed to query the branching decisions (just compare the local bounds to the global bounds). But as I said, I do not know the Java API very well. Maybe, someone else can jump in and give you some more hints. It could be that you need to switch to the C API in order to be able to query the branching decisions. In C, this is definitely possible.
Hope this helps,
Tobias
#CPLEXOptimizers#DecisionOptimization