ilog.cplex
Class IloCplex.IncumbentCallback

java.lang.Object
  |
  +--ilog.cplex.IloCplex.Callback
        |
        +--ilog.cplex.IloCplex.MIPCallback
              |
              +--ilog.cplex.IloCplex.IncumbentCallback
All Implemented Interfaces:
java.lang.Cloneable
Enclosing class:
IloCplex

public abstract static class IloCplex.IncumbentCallback
extends IloCplex.MIPCallback

This callback class is called whenever a new potential incumbent is found during the branch-and-cut search. It allows you to analyze the proposed incumbent and optionally reject it. In this case, IloCplex will continue the branch-and-cut search. However, since CPLEX consideres the current node solution to be integer feasible, it will not be able to determine a reasonable way to branch. Thus, when this callback is implemented in such a way that it may reject an incumbent, it is typically paired with a branch callback to perform the branching after an incumbent has been rejected.

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.MIPCallback

Constructor Summary
protected IloCplex.IncumbentCallback()
          Constructor for user-written incumbent callback.
 
Method Summary
protected  java.lang.Object getNodeData()
          Returns the user object attached to the current node.
protected  IloCplex.NodeId getNodeId()
          Returns the node identifier of the current node.
protected  double getObjValue()
          Returns the objective value of the potential incumbent.
protected  double getSlack(ilog.concert.IloRange rng)
          Returns the slack value of a constraint for the proposed incumbent solution.
protected  double[] getSlacks(ilog.concert.IloRange[] rng)
          Returns the slack values for an array of constraints for the proposed incumbent solution.
protected  double[] getSlacks(ilog.concert.IloRange[] rng, int start, int num)
          Returns the slack values for a set of constraints for the proposed incumbent solution.
protected  double getValue(ilog.concert.IloNumExpr expr)
          Returns the value expr takes for the proposed incumbent solution.
protected  double getValue(ilog.concert.IloNumVar var)
          Returns the value of the variable var in the potential incumbent solution.
protected  double[] getValues(ilog.concert.IloNumVar[] var)
          Returns the values of variables in the array var in the potential incumbent solution.
protected  double[] getValues(ilog.concert.IloNumVar[] var, int start, int num)
          Returns the values of num variables in the array var of variables in the potential incumbent solution.
protected  void reject()
          Rejects the proposed incumbent solution.
 
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.IncumbentCallback

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

Method Detail

getObjValue

protected double getObjValue()
                      throws IloException
Returns the objective value of the potential incumbent.

Returns:
The objective value of the potential incumbent.
IloException

getValue

protected double getValue(ilog.concert.IloNumVar var)
                   throws IloException
Returns the value of the variable var in the potential incumbent solution.

Parameters:
var - The variable whose value is to be returned.
Returns:
The value of var in the potential incumbent solution.
IloException

getValues

protected double[] getValues(ilog.concert.IloNumVar[] var)
                      throws IloException
Returns the values of variables in the array var in the potential incumbent solution.

Parameters:
var - The array of variables whose values are required.
Returns:
An array containing the values of the proposed incumbent for the variables in the array var. If the the returned array is val, val[j] is the proposed incumbent value for variable var[j].
IloException

getValues

protected double[] getValues(ilog.concert.IloNumVar[] var,
                             int start,
                             int num)
                      throws IloException
Returns the values of num variables in the array var of variables in the potential incumbent solution.

Parameters:
var - The array containing the variables whose proposed incumbent values are being queried.
start - The index of the first variable in array var for which the proposed incumbent value is requested.
num - The number of variables in array var for which the proposed incumbent value is requested.
Returns:
An array containing the values of the proposed incumbent for the specified variables in the array var. If the returned array is val, val[j] is the proposed incumbent value for variable var[j+start].
IloException

getValue

protected double getValue(ilog.concert.IloNumExpr expr)
                   throws IloException
Returns the value expr takes for the proposed incumbent solution.

Parameters:
expr - The expression for which to evaluate the proposed incumbent solution.
Returns:
The value expr takes for the solution of the proposed incumbent solution.
IloException

getSlack

protected double getSlack(ilog.concert.IloRange rng)
                   throws IloException
Returns the slack value of a constraint for the proposed incumbent solution.

Parameters:
rng - The constraint whose slack value is being queried.
Returns:
The slack value of constraint rng for the proposed incumbent solution.
IloException

getSlacks

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

Parameters:
rng - An array of constraints whose slack values are being queried.
Returns:
An array of double values containing the slack values for the proposed incumbent solution for the specified constraints. If the returned array is called s, s[i] contains the 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 for a set of constraints for the proposed incumbent solution.

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

getNodeId

protected IloCplex.NodeId getNodeId()
                             throws IloException
Returns the node identifier of the current node.

Returns:
the node identifier of the current node.
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

reject

protected void reject()
Rejects the proposed incumbent solution.