Search code examples
ccallbackmathematical-optimizationcplexbranch-and-bound

CPLEX generic callbacks, node LP for cut separation


I am setting up a branch-and-cut algorithm using the generic callback framework through the C API of CPLEX 12.10.

At each node, the separation problem is based on the current node LP and detects locally valid cuts, that if violated are added for every child node of the current node.

To my understanding, the information of a current node LP is not readily available in the generic callbacks. However, I would like to use cuts generated for a parent node, to generate better cuts in the child nodes.

Is it necessary to do book-keeping about which cuts are generated at all the nodes or can this information somehow be passed on using CPLEX functionality? If the only possibility is to keep track of all generated cuts, how can this book-keeping be made thread-safe, if CPLEX calls the callback from different threads and in different nodes?


Solution

  • There is no way to make CPLEX keep track of this information for you. You have to roll your own.

    One way to do this is to implement a dictionary that maps a node's unique id (see CPXCALLBACKINFO_NODEUID) to the information you want to store along with that node. With respect to thread-safety you only have to protect the accesses to that dictionary. To do that, use a lock (pthread_mutex on non-Windows, CRITICAL_SECTION on Windows, for example) and lock and lookup or update operation on that dictionary.