ilog.cplex
Class IloCplex.ControlCallback

java.lang.Object
  |
  +--ilog.cplex.IloCplex.Callback
        |
        +--ilog.cplex.IloCplex.MIPCallback
              |
              +--ilog.cplex.IloCplex.ControlCallback
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
IloCplex.BranchCallback, IloCplex.CutCallback, IloCplex.HeuristicCallback, IloCplex.UserCutCallback
Enclosing class:
IloCplex

public abstract static class IloCplex.ControlCallback
extends IloCplex.MIPCallback

This is the base class for all callback classes that allow you to query or take control of the MIP branch-and-cut search. These classes are:

The ControlCallback is not a callback for implementing user functionality itself, but rather provides the common interface for the above listed callback classes. These callbacks share the property that they are called at every node in the branch-and-cut search tree, and allow you to access node-related data. For each branch-and-cut node these callbacks are called in the following order:

  1. IloCplex.CutCallback: Once the node problem has been solved and IloCplex has added all its cuts, the user cut callback is called. In case new cuts are added to the problem, the node problem is solved again. This is iterated until no more cuts are added to the problem.
  2. IloCplex.HeuristicCallback: Once the node has been fully solved (that is including all the cuts that may have been added), the heuristic callback is called in an attempt to generate an integer feasible solution from the current relaxation solution at that node.
  3. IloCplex.BranchCallback: Finally, if the relaxation solution at the current node is either integer infeasible or rejected by the IloCplex.IncumbentCallback, the problem is split into subproblems. At that point the IloCplex.BranchCallback can be used to control how to create the subproblems.

The 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, IloCplex.MIPCallback, IloCplex.BranchCallback, IloCplex.CutCallback, IloCplex.HeuristicCallback

Constructor Summary
IloCplex.ControlCallback()
           
 
Method Summary
protected  double getDownPseudoCost(ilog.concert.IloNumVar var)
          Returns the pseudo cost for branching down on variable var.
protected  IloCplex.IntegerFeasibilityStatus[] getFeasibilities(ilog.concert.IloNumVar[] var)
          Indicates whether the variables in array var are integer feasible, integer infeasible, or implied integer feasible in the current node solution.
protected  IloCplex.IntegerFeasibilityStatus[] getFeasibilities(ilog.concert.IloNumVar[] var, int start, int num)
          Indicates whether the variables specified in array var are integer feasible, integer infeasible, or implied integer feasible in the current node solution.
protected  IloCplex.IntegerFeasibilityStatus getFeasibility(ilog.concert.IloNumVar var)
          Indicates whether the variable var is integer feasible, integer infeasible, or implied integer feasible in the current node solution.
protected  double getLB(ilog.concert.IloNumVar var)
          Returns the current lower bound for variable var.
protected  double[] getLBs(ilog.concert.IloNumVar[] var)
          Returns the current lower bounds for an array of variables.
protected  double[] getLBs(ilog.concert.IloNumVar[] var, int start, int num)
          Returns the current lower bounds for a set of variables.
protected  java.lang.Object getNodeData()
          Returns the user object attached to the current node.
protected  double getObjValue()
          Returns the objective function value of the solution of the continuous relaxation of the current node.
protected  double getSlack(ilog.concert.IloRange rng)
          Returns the slack value of a constraint for the solution of the continuous relaxation of the current node.
protected  double[] getSlacks(ilog.concert.IloRange[] rng)
          Returns the slack values of an array of constraints for the solution of the current node.
protected  double[] getSlacks(ilog.concert.IloRange[] rng, int start, int num)
          Returns the slack values of a set of constraints for the solution of the current node.
protected  IloCplex.IntegerFeasibilityStatus getSOSFeasibility(ilog.concert.IloSOS1 sos)
          Indicates whether the special ordered set of type 1 is integer feasible, integer infeasible, or implied integer feasible in the current node solution.
protected  IloCplex.IntegerFeasibilityStatus getSOSFeasibility(ilog.concert.IloSOS2 sos)
          Indicates whether the special ordered set of type 2 is integer feasible, integer infeasible, or implied integer feasible in the current node solution.
protected  double getUB(ilog.concert.IloNumVar var)
          Returns the current upper bound for variable var.
protected  double[] getUBs(ilog.concert.IloNumVar[] var)
          Returns the current upper bounds for an array of variables.
protected  double[] getUBs(ilog.concert.IloNumVar[] var, int start, int num)
          Returns the current upper bounds for a set of variables.
protected  double getUpPseudoCost(ilog.concert.IloNumVar var)
          Returns the pseudo cost for branching up on variable var.
protected  double getValue(ilog.concert.IloNumExpr expr)
          Returns the value expr takes for the solution of the continuous relaxation of the current node.
protected  double getValue(ilog.concert.IloNumVar var)
          Returns the solution value of a variable at the current node.
protected  double[] getValues(ilog.concert.IloNumVar[] var)
          Returns the solution values for an array of variables at the current node.
