ilog.cplex
Class IloCplex.MIPCallback

java.lang.Object
  |
  +--ilog.cplex.IloCplex.Callback
        |
        +--ilog.cplex.IloCplex.MIPCallback
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
IloCplex.ControlCallback, IloCplex.DisjunctiveCutCallback, IloCplex.FlowMIRCutCallback, IloCplex.FractionalCutCallback, IloCplex.IncumbentCallback, IloCplex.NodeCallback, IloCplex.ProbingCallback, IloCplex.SolveCallback
Enclosing class:
IloCplex

public abstract static class IloCplex.MIPCallback
extends IloCplex.Callback

The base class for all MIP callbacks.

An instance of the class MIPCallback 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 the branch-and-cut search. This class allows you to access an incumbent solution, an incumbent node, and an incumbent objective value from a user-written callback. It also allows you to access priority orders and statistical information such as the number of cuts that have been generated. Methods are also available to query the number of generated cuts for each type of cut CPLEX generates. See the ILOG CPLEX User's Manual for more information about cuts.

This class also provides a common application programming interface (API) for these subclasses:

The constructor and methods of this class are protected to make sure that they are used only to derive a user-written callback class or to implement the main method in it.

See Also:
IloCplex.Callback

Constructor Summary
protected IloCplex.MIPCallback()
          Constructor for user-written MIP callback.
 
Method Summary
protected  double getBestObjValue()
          This method returns a bound on the optimal solution value of the active problem at the moment the callback is called.
protected  double getCutoff()
          Returns the cutoff for the objective value when nodes are being solved during branch-and-cut search.
protected  IloCplex.BranchDirection getDirection(ilog.concert.IloNumVar var)
          Returns the branch direction for variable var.
protected  double getIncumbentObjValue()
          Returns the objective value of the current best integer solution at the moment the callback is called.
protected  double getIncumbentValue(ilog.concert.IloNumVar var)
          Returns the value of var for the current best integer solution.
protected  double[] getIncumbentValues(ilog.concert.IloNumVar[] vars)
          Returns incumbent solution values for an array of variables.
protected  double[] getIncumbentValues(ilog.concert.IloNumVar[] vars, int start, int num)
          Returns the incumbent solution values for a set of variables.
protected  int getMyThreadNum()
           
protected  int getNcliques()
          Returns the number of clique cuts that have been added to the node relaxation at the moment the callback is called.
protected  int getNcovers()
          Returns the number of cover cuts that have been added to the node relaxation at the moment the callback is called.
protected  int getNdisjunctiveCuts()
          Returns the number of disjunctive cuts that have been added to the node relaxation at the moment the callback is called.
protected  int getNflowCovers()
          Returns the number of flow cover cuts that have been added to the node relaxation at the moment the callback is called.
protected  int getNflowPaths()
          Returns the number of flow path cuts that have been added to the node relaxation at the moment the callback is called.
protected  int getNfractionalCuts()
          Returns the number of fractional cuts that have been added to the node relaxation at the moment the callback is called.
protected  int getNGUBcovers()
          Returns the number of GUB cover cuts that have been added to the node relaxation at the moment the callback is called.
protected  int getNimpliedBounds()
          Returns the number of implied bound cuts that have been added to the node relaxation at the moment the callback is called.
protected  int getNiterations()
          Returns the total number of iterations for solving node relaxations during the current optimization.
protected  int getNMIRs()
          Returns the number of mixed integer rounding (MIR) cuts that have been added to the node relaxation at the moment the callback is called.
protected  int getNnodes()
          Returns the number of nodes processed so far in the active branch-and-cut search.
protected  int getNremainingNodes()
          Returns the number of nodes remaining to be processed, or, equivalently, the number of active nodes in the tree.
protected  double getObjCoef(ilog.concert.IloNumVar var)
          Returns the linear objective function coefficient for variable var in the model being solved.
protected  double[] getObjCoefs(ilog.concert.IloNumVar[] vars)
          Returns the linear objective function coefficients for an array of variables in the model being solved.
