Skip to main content
FRAMES NO FRAMES

Class IloCplex::MIPInfoCallbackI

Definition file: ilcplex/ilocplexi.h
Map of IloCplex::MIPInfoCallbackIIloCplex::MIPInfoCallbackIIloCplex::DisjunctiveCutInfoCallbackIIloCplex::FlowMIRCutInfoCallbackIIloCplex::FractionalCutInfoCallbackIIloCplex::MIPCallbackIIloCplex::ProbingInfoCallbackIIloCplex::MIPInfoCallbackIIloCplex::OptimizationCallbackIIloCplex::CallbackI

An instance of the class IloCplex::MIPInfoCallbackI 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 regularly during the branch-and-cut search.

User-written callbacks of this class are compatible with MIP dynamic search.

This class offers methods for accessing an incumbent solution and its objective value from a user-written callback. It also offers methods for accessing priority orders and progress information, such as the number of nodes solved.

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 in a user-written callback to access information not available to an instance of this class, an exception is raised. 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 IloNumgetBestObjValue() const
public IloNumgetCutoff() const
public IloCplex::BranchDirectiongetDirection(const IloIntVar var) const
public IloCplex::BranchDirectiongetDirection(const IloNumVar var) const
public IloNumgetIncumbentObjValue() const
public IloNumgetIncumbentSlack(const IloRange rng) const
public voidgetIncumbentSlacks(IloNumArray vals, const IloRangeArray cons) const
public IloNumgetIncumbentValue(const IloExprArg expr) const
public IloNumgetIncumbentValue(const IloIntVar var) const
public IloNumgetIncumbentValue(const IloNumVar var) const
public voidgetIncumbentValues(IloNumArray val, const IloIntVarArray vars) const
public voidgetIncumbentValues(IloNumArray val, const IloNumVarArray vars) const
public IloNumgetMIPRelativeGap() const
public IloIntgetMyThreadNum() const
public IloIntgetNcuts(IloCplex::CutType which) const
public IloIntgetNiterations() const
public IloInt64getNiterations64() const
public IloIntgetNnodes() const
public IloInt64getNnodes64() const
public IloIntgetNremainingNodes() const
public IloInt64getNremainingNodes64() const
public IloNumgetPriority(const IloIntVar sos) const
public IloNumgetPriority(const IloNumVar sos) const
public IloNumgetQuality(IloCplex::Quality q) const
protected Callback::TypegetType() const
public IloBoolhasIncumbent() const
protected MIPInfoCallbackI(IloEnv env)
Inherited Methods from OptimizationCallbackI
getModel, getNcols, getNQCs, getNrows
Inherited Methods from CallbackI
abort, duplicateCallback, getCplexTime, getDetTime, getEndDetTime, getEndTime, getEnv, getStartDetTime, getStartTime, getType, main
Method Detail

MIPInfoCallbackI

protected MIPInfoCallbackI(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).


getBestObjValue

public IloNum getBestObjValue() const

This method accesses the currently best known bound of all the remaining open nodes in a branch-and-cut tree.

It is computed for a minimization problem as the minimum objective function value of all remaining unexplored nodes. Similarly, it is computed for a maximization problem as the maximum objective function value of all remaining unexplored nodes.

For a regular MIP optimization, this value is also the best known bound on the optimal solution value of the MIP problem. In fact, when a problem has been solved to optimality, this value matches the optimal solution value.

However, for the method populate, the value can also exceed the optimal solution value if CPLEX has already solved the model to optimality but continues to search for additional solutions.


getCutoff

public IloNum getCutoff() const
Returns the current cutoff value.

An instance of IloCplex uses the cutoff value (the value of the objective function of the subproblem at a node in the search tree) to decide when to prune nodes from the search tree (that is, when to cut off that node and discard the nodes beyond it). The cutoff value is updated whenever a new incumbent is found.


getDirection

public IloCplex::BranchDirection getDirection(const IloIntVar var) const

This method returns the branch direction previously assigned to variable var with the method IloCplex::setDirection or IloCplex::setDirections. If no direction has been assigned, IloCplex::BranchGlobal will be returned.


getDirection

public IloCplex::BranchDirection getDirection(const IloNumVar var) const

This method returns the branch direction previously assigned to variable var with the method IloCplex::setDirection or IloCplex::setDirections. If no direction has been assigned, IloCplex::BranchGlobal will be returned.


getIncumbentObjValue

public IloNum getIncumbentObjValue() const

