ilog.cplex
Class IloCplex.ControlCallback

java.lang.Object
  |
  +--ilog.cplex.IloCplex.Callback
        |
        +--ilog.cplex.IloCplex.MIPCallback
              |
              +--ilog.cplex.IloCplex.ControlCallback
Direct Known Subclasses:
IloCplex.BranchCallback, IloCplex.CutCallback, IloCplex.HeuristicCallback

public abstract static class IloCplex.ControlCallback
extends IloCplex.MIPCallback

The control callback class is a base class for other callback classes. It is the base class for the following callback classes that allow you to query or take control over the branch and cut search conducted by the CPLEX MIP optimizer:

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 for at each node of 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.SolveCallback: This callback is called whenever an LP needs to be solved at a node. Note that this can happen more than once if cuts are added to the LP either by IloCplex itself or from a UserCutCallback or LazyConstraintCallback.
  2. IloCplex.UserCutCallback: Once the node LP 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 LP is solved again. This is iterated until no more cuts are added to the problem.
  3. IloCplex.LazyConstraintCallback: Once the node LP 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 LP is solved again. This is iterated until no more cuts are added to the problem.
  4. IloCplex.HeuristicCallback: Once the node has been fully solved (that is including all the cuts that might have been added), the heuristic callback is called in an attempt to generate an integer feasible solution from the current LP solution at that node.
  5. IloCplex.BranchCallback: Finally, if the LP solution at the current node is either integer infeasible or rejected by a user IloCplex.IncumbentCallback, the problem is split into subproblems. At that point the IloCplex.BranchCallback can be used to control how to create the subproblems.

See Also:
IloCplex.Callback, IloCplex.BranchCallback, IloCplex.UserCutCallback, IloCplex.LazyConstraintCallback, IloCplex.HeuristicCallback, IloCplex.SolveCallback

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

getLBs

protected double[] getLBs(IloNumVar[] var)
Gets the current lower bounds for an array of variables.
Parameters:
var - An array of variables for which to query the current lower bound.
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] in the LP of the current node.

getLBs

protected double[] getLBs(IloNumVar[] var,
                          int start,
                          int num)
Gets the current lower bounds for a set of variables.
Parameters:
var - An array containing the variables for which to query the current lower bound.
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 bound.
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] in the LP of the current node, for j = 0, ..., num-1.

getUB

protected double getUB(IloNumVar var)
Gets the upper bound for variable var at the current node.
Parameters:
var - The variable for which to query the current upper bound.
Returns:
The upper bound for variable var in the LP at the current node.

getUBs

protected double[] getUBs(IloNumVar[] var)
Gets the current upper bounds for an array of variables.
Parameters:
var - An array of variables for which to query the current upper bound.
Returns:
An array of double values containing the current upper bounds for the specified variables. If the returned array is called lb, lb[j] contains the upper bound of variable var[j] in the LP of the current node.

getUBs

protected double[] getUBs(IloNumVar[] var,
                          int start,
                          int num)
Gets the current upper bounds for a set of variables.
Parameters:
var - An array containing the variables for which to query the current upper bound.
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 bound.
Returns:
An array of double values containing the current upper bounds for the specified variables. If the returned array is called lb, lb[j] contains the upper bound of variable var[j+start] in the LP of the current node, for j = 0, ..., num-1.

getObjValue

protected double getObjValue()
Gets the objective function of the solution of the current node LP.
Returns:
The objective function of the solution of the current node LP.

getValue

protected double getValue(IloNumVar var)
Gets the value of a variable in the solution of the current node LP.
Parameters:
var - The variable for which to query the current solution value.
Returns:
The value of variable var in the solution of the current node LP.

getValues

protected double[] getValues(IloNumVar[] var)
Gets the values of an array of variables in the solution of the current node LP.
Parameters:
var - An array of variables for which to query the current solution values.
Returns:
An array of double values containing the solution values in the current node LP for the specified variables. If the returned array is called x, x[j] contains the current solution value for variable var[j].

getValues

protected double[] getValues(IloNumVar[] var,
                             int start,
                             int num)
Gets the values of a set of variables in the solution of the current node LP.
Parameters:
var - An array containing the variables for which to query the current solution values.
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 in the current node LP for the specified variables. If the returned array is called x, x[j] contains the current solution value for variable var[j].

getSlack

protected double getSlack(IloRange rng)
Gets the slack value of a constraint in the solution of the current node LP.
Parameters:
rng - The constraint for which to query the current slack value.
Returns:
The slack value of constraint rng in the solution of the current node LP.

