Initializing help system before first use

problem.addcbmipthread

problem.addcbmipthread


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 addcbmipthread.
Synopsis

problem.addcbmipthread(callback, data, priority)

callback(my_prob, my_object, thread_prob)


Arguments
callback 
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 for the MIP thread
data 
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.
Example
The following example clears the message callback for each of the MIP threads:
prob.addcbmipthread(mipthread, None, 0)
def mipthread(my_prob, my_object, mipthread):
    my_prob.removecbmessage(mipthread, None)
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