Skip to main content
FRAMES NO FRAMES

Class IloCplex::MIPCallbackI

Definition file: ilcplex/ilocplexi.h
Map of IloCplex::MIPCallbackIIloCplex::MIPCallbackIIloCplex::ControlCallbackIIloCplex::DisjunctiveCutCallbackIIloCplex::FlowMIRCutCallbackIIloCplex::FractionalCutCallbackIIloCplex::IncumbentCallbackIIloCplex::NodeCallbackIIloCplex::ProbingCallbackIIloCplex::MIPCallbackIIloCplex::MIPInfoCallbackIIloCplex::OptimizationCallbackIIloCplex::CallbackI

An instance of the class IloCplex::MIPCallbackI represents a user-written callback in an application that uses an instance of IloCplex to solve a mixed integer program (MIP). IloCplex calls the user-written callback prior to solving each node in branch-and-cut search.

User-written callbacks of this class or any of its subclasses are not compatible with MIP dynamic search. If you are looking for support for callbacks compatible with dynamic search, consider the class IloCplex::MIPInfoCallbackI instead.

This class offers member functions for accessing an incumbent solution and its objective value from a user-written callback. It also offers methods for accessing priority orders and statistical information, such as the number of cuts. Methods are also available to query the number of generated cuts for each type of cut CPLEX generates. See the CPLEX User's Manual for more information about cuts.

The methods of this class are protected for use in deriving a user-written callback class and in implementing the main method there.

If an attempt is made to access information not available to an instance of this class, an exception is thrown. For example, if there is no incumbent, the methods that query about incumbents will throw an exception.

This class also provides the common application programming interface (API) for these callback classes:

See Also:

Method Summary
public virtual IloIntgetCurrentNodeDepth() const
public IloNumgetObjCoef(const IloIntVar var) const
public IloNumgetObjCoef(const IloNumVar var) const
public voidgetObjCoefs(IloNumArray val, const IloIntVarArray vars) const
public voidgetObjCoefs(IloNumArray val, const IloNumVarArray vars) const
protected Callback::TypegetType() const
public IloIntgetUserThreads() const
protected MIPCallbackI(IloEnv env)
Inherited Methods from MIPInfoCallbackI
getBestObjValue, getCutoff, getDirection, getDirection, getIncumbentObjValue, getIncumbentSlack, getIncumbentSlacks, getIncumbentValue, getIncumbentValue, getIncumbentValue, getIncumbentValues, getIncumbentValues, getMIPRelativeGap, getMyThreadNum, getNcuts, getNiterations, getNiterations64, getNnodes, getNnodes64, getNremainingNodes, getNremainingNodes64, getPriority, getPriority, getQuality, getType, hasIncumbent, MIPInfoCallbackI
Inherited Methods from OptimizationCallbackI
getModel, getNcols, getNQCs, getNrows
Inherited Methods from CallbackI
abort, duplicateCallback, getCplexTime, getDetTime, getEndDetTime, getEndTime, getEnv, getStartDetTime, getStartTime, getType, main
Inner Class
MIPCallbackI::NodeData
Inner structs
MIPCallbackI::NodeId
Method Detail

MIPCallbackI

protected MIPCallbackI(IloEnv env)

This constructor creates a callback for use in an application that uses an instance of IloCplex to solve a mixed integer program (MIP).


getCurrentNodeDepth

public virtual IloInt getCurrentNodeDepth() const

Returns the depth of the current node in the search tree. The root node has depth 0 (zero). The depth of other nodes is defined recursively as the depth of their parent node plus one. In other words, the depth of a node is its distance in terms of the number of branches from the root.


getObjCoef

public IloNum getObjCoef(const IloIntVar var) const

Returns the linear objective coefficient for var in the model currently being solved.


getObjCoef

public IloNum getObjCoef(const IloNumVar var) const

Returns the linear objective coefficient for var in the model currently being solved.


getObjCoefs

public void getObjCoefs(IloNumArray val, const IloIntVarArray vars) const

Puts the linear objective coefficient of each of the variables in the array vars into the corresponding element of the array vals.


getObjCoefs

public void getObjCoefs(IloNumArray val, const IloNumVarArray vars) const

Puts the linear objective coefficient of each of the variables in the array vars into the corresponding element of the array vals.


getUserThreads

public IloInt getUserThreads() const

Returns the total number of parallel threads currently running.


getType

protected Callback::Type getType() const

This method returns the callback type of the invoking callback object.


Inner Struct Detail

Struct MIPCallbackI::NodeId

Definition file: ilcplex/ilocplexi.h

Objects of this class are used to identify uniquely nodes of the branch-and-cut search tree during the solution of a MIP. When a new node is created either by IloCplex or by the user in a branch callback, IloCplex assigns a NodeId to it. From then on, the node can be referenced via this NodeId, for example, from an instance of IloCplex::NodeCallbackI.

See MIPCallbackI::NodeId.

Method Summary
public intoperator!=(const NodeId & nodeid) const
public intoperator==(const NodeId & nodeid) const
Method Detail

operator!=

public int operator!=(const NodeId & nodeid) const
Returns IloTrue if the invoking NodeId represents a node different from the node specified by the argument nodeid.

See MIPCallbackI::NodeId.


operator==

public int operator==(const NodeId & nodeid) const
Returns IloTrue if the invoking NodeId represents the same node as the argument nodeid.