getSlacks

protected double[] getSlacks(IloRange[] rng)
Gets the slack values for an array of constraints in the solution of the current node LP.
Parameters:
rng - An array of constraints for which to query the current slack values.
Returns:
An array of double values containing the slack values in the current node LP for the specified constraints. If the returned array is called x, x[j] contains the current slack value for constraints rng[j].

getSlacks

protected double[] getSlacks(IloRange[] rng,
                             int start,
                             int num)
Gets the slack values for a set of constraints in the solution of the current node LP.
Parameters:
rng - An array containing the constraints for which to query the current slack values.
start - The index of the first variable in var for which to query the current slack values.
num - The number of variables in var for which to query the current slack values.
Returns:
An array of double values containing the slack values in the current node LP for the specified constraints. If the returned array is called x, x[j] contains the current slack value for constraints rng[j].

getValue

protected double getValue(IloNumExpr expr)
                   throws IloException
Gets the value expr takes for the solution of the current node LP.
Parameters:
expr - The expression for which to evaluate the solution.
Returns:
The value expr takes for the solution of the current node LP.

getObjCoef

protected double getObjCoef(IloNumVar var)
Gets the linear objective function coefficient for variable var in the model being solved.
Parameters:
var - The variable for which to query the linear objective coefficient.
Returns:
The linear objective coefficient for variable var in the model being solved.

getObjCoefs

protected double[] getObjCoefs(IloNumVar[] vars)
Gets the linear objective function coefficients for an array of variables.
Parameters:
var - An array of variables 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 the returned array is called obj, obj[j] contains the linear objective function coefficient for variable var[j].

getObjCoefs

protected double[] getObjCoefs(IloNumVar[] vars,
                               int start,
                               int num)
Gets the linear objective function coefficients for a set of variables.
Parameters:
var - An array containing variables for which to query the linear objective function coefficients.
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 the returned array is called obj, obj[j] contains the linear objective function coefficient for variable var[j+start], for j = 0, ..., num-1.

getDownPseudoCost

protected double getDownPseudoCost(IloNumVar var)
Gets the pseudo cost for branching down on variable var.
Parameters:
var - The variable for which to query the down pseudo cost.
Returns:
The pseudo cost for branching down on variable var.

getUpPseudoCost

protected double getUpPseudoCost(IloNumVar var)
Gets the pseudo cost for branching up on variable var.
Parameters:
var - The variable for which to query the up pseudo cost.
Returns:
The pseudo cost for branching up on variable var.

getFeasibility

protected IloCplex.IntegerFeasibilityStatus getFeasibility(IloNumVar var)
Indicates whether the variable var is integer feasible, integer infeasible, or implied integer feasible in the current node solution.
Parameters:
var - The variable for which the integer feasibility status is to be queried.
Returns:
The integer feasibility status.

getFeasibilities

protected IloCplex.IntegerFeasibilityStatus[] getFeasibilities(IloNumVar[] var)
Indicates whether the variables in the IloNumVar array var are integer feasible, integer infeasible, or implied integer feasible in the current node solution.
Parameters:
var - The array of variables for which the integer feasibility status is queried.
Returns:
The integer feasibility status.

getFeasibilities

protected IloCplex.IntegerFeasibilityStatus[] getFeasibilities(IloNumVar[] var,
                                                               int start,
                                                               int num)
Indicates whether the variables in the IloNumVar array var are integer feasible, integer infeasible, or implied integer feasible in the current node solution.
Parameters:
var - An array containing variables for which the integer feasibility status is to be queried.
start - The index of the first variable in the array var for which the integer feasibility status is to be queried.
num - The number of variables in the array var, starting with start, for which the integer infeasibility status is to be queried.
Returns:
The integer feasibility status.

getSOSFeasibility

protected IloCplex.IntegerFeasibilityStatus getSOSFeasibility(IloSOS1 sos)
Indicates whether the special ordered set type 1 is integer feasible, integer infeasible, or implied integer feasible in the current node solution.
Parameters:
sos - The SOS1 for which integer feasibility is to be queried.
Returns:
The integer feasibility status.

getSOSFeasibility

protected IloCplex.IntegerFeasibilityStatus getSOSFeasibility(IloSOS2 sos)
Indicates whether the special ordered set type 2 is integer feasible, integer infeasible, or implied integer feasible in the current node solution.
Parameters:
sos - The SOS2 for which integer feasibility is to be queried.
Returns:
The integer feasibility status.