Skip to main content
FRAMES NO FRAMES

Class IloCplex::IncumbentCallbackI

Definition file: ilcplex/ilocplexi.h
Map of IloCplex::IncumbentCallbackIIloCplex::IncumbentCallbackIIloCplex::IncumbentCallbackIIloCplex::MIPCallbackIIloCplex::MIPInfoCallbackIIloCplex::OptimizationCallbackIIloCplex::CallbackI
Note

This is an advanced class. Advanced classes typically demand a profound understanding of the algorithms used by CPLEX. Thus they incur a higher risk of incorrect behavior in your application, behavior that can be difficult to debug. Therefore, the team encourages you to consider carefully whether you can accomplish the same task by means of other classes instead.

This callback is called whenever a new potential incumbent is found during branch-and-cut searches. It allows you to analyze the proposed incumbent and optionally reject it. In this case, CPLEX will continue the branch-and-cut search. This callback is thus typically combined with a branch callback that instructs CPLEX how to branch on a node after it has found a potential incumbent and thus considered the node solution to be integer feasible.

When you use this callback to reject an incumbent, you must also set the parameter to control type of primal and dual reductions, IloCplex::Reduce either to 1 (one) in order to restrict presolve to primal reductions only, or to 0 (zero) in order to disable all presolve reductions. This setting of the reduction parameter is not necessary if the incumbent callback is used for other purposes.

Note

The incumbent callback may be invoked during MIP start processing. In that case getSolutionSource will return MIPStartSolution. In this situation the following special consideration applies:

  • MIP start processing occurs very early in the solution process. At this point no search tree is setup yet and there are no search tree nodes yet. Consequently, a lot of the callback functions that require a node context will fail in this situation.

See Also:

Method Summary
public NodeData *getNodeData() const
public NodeIdgetNodeId() const
public IloNumgetObjValue() const
public IloNumgetSlack(const IloRange rng) const
public voidgetSlacks(IloNumArray val, const IloRangeArray con) const
public IncumbentCallbackI::SolutionSourcegetSolutionSource() const
protected Callback::TypegetType() const
public IloNumgetValue(const IloIntVar var) const
public IloNumgetValue(const IloNumVar var) const
public IloNumgetValue(const IloExprArg expr) const
public voidgetValues(IloNumArray val, const IloIntVarArray vars) const
public voidgetValues(IloNumArray val, const IloNumVarArray vars) const
public voidreject()
public NodeData *setNodeData(NodeData * data)
Inherited Methods from MIPCallbackI
getCurrentNodeDepth, getObjCoef, getObjCoef, getObjCoefs, getObjCoefs, getType, getUserThreads, MIPCallbackI
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 Enumeration
IncumbentCallbackI::SolutionSource
Method Detail

getNodeData

public NodeData * getNodeData() const

This method retrieves the NodeData object that may have previously been assigned to the current node by the user with the method IloCplex::BranchCallbackI::makeBranch. If no data object has been assigned to the current node, 0 (zero) will be returned.


getNodeId

public NodeId getNodeId() const

This method returns the NodeId of the current node.

See MIPCallbackI::NodeId.


getObjValue

public IloNum getObjValue() const

This method returns the query objective value of the potential incumbent.

If you need the object representing the objective itself, consider the method IloCplex::getObjective instead.


getSlack

public IloNum getSlack(const IloRange rng) const

This method returns the slack value for the range specified by rng for the potential incumbent.


getSlacks

public void getSlacks(IloNumArray val, const IloRangeArray con) const

This method puts the slack value for each range in the array of ranges con into the corresponding element of the array val for the potential incumbent. For this CPLEX resizes array val to match the size of array con.


getSolutionSource

public IncumbentCallbackI::SolutionSource getSolutionSource() const

This method returns the source of the solution for which the callback was invoked.


getValue

public IloNum getValue(const IloIntVar var) const

This method returns the query value of the variable var in the potential incumbent solution.

For special considerations about integrality, truncation, and rounding applicable to this method, see the concept Integer values, integrality tolerance, and round-off in CPLEX Optimizers.


getValue

public IloNum getValue(const IloNumVar var) const

This method returns the value of the variable var in the potential incumbent solution.


getValue

public IloNum getValue(const IloExprArg expr) const

This method returns the value of the expr for the potential incumbent solution.


getValues

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

This method returns the query values of the variables in the array vars in the potential incumbent solution and copies them to val. CPLEX automatically resizes the array val to match the size of the array vars.

For special considerations about integrality, truncation, and rounding applicable to this method, see the concept Integer values, integrality tolerance, and round-off in CPLEX Optimizers.


getValues

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

This method returns the query values of the variables in the array vars in the potential incumbent solution and copies them to val. CPLEX automatically resizes the array val to match the length of the array vars.


reject

public void reject()

This method rejects the proposed incumbent.


setNodeData

public NodeData * setNodeData(NodeData * data)

This method sets the NodeData object assigned to the the current node. If a NodeData object has already been set for the current node, then the method replaces this object and and returns the old object. Otherwise, the method returns 0 (zero).


getType

protected Callback::Type getType() const

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


Inner Enumeration Detail

Enumeration SolutionSource

Definition file: ilcplex/ilocplexi.h

This enumeration lists the values that tell for which type of solution the incumbent callback or lazy constraint callback was invoked.

Fields

NodeSolution = CPX_CALLBACK_MIP_INCUMBENT_NODESOLN 
HeuristicSolution = CPX_CALLBACK_MIP_INCUMBENT_HEURSOLN 
UserSolution = CPX_CALLBACK_MIP_INCUMBENT_USERSOLN 
MIPStartSolution = CPX_CALLBACK_MIP_INCUMBENT_MIPSTART