protected  double[] getValues(ilog.concert.IloNumVar[] var, int start, int num)
          Returns the solution values for a set of variables at the current node.
 
Methods inherited from class ilog.cplex.IloCplex.MIPCallback
getBestObjValue, getCutoff, getDirection, getIncumbentObjValue, getIncumbentValue, getIncumbentValues, getIncumbentValues, getMyThreadNum, getNcliques, getNcovers, getNdisjunctiveCuts, getNflowCovers, getNflowPaths, getNfractionalCuts, getNGUBcovers, getNimpliedBounds, getNiterations, getNMIRs, getNnodes, getNremainingNodes, getObjCoef, getObjCoefs, getObjCoefs, getPriority, getUserThreads, hasIncumbent
 
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.ControlCallback

public IloCplex.ControlCallback()
Method Detail

getLB

protected double getLB(ilog.concert.IloNumVar var)
                throws IloException
Returns the current lower bound for variable var. This may be different from the bound the variable has in the active model, since branching or bound strengthening may have been applied to it.

Parameters:
var - The variable whose current lower bound is being queried.
Returns:
The lower bound for variable var at the current node.
IloException

getLBs

protected double[] getLBs(ilog.concert.IloNumVar[] var)
                   throws IloException
Returns the current lower bounds for an array of variables. The bounds may be different from the bounds the variables have in the active model, since branching or bound strengthening may have been applied to them.

Parameters:
var - An array of variables whose current lower bounds are being queried.
Returns:
An array of double values containing the current lower bounds for the specified variables. If the returned array is called lb, lb[j] contains the lower bound of variable var[j] at the current node.
IloException

getLBs

protected double[] getLBs(ilog.concert.IloNumVar[] var,
                          int start,
                          int num)
                   throws IloException
Returns the current lower bounds for a set of variables. The bounds may be different from the bounds the variables have in the active model, since branching or bound strengthening may have been applied to them.

Parameters:
var - An array containing the variables whose current lower bounds are being queried.
start - The index of the first variable in var for which to query the current lower bound.
num - The number of variables in var for which to query the current lower bounds.
Returns:
An array of double values containing the current lower bounds for the specified variables. If the returned array is called lb, lb[j] contains the lower bound of variable var[j+start] at the current node, for j = 0, ..., num-1.
IloException

getUB

protected double getUB(ilog.concert.IloNumVar var)
                throws IloException
Returns the current upper bound for variable var. This may be different from the bound the variable has in the active model, since branching or bound strengthening may have been applied to it.

Parameters:
var - The variable whose current upper bound is being queried.
Returns:
The upper bound for variable var at the current node.
IloException

getUBs

protected double[] getUBs(ilog.concert.IloNumVar[] var)
                   throws IloException
Returns the current upper bounds for an array of variables. The bounds may be different from the bounds the variables have in the active model, since branching or bound strengthening may have been applied to them.

Parameters:
var - An array of variables whose current upper bounds are being queried.
Returns:
An array of double values containing the current upper bounds for the specified variables. If the returned array is called ub, ub[j] contains the upper bound of variable var[j] at the current node.
IloException

getUBs

protected double[] getUBs(ilog.concert.IloNumVar[] var,
                          int start,
                          int num)
                   throws IloException
Returns the current upper bounds for a set of variables. The bounds may be different from the bounds the variables have in the active model, since branching or bound strengthening may have been applied to them.

Parameters:
var - An array containing the variables whose current upper bounds are being queried.
start - The index of the first variable in var for which to query the current upper bound.
num - The number of variables in var for which to query the current upper bounds.
Returns:
An array of double values containing the current upper bounds for the specified variables. If the returned array is called ub, ub[j] contains the upper bound of variable var[j+start] at the current node, for j = 0, ..., num-1.
IloException

getObjValue

protected double getObjValue()
                      throws IloException
Returns the objective function value of the solution of the continuous relaxation of the current node.

Returns:
The objective function value of the solution of the continuous relaxation of the current node.
IloException

getValue

protected double getValue(ilog.concert.IloNumVar var)
                   throws IloException
Returns the solution value of a variable at the current node.

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

getValues

protected double[] getValues(ilog.concert.IloNumVar[] var)
                      throws IloException
Returns the solution values for an array of variables at the current node.

Parameters:
var - An array of variables whose current solution values are being queried.
Returns:
An array of double values containing the solution values of the specified variables at the current node. If the returned array is called x, x[j] contains the current solution value for variable var[j].
IloException

getValues

protected double[] getValues(ilog.concert.IloNumVar[] var,
                             int start,
                             int num)
                      throws IloException
Returns the solution values for a set of variables at the current node.

Parameters:
var - An array containing the variables whose current solution values are being queried.
start - The index of the first variable in var for which to query the current solution values.
num - The number of variables in var for which to query the current solution values.
Returns:
An array of double values containing the solution values of the specified variables at the current node. If the returned array is called x, x[j] contains the current solution value for variable var[j+start].
IloException

getSlack

