Search code examples
javacplexdecompositiongeneric-callback

Accessing branch-and-cut node id in generic Cplex callback


I have an optimization problem that is decomposed using Benders decomposition. I implemented a Cplex generic callback (in JAVA) that includes Lazy, User and Heuristic callbacks. Now, I need to add some cut management strategies e.g., limiting the number of cuts per node in the tree. The issue is that I don't know how to access the node id of the current candidate. I appreciate if someone could help.


Solution

  • This answer is for the just released version 12.10:

    In the relaxation context you can ask for UID and depth of a node using CPXXcallbackgetinfolong() with CPXCALLBACKINFO_NODEUID and CPXCALLBACKINFO_NODEDEPTH.

    In the candidate context however you cannot obtain this information at the moment. The reason is that the context may not be invoked in the context of a node (for example when the candidate comes from a heuristic). We are already working on an enhancement to make this information available at least in case the callback is invoked in the context of a node. On the other hand, unless CPLEX finds candidates like crazy, there may be no need to limit the number of lazy constraints separated.