| Overview | Group | Tree | Graph | Deprecated | Index | Concepts |

This is an advanced class. Advanced classes typically demand a profound understanding of the algorithms used by CPLEX. Thus they incur a higher risk of incorrect behavior in your application, behavior that can be difficult to debug. Therefore, the team encourages you to consider carefully whether you can accomplish the same task by means of other classes instead.
This class defines the common application programming interface (API) for the following classes that allow you to control the MIP search:
IloCplex::SolveCallbackIIloCplex::UserCutCallbackIIloCplex::LazyConstraintCallbackIIloCplex::HeuristicCallbackIIloCplex::BranchCallbackIAn instance of one of these classes
represents a user-written callback that intervenes in the search for a
solution at a given node in an application that uses an instance of
IloCplex to solve a mixed integer program (MIP). Control
callbacks are tied to a node. They are called at each node during
IloCplex branch-and-cut search. The user never subclasses
the IloCplex::ControlCallbackI class directly; it
defines only the common interface of those listed callbacks.
In particular, SolveCallbackI is called before solving the
node relaxation and optionally allows substitution of its solution.
IloCplex does this by default. Then the node relaxation is
solved, either by an instance of SolveCallbackI or by
IloCplex. If the solution is integer feasible or the
relaxation is unbounded
IloCplex::LazyConstraintCallbackI is
invoked; otherwise, the other control callbacks are called in the
following order:
If the cut callback added new cuts to the node relaxation, the node
relaxation will be solved again using the solve callback, if used. The same
is true if IloCplex generated its own cuts.
The methods of this class are protected and its constructor is private; you cannot directly subclass this class; you must derive from its subclasses.
If an attempt is made to access information not available to an instance of this class, an exception is thrown.
Unbounded raysIn the case where the node LP is unbounded, the methods
getValue return a vector that corresponds to an
unbounded direction. The vector is scaled in such a way that the
maximum absolute value of one of its elements is
CPX_INFBOUND. Thus, often the vector
can be used directly, for example to separate lazy constraints. However,
due to the large values, care must be taken to deal with potential
numerical errors. If in doubt, rescale the vector, and use it as an
unbounded ray rather than as a primal vector.
See Also:
IloCplex, IloCplex::Callback, IloCplex::CallbackI, ControlCallbackI::IntegerFeasibility, ControlCallbackI::IntegerFeasibilityArray, IloCplex::MIPCallbackI, IloCplex::OptimizationCallbackI
Inherited Methods from MIPCallbackI |
|---|
getCurrentNodeDepth, getObjCoef, getObjCoef, getObjCoefs, getObjCoefs, getType, getUserThreads, MIPCallbackI |
Inherited Methods from OptimizationCallbackI |
|---|
getModel, getNcols, getNQCs, getNrows |
Inherited Methods from CallbackI |
|---|
abort, duplicateCallback, getCplexTime, getDetTime, getEndDetTime, getEndTime, getEnv, getStartDetTime, getStartTime, getType, main |
| Inner Enumeration |
|---|
| ControlCallbackI::IntegerFeasibility |
| Inner Typedef |
|---|
| ControlCallbackI::IntegerFeasibilityArray |
| Inner Class |
|---|
| ControlCallbackI::PresolvedVariableException |
| Method Detail |
|---|
This method returns the current pseudo cost for branching
downward on the variable var.
This method returns the current pseudo cost for branching
downward on the variable var.
This method specifies whether each of the variables
in the array vars is integer feasible,
integer infeasible, or implied integer feasible by putting
the status in the corresponding element of the array
stats.
Before you query the feasibility of a solution from
a solve callback, a solution must exist. That is,
you must first create the solution by calling the CPLEX
optimization method solve, and then you
must verify that the method solve
generated a solution by checking its return value
before you invoke the method
getFeasibilities.
This method specifies whether each of the variables
in the array vars is integer feasible,
integer infeasible, or implied integer feasible by putting
the status in the corresponding element of the array
stats.
Before you query the feasibility of a solution from
a solve callback, a solution must exist. That is,
you must first create the solution by calling the CPLEX
optimization method solve, and then you
must verify that the method solve
generated a solution by checking its return value
before you invoke the method
getFeasibilities.
This method specifies whether the variable
var is integer feasible, integer infeasible,
or implied integer feasible in the current node solution.
Before you query the feasibility of a solution from
a solve callback, a solution must exist. That is,
you must first create the solution by calling the CPLEX
optimization method solve, and then you
must verify that the method solve
generated a solution by checking its return value
before you invoke the method
getFeasibility.
This method specifies whether the variable
var is integer feasible, integer infeasible,
or implied integer feasible in the current node solution.
Before you query the feasibility of a solution from
a solve callback, a solution must exist. That is,
you must first create the solution by calling the CPLEX
optimization method solve, and then you
must verify that the method solve
generated a solution by checking its return value
before you invoke the method
getFeasibility.
This method specifies whether the Special Ordered Set
sos is integer feasible, integer infeasible,
or implied integer feasible in the current node solution.
Before you query the feasibility of a solution from
a solve callback, a solution must exist. That is,
you must first create the solution by calling the CPLEX
optimization method solve, and then you
must verify that the method solve
generated a solution by checking its return value
before you invoke the method
getFeasibility.
This method specifies whether the Special Ordered Set
sos is integer feasible, integer infeasible,
or implied integer feasible in the current node solution.
Before you query the feasibility of a solution from
a solve callback, a solution must exist. That is,
you must first create the solution by calling the CPLEX
optimization method solve, and then you
must verify that the method solve
generated a solution by checking its return value
before you invoke the method
getFeasibility.
This method returns the lower bound of
var at the current node. This bound is
likely to be different from the bound in the original
model because an instance of IloCplex
tightens bounds when it branches from a node to its subnodes.
The corresponding solution value from getValue may
violate this bound at a node where a new incumbent has been found
because the bound is tightened when an incumbent is found.
Unbounded Variables
If a variable lacks a lower bound, then getLB
returns -IloInfinity (that is, the system-specific
least value).
This method returns the lower bound of
var at the current node. This bound is
likely to be different from the bound in the original
model because an instance of IloCplex
tightens bounds when it branches from a node to its subnodes.
The corresponding solution value from getValue may
violate this bound at a node where a new incumbent has been found
because the bound is tightened when an incumbent is found.
Unbounded Variables
If a variable lacks a lower bound, then getLB
returns -IloInfinity (that is, the system-specific
least value).
For each element of the array vars,
this method puts the lower bound at the current node
into the corresponding element of the array vals.
These bounds are likely to be different from the bounds
in the original model because an instance of IloCplex
tightens bounds when it branches from a node to its subnodes.
The corresponding solution values from getValues may
violate these bounds at a node where a new incumbent has been found
because the bounds are tightened when an incumbent is found.
Unbounded Variables
If a variable lacks a lower bound, then getLBs
returns -IloInfinity (that is, the system-specific
least value).
This method puts the lower bound at the
current node of each element of the array vars
into the corresponding element of the array vals.
These bounds are likely to be different from the bounds
in the original model because an instance of IloCplex
tightens bounds when it branches from a node to its subnodes.
The corresponding solution values from getValues may
violate these bounds at a node where a new incumbent has been found
because the bounds are tightened when an incumbent is found.
Unbounded Variables
If a variable lacks a lower bound, then getLBs
returns -IloInfinity (that is, the system-specific
least value).
This method retrieves the NodeData
object that may have previously been assigned to the current node
by the user with
the method IloCplex::BranchCallbackI::makeBranch.
If no data object has been assigned to the current node,
the method returns 0 (zero).
Returns the NodeId of the current node.
See MIPCallbackI::NodeId.
This method returns the objective value of the solution at the current node.
If you need the object representing the objective itself,
consider the method
IloCplex::getObjective instead.
This method returns the slack value for
the constraint specified by rng in
the solution of the relaxation at the current node.
For each of the constraints in the array of ranges rngs,
this method puts the slack value in the solution of the relaxation
at the current node
into the corresponding element of the array vals.
This method returns the upper bound
of the variable var
at the current node. This bound is likely to be
different from the bound in the original model
because an instance of IloCplex tightens
bounds when it branches from a node to its subnodes.
The corresponding solution value from getValue may
violate this bound at a node where a new incumbent has been found
because the bound is tightened when an incumbent is found.
Unbounded Variables
If a variable lacks an upper bound, then getUB
returns IloInfinity (that is, the system-specific
greatest value).
This method returns the upper bound
of the variable var
at the current node. This bound is likely to be
different from the bound in the original model
because an instance of IloCplex tightens
bounds when it branches from a node to its subnodes.
The corresponding solution value from getValue may
violate this bound at a node where a new incumbent has been found
because the bound is tightened when an incumbent is found.
Unbounded Variables
If a variable lacks an upper bound, then getUB
returns IloInfinity (that is, the system-specific
greatest value).
For each element in the array vars,
this method puts the upper bound at the current node
into the
corresponding element of the array vals.
The bounds are those in the relaxation at the current node.
These bounds are likely to be different from the bounds
in the original model because an instance of
IloCplex tightens
bounds when it branches from a node to its subnodes.
The corresponding solution values from getValues may
violate these bounds at a node where a new incumbent has been found
because the bounds are tightened when an incumbent is found.
Unbounded Variables
If a variable lacks an upper bound, then getUBs
returns IloInfinity (that is, the system-specific
greatest value).
For each element in the array vars,
this method puts the upper bound at the current node
into the
corresponding element of the array vals.
The bounds are those in the relaxation at the current node.
These bounds are likely to be different from the bounds
in the original model because an instance of
IloCplex tightens
bounds when it branches from a node to its subnodes.
The corresponding solution values from getValues may
violate these bounds at a node where a new incumbent has been found
because the bounds are tightened when an incumbent is found.
Unbounded Variables
If a variable lacks an upper bound, then getUBs
returns IloInfinity (that is, the system-specific
greatest value).
This method returns the current pseudo cost for branching
upward on the variable var.
This method returns the current pseudo cost for branching
upward on the variable var.
This method returns the value of the
variable var in the solution of
the relaxation at the current node.
For special considerations about integrality, truncation, and rounding applicable to this method, see the concept Integer values, integrality tolerance, and round-off in CPLEX Optimizers.
This method returns the value of the
variable var in the solution of
the relaxation at the current node.
This method returns the value of the
expression expr in the solution of
the relaxation at the current node.
For each variable in the array vars,
this method puts the value in the solution of the relaxation
at the current node into the corresponding
element of the array vals.
For special considerations about integrality, truncation, and rounding applicable to this method, see the concept Integer values, integrality tolerance, and round-off in CPLEX Optimizers.
For each variable in the array vars,
this method puts the value in the solution of the relaxation
at the current node into the corresponding
element of the array vals.
This method returns IloTrue
if the solution of the LP at the current node is
SOS feasible for the special ordered set specified
in its argument. The SOS set passed as a parameter
to this method may be of type 2.
See the CPLEX User's Manual for more explanation of
types of special ordered sets.
Before you query the feasibility of a solution from
a solve callback, a solution must exist. That is,
you must first create the solution by calling the CPLEX
optimization method solve, and then you
must verify that the method solve
generated a solution by checking its return value
before you invoke the method
isSOSFeasible.
This method returns IloTrue
if the solution of the LP at the current node is
SOS feasible for the special ordered set specified
in its argument. The SOS set passed as a parameter
to this method may be of type 1.
See the CPLEX User's Manual for more explanation about
these types of special ordered sets.
Before you query the feasibility of a solution from
a solve callback, a solution must exist. That is,
you must first create the solution by calling the CPLEX
optimization method solve, and then you
must verify that the method solve
generated a solution by checking its return value
before you invoke the method
isSOSFeasible.
This method sets the NodeData object assigned to the
the current node. If a NodeData object has already been
set for the current node, then the method replaces this object
and returns the old object.
Otherwise, the method returns 0 (zero).
| Inner Enumeration Detail |
|---|
The enumeration
IloCplex::ControlCallbackI::IntegerFeasibility is an
enumeration limited in scope to the class
IloCplex::ControlCallbackI.
This enumeration is used by
IloCplex::ControlCallbackI::getFeasibility to represent the
integer feasibility of a variable or SOS in the current node solution:
Feasible specifies the variable or SOS is integer
feasible.ImpliedFeasible specifies the variable or SOS has
been presolved out. It will be feasible when all other integer variables
or SOS are integer feasible. Infeasible specifies the variable or SOS is
integer infeasible.See Also:
IloCplex, ControlCallbackI::IntegerFeasibilityArray
| Fields |
|---|
ImpliedInfeasible = -1 | |
Feasible = CPX_INTEGER_FEASIBLE | |
Infeasible = CPX_INTEGER_INFEASIBLE | |
ImpliedFeasible = CPX_IMPLIED_INTEGER_FEASIBLE |
| Inner Typedef Detail |
|---|
IloArray< IntegerFeasibility > IntegerFeasibilityArray
This type defines an array-type for
IloCplex::ControlCallbackI::IntegerFeasibility.
The fully qualified name of an integer feasibility array is
IloCplex::ControlCallbackI::IntegerFeasibility::Array.
See Also:
IloCplex, IloCplex::ControlCallbackI, ControlCallbackI::IntegerFeasibility