Returns the value of the objective function of the incumbent solution (that is, the best integer solution found so far) at the time the invoking callback is called by an instance of IloCplex while solving a MIP. If there is no incumbent, this method returns a very large positive number for a minimization or a very small negative number for a maximization.


getIncumbentSlack

public IloNum getIncumbentSlack(const IloRange rng) const

This method returns the slack value for the range specified by rng for the incumbent. If there is no incumbent, this method throws an exception.


getIncumbentSlacks

public void getIncumbentSlacks(IloNumArray vals, const IloRangeArray cons) const

This method puts the slack value for each range in the array of ranges cons into the corresponding element of the array vals for the incumbent. CPLEX resizes array vals to match the size of array cons. If there is no incumbent, this method throws an exception.


getIncumbentValue

public IloNum getIncumbentValue(const IloExprArg expr) const

This method returns the value of the expression expr in the incumbent solution at the time the invoking callback is called by an instance of IloCplex while solving a MIP. If there is no incumbent, this method throws an exception.


getIncumbentValue

public IloNum getIncumbentValue(const IloIntVar var) const

Returns the solution value of var in the incumbent solution at the time the invoking callback is called by an instance of IloCplex while solving a MIP. If there is no incumbent, this method throws an exception.


getIncumbentValue

public IloNum getIncumbentValue(const IloNumVar var) const

Returns the solution value of var in the incumbent solution at the time the invoking callback is called by an instance of IloCplex while solving a MIP. If there is no incumbent, this method throws an exception.


getIncumbentValues

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

Returns the value of each variable in the array vars with respect to the current incumbent solution, and it puts those values into the corresponding array vals. If there is no incumbent, this method throws an exception.


getIncumbentValues

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

Returns the value of each variable in the array vars with respect to the current incumbent solution, and it puts those values into the corresponding array vals. If there is no incumbent, this method throws an exception.


getMIPRelativeGap

public IloNum getMIPRelativeGap() const

This method accesses the current relative objective gap.

For a minimization problem, this value is computed by

 (bestinteger - bestobjective) / (1e-10 + |bestinteger|)
 

where bestinteger is the value returned by IloCplex::MIPInfoCallbackI::getIncumbentValue and bestobjective is the value returned by IloCplex::MIPInfoCallbackI::getBestObjValue. For a maximization problem, the value is computed by:

 (bestobjective - bestinteger) / (1e-10 + |bestinteger|) 
 

getMyThreadNum

public IloInt getMyThreadNum() const

Returns the identifier of the parallel thread being currently executed. This number is between 0 (zero) and the value returned by the method getUserThreads()-1.

This method returns a nonzero value only for the class IloCplex::MIPCallbackI and its subclasses. In other words, this method is valid only for query, diagnostic, and control callbacks. It is not valid for informational callbacks.


getNcuts

public IloInt getNcuts(IloCplex::CutType which) const

Returns the total number of cuts of the type which that CPLEX has added to the model so far during the current optimization.


getNiterations

public IloInt getNiterations() const

Returns the total number of iterations executed so far during the current optimization to solve the node relaxations.


getNiterations64

public IloInt64 getNiterations64() const

Returns the total number of iterations executed so far during the current optimization to solve the node relaxations.


getNnodes

public IloInt getNnodes() const

Returns the number of nodes already processed in the current optimization.


getNnodes64

public IloInt64 getNnodes64() const

Returns the number of nodes already processed in the current optimization.


getNremainingNodes

public IloInt getNremainingNodes() const

Returns the number of nodes left to explore in the current optimization.


getNremainingNodes64

public IloInt64 getNremainingNodes64() const

Returns the number of nodes left to explore in the current optimization.


getPriority

public IloNum getPriority(const IloIntVar sos) const

Returns the branch priority used for the variable var in the current optimization.


getPriority

public IloNum getPriority(const IloNumVar sos) const

Returns the branch priority used for variable var in the current optimization.


getQuality

public IloNum getQuality(IloCplex::Quality q) const

Returns the requested quality measure of kappa statistics. This method applies only to the quality measures of kappa statistics. For more information about kappa statistics, see the parameter MIPKappaStats documented in the CPLEX Parameters Reference Manual.


hasIncumbent

public IloBool hasIncumbent() const

Returns IloTrue if an integer feasible solution has been found, or, equivalently, if an incumbent solution is available at the time the invoking callback is called by an instance of IloCplex while solving a MIP.


getType

protected Callback::Type getType() const

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