Initializing help system before first use

problem.addcbinfnode

problem.addcbinfnode


Purpose
Declares a user infeasible node callback function, called after the current node has been found to be infeasible during the Branch and Bound search. This callback function will be called in addition to any callbacks already added by addcbinfnode.
Synopsis

problem.addcbinfnode(callback, data, priority)

callback(my_prob, my_object)


Arguments
callback 
The callback function which takes two arguments, my_prob and my_object, and has no return value. This function is called after the current node has been found to be infeasible.
my_prob 
The problem passed to the callback function, callback.
my_object 
The user-defined object passed as object when setting up the callback with addcbinfnode.
data 
A user-defined object to be passed to the callback function, callback.
priority 
An integer that determines the order in which multiple user infeasible node callbacks 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 notifies the user whenever an infeasible node is found during the global search:
prob.addcbinfnode(nodeInfeasible, None, 0)
prob.mipoptimize("")
The callback function may resemble:
def nodeInfeasible(prob, object):
    node = prob.attributes.currentnode
    print("Node {0} infeasible".format(node))
Related topics