protected  double[] getObjCoefs(ilog.concert.IloNumVar[] vars, int start, int num)
          Returns the linear objective function coefficients for a set of variables in the model being solved.
protected  int getPriority(ilog.concert.IloNumVar var)
          Returns the branch priority for variable var.
protected  int getUserThreads()
           
protected  boolean hasIncumbent()
          Returns true if an incumbent solution has been found when the callback is called.
 
Methods inherited from class ilog.cplex.IloCplex.Callback
abort, getModel, getNcols, getNQCs, getNrows, main
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IloCplex.MIPCallback

protected IloCplex.MIPCallback()
Constructor for user-written MIP callback. This constructor can be called only to construct objects of derived user-written callback classes, but not to construct IloCplex.MIPCallback objects directly.

Method Detail

getMyThreadNum

protected int getMyThreadNum()
                      throws IloException
IloException

getUserThreads

protected int getUserThreads()
                      throws IloException
IloException

getBestObjValue

protected double getBestObjValue()
                          throws IloException
This method returns a bound on the optimal solution value of the active problem at the moment the callback is called. When a model has been solved to optimality, this value matches the optimal solution value. Before optimality has been proven, this value is computed for a minimization (maximization) problem as the minimum (maximum) objective function value of all remaining unexplored nodes.

Returns:
A bound on the optimal solution value.
Throws:
IloException - If the method fails, an exception of type IloException, or one of its derived classes, is thrown.

getCutoff

protected double getCutoff()
                    throws IloException
Returns the cutoff for the objective value when nodes are being solved during branch-and-cut search. This value is typically computed from the objective value of an incumbent solution and the optimality gap. In the case of a minimization problem, for example, if the objective value of a node exceeds the cutoff value, the node can be pruned without the need to solve the node to optimality.

Returns:
The objective value cutoff.
IloException

getIncumbentObjValue

protected double getIncumbentObjValue()
                               throws IloException
Returns the objective value of the current best integer solution at the moment the callback is called. This method returns the objective value for the current incumbent solution (that is, the best integer solution found so far).

Returns:
The objective value for the current incumbent solution.
IloException

getIncumbentValue

protected double getIncumbentValue(ilog.concert.IloNumVar var)
                            throws IloException
Returns the value of var for the current best integer solution. This method returns the value of variable var in the current incumbent solution (that is, the best integer solution found so far).

Parameters:
var - The variable whose incumbent solution value is being queried.
Returns:
The value of variable var in the current incumbent solution.
IloException

getIncumbentValues

protected double[] getIncumbentValues(ilog.concert.IloNumVar[] vars)
                               throws IloException
Returns incumbent solution values for an array of variables.

Parameters:
vars - The array of variables whose incumbent solution values are being queried.
Returns:
The incumbent solution values for variables listed in var. The solution value for variable var[j] is returned as element j of the returned array.
IloException

getIncumbentValues

protected double[] getIncumbentValues(ilog.concert.IloNumVar[] vars,
                                      int start,
                                      int num)
                               throws IloException
Returns the incumbent solution values for a set of variables.

Parameters:
vars - An array containing the variables whose incumbent solution values are being queried.
start - The index of the first variable in vars for which to return the incumbent solution value.
num - The number of variables in vars for which to return the incumbent solution values.
Returns:
The incumbent solution values for variables listed in var. The solution for variable var[j+start] is returned as element j of the returned array.
IloException

hasIncumbent

protected boolean hasIncumbent()
                        throws IloException
Returns true if an incumbent solution has been found when the callback is called.

Returns:
true if an incumbent solution has been found.
IloException

getNnodes

protected int getNnodes()
                 throws IloException
Returns the number of nodes processed so far in the active branch-and-cut search.

Returns:
The number of nodes processed so far.
IloException

getNremainingNodes

protected int getNremainingNodes()
                          throws IloException
Returns the number of nodes remaining to be processed, or, equivalently, the number of active nodes in the tree.

