XPRSaddcbmipthread
XPRSaddcbmipthread |
Purpose
Declares a MIP thread callback function, called every time a MIP worker problem is created by the parallel MIP code. This callback function will be called in addition to any callbacks already added by XPRSaddcbmipthread.
Synopsis
int XPRS_CC XPRSaddcbmipthread(XPRSprob prob, void (XPRS_CC *f_mipthread)(XPRSprob my_prob, void *my_object, XPRSprob thread_prob), void *object, int priority);
Arguments
prob
|
The current problem.
|
f_mipthread
|
The callback function which takes three arguments,
my_prob,
my_object and
thread_prob, and has no return value.
|
my_prob
|
The problem passed to the callback function.
|
my_object
|
The user-defined object passed to the callback function.
|
thread_prob
|
The problem pointer for the MIP thread
|
object
|
A user-defined object to be passed to the callback function.
|
priority
|
An integer that determines the order in which multiple callbacks of this type will be invoked. The callback added with a higher priority will be called before a callback with a lower priority. Set to 0 if not required.
|
Related controls
Integer
Number of MIP threads to create.
|
Example
The following example clears the message callback for each of the MIP threads:
XPRSaddcbmipthread(prob,mipthread,NULL, 0);
void XPRS_CC mipthread(XPRSprob my_prob, void* my_object, XPRSprob mipthread) { /* clear the message callback*/ XPRSremovecbmessage(my_prob, mipthread, NULL); }
Further information
This function will be called when a new MIP worker problem is created. Each worker problem receives a unique identifier that can be obtained through the
MIPTHREADID attribute. Worker problems can be matched with different system threads at different points of a solve, so the system thread that is responsible for executing the callback is not necessarily the same thread used for all subsequent callbacks for the same worker problem. On the other hand, worker problems are always assigned to a single thread at a time and the same nodes are always solved on the same worker problem in repeated runs of a deterministic MIP solve. A worker problem therefore acts as a virtual thread through the node solves.
Related topics