protected double getSlack(ilog.concert.IloRange rng)
                   throws IloException
Returns the slack value of a constraint for the solution of the continuous relaxation of the current node.

Parameters:
rng - The constraint whose current slack value is being queried.
Returns:
The slack value of constraint rng for the solution of the continuous relaxation of the current node.
IloException

getSlacks

protected double[] getSlacks(ilog.concert.IloRange[] rng)
                      throws IloException
Returns the slack values of an array of constraints for the solution of the current node.

Parameters:
rng - An array of constraints whose current slack values are being queried.
Returns:
An array of double values containing the slack values of the specified constraints for the solution of the continuous relaxation of the current node. If the returned array is called s, s[i] contains the current slack value for constraint rng[i].
IloException

getSlacks

protected double[] getSlacks(ilog.concert.IloRange[] rng,
                             int start,
                             int num)
                      throws IloException
Returns the slack values of a set of constraints for the solution of the current node.

Parameters:
rng - An array containing the constraints whose current slack values are being queried.
start - The index of the first constraint in rng for which to query the current slack values.
num - The number of constraints in rng for which to query the current slack values.
Returns:
An array of double values containing the slack values of the specified constraints for the solution of the continuous relaxation of the current node. If the returned array is called s, s[i] contains the current slack value for constraint rng[i+start].
IloException

getValue

protected double getValue(ilog.concert.IloNumExpr expr)
                   throws IloException
Returns the value expr takes for the solution of the continuous relaxation of the current node.

Parameters:
expr - The expression for which to evaluate the current solution.
Returns:
The value expr takes for the solution of the continuous relaxation of the current node.
IloException

getDownPseudoCost

protected double getDownPseudoCost(ilog.concert.IloNumVar var)
                            throws IloException
Returns the pseudo cost for branching down on variable var.

Parameters:
var - The variable whose down pseudo cost is being queried.
Returns:
The pseudo cost for branching down on variable var.
IloException

getUpPseudoCost

protected double getUpPseudoCost(ilog.concert.IloNumVar var)
                          throws IloException
Returns the pseudo cost for branching up on variable var.

Parameters:
var - The variable whose up pseudo cost is being queried.
Returns:
The pseudo cost for branching up on variable var.
IloException

getFeasibility

protected IloCplex.IntegerFeasibilityStatus getFeasibility(ilog.concert.IloNumVar var)
                                                    throws IloException
Indicates whether the variable var is integer feasible, integer infeasible, or implied integer feasible in the current node solution.

Parameters:
var - The variable whose integer feasibility status is being queried.
Returns:
The integer feasibility status.
IloException

getFeasibilities

protected IloCplex.IntegerFeasibilityStatus[] getFeasibilities(ilog.concert.IloNumVar[] var)
                                                        throws IloException
Indicates whether the variables in array var are integer feasible, integer infeasible, or implied integer feasible in the current node solution.

Parameters:
var - The array of variables whose integer feasibility status is being queried.
Returns:
An array containing the integer feasibility statuses for the variables in var at the current node. The integer feasibility status of variable var[j] will be returned as element j of the returned array.
IloException

getFeasibilities

protected IloCplex.IntegerFeasibilityStatus[] getFeasibilities(ilog.concert.IloNumVar[] var,
                                                               int start,
                                                               int num)
                                                        throws IloException
Indicates whether the variables specified in array var are integer feasible, integer infeasible, or implied integer feasible in the current node solution.

Parameters:
var - An array containing the variables whose integer feasibility status is being queried.
start - The index of the first variable in the array var for which the integer feasibility status are queried.
num - The number of variables in the array var, for which the integer infeasibility statuses are queried.
Returns:
An array containing the integer feasibility statuses for the specified variables in var at the current node. If the returned array is inf, the feasibility status for variable var[start+j] will be returned as inf[j].
IloException

getSOSFeasibility

protected IloCplex.IntegerFeasibilityStatus getSOSFeasibility(ilog.concert.IloSOS1 sos)
                                                       throws IloException
Indicates whether the special ordered set of type 1 is integer feasible, integer infeasible, or implied integer feasible in the current node solution.

Parameters:
sos - The SOS1 for which the integer feasibility status is queried.
Returns:
The integer feasibility status for sos.
IloException

getSOSFeasibility

protected IloCplex.IntegerFeasibilityStatus getSOSFeasibility(ilog.concert.IloSOS2 sos)
                                                       throws IloException
Indicates whether the special ordered set of type 2 is integer feasible, integer infeasible, or implied integer feasible in the current node solution.

Parameters:
sos - The SOS2 for which the integer feasibility status is queried.
Returns:
The integer feasibility status for sos.
IloException

getNodeData

protected java.lang.Object getNodeData()
                                throws IloException
Returns the user object attached to the current node. User objects can be attached to a node when the node is created with the method IloCplex.BranchCallback.makeBranch in a branch callback.

Returns:
The user object attached to the current node. If no user object is attached to the current node, null will be returned.
IloException