Returns:
The number of nodes remaining to be processed.
IloException

getNiterations

protected int getNiterations()
                      throws IloException
Returns the total number of iterations for solving node relaxations during the current optimization.

Returns:
The total number of iterations for solving nodes
IloException

getNcliques

protected int getNcliques()
                   throws IloException
Returns the number of clique cuts that have been added to the node relaxation at the moment the callback is called.

Returns:
The number of clique cuts added so far.
IloException

getNcovers

protected int getNcovers()
                  throws IloException
Returns the number of cover cuts that have been added to the node relaxation at the moment the callback is called.

Returns:
The number of cover cuts added so far.
IloException

getNflowCovers

protected int getNflowCovers()
                      throws IloException
Returns the number of flow cover cuts that have been added to the node relaxation at the moment the callback is called.

Returns:
The number of flow cover cuts added so far.
IloException

getNflowPaths

protected int getNflowPaths()
                     throws IloException
Returns the number of flow path cuts that have been added to the node relaxation at the moment the callback is called.

Returns:
The number of flow path cuts added so far.
IloException

getNGUBcovers

protected int getNGUBcovers()
                     throws IloException
Returns the number of GUB cover cuts that have been added to the node relaxation at the moment the callback is called.

Returns:
The number of GUB cover cuts added so far.
IloException

getNfractionalCuts

protected int getNfractionalCuts()
                          throws IloException
Returns the number of fractional cuts that have been added to the node relaxation at the moment the callback is called.

Returns:
The number of fractional cuts added so far.
IloException

getNdisjunctiveCuts

protected int getNdisjunctiveCuts()
                           throws IloException
Returns the number of disjunctive cuts that have been added to the node relaxation at the moment the callback is called.

Returns:
The number of disjunctive cuts added so far.
IloException

getNMIRs

protected int getNMIRs()
                throws IloException
Returns the number of mixed integer rounding (MIR) cuts that have been added to the node relaxation at the moment the callback is called.

Returns:
The number of MIR cuts added so far.
IloException

getNimpliedBounds

protected int getNimpliedBounds()
                         throws IloException
Returns the number of implied bound cuts that have been added to the node relaxation at the moment the callback is called.

Returns:
The number of implied bound cuts added so far.
IloException

getDirection

protected IloCplex.BranchDirection getDirection(ilog.concert.IloNumVar var)
                                         throws IloException
Returns the branch direction for variable var.

Parameters:
var - The variable whose branch direction is being queried.
Returns:
The branch direction for variable var.
IloException

getPriority

protected int getPriority(ilog.concert.IloNumVar var)
                   throws IloException
Returns the branch priority for variable var.

Parameters:
var - The variable whose branch priority is being queried.
Returns:
The branch priority for variable var
IloException

getObjCoef

protected double getObjCoef(ilog.concert.IloNumVar var)
                     throws IloException
Returns the linear objective function coefficient for variable var in the model being solved.

Parameters:
var - The variable whose linear objective coefficient is being queried.
Returns:
The linear objective coefficient for variable var in the model being solved.
IloException

getObjCoefs

protected double[] getObjCoefs(ilog.concert.IloNumVar[] vars)
                        throws IloException
Returns the linear objective function coefficients for an array of variables in the model being solved.

Returns:
An array of double values containing the linear objective function coefficients for the specified variables in the problem being solved. If the returned array is called obj, obj[j] is the linear objective function coefficient for variable var[j].
IloException

getObjCoefs

protected double[] getObjCoefs(ilog.concert.IloNumVar[] vars,
                               int start,
                               int num)
                        throws IloException
Returns the linear objective function coefficients for a set of variables in the model being solved.

Parameters:
start - The index of the first variable in var for which to query the linear objective function coefficients.
num - The number of variables in var for which to query the linear objective function coefficients.
Returns:
An array of double values containing the linear objective function coefficients for the specified variables in the problem being solved. If obj is the returned array, obj[j] is the linear objective function coefficient for variable var[j+start], for j = 0, ..., num-1.
IloException