Interaction between callbacks and parallel optimizers

Describes interaction of callbacks with parallel optimizers.

When you use callback routines, and invoke the parallel implementation of CPLEX optimizers, you need to be aware that the CPLEX environment passed to the callback routine corresponds to an individual CPLEX thread rather than to the original environment created. CPLEX frees this environment when finished with the thread. This convention does not affect most uses of the callback function. However, keep in mind that CPLEX associates problem objects, parameter settings, and message channels with the environment that specifies them. CPLEX therefore frees these items when it removes that environment; if the callback uses routines like CPXcreateprob, CPXcloneprob, or CPXgetchannels, those objects remain allocated only as long as the associated environment does. (You should not change parameters from within a callback.) So, applications that access CPLEX objects in the callback should use the original environment you created if they need to access these objects outside the scope of the callback function.

Tip: Using a callback can implicitly cause CPLEX to disable parallel MIP search at default parameter settings. See the documentation of global thread count (CPX_PARAM_THREADS, Threads) in the reference manual Parameters of CPLEX for further details about this issue.