|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ilog.cplex.IloCplex.Callback | +--ilog.cplex.IloCplex.MIPCallback | +--ilog.cplex.IloCplex.ControlCallback | +--ilog.cplex.IloCplex.HeuristicCallback
A callback class to use when IloCplex
is solving a MIP.
An instance of the this class represents a user-written
callback in an application that uses an instance of IloCplex
to solve a mixed integer programming problem (a MIP). When you derive a
user-defined class of callbacks, this
class offers protected methods for you to:
IloCplex
a potential new incumbent
solution;
IloCplex
about the solution status
for the node LP at the current node;
IloCplex
about the current bounds
at that node;
In short, this callback allows you to attempt to construct an integer
feasible solution at a node and pass it to an instance of
IloCplex
to use for its new incumbent. The API allows you
iteratively to change bounds of
the node LP and re-solve the LP. Changing the bounds in the heuristic
callback has no effect on the search beyond the termination of the
callback.
The heuristic callback is called after the node of the LP has been solved (including all cuts that may have been generated).
If an attempt is made to access information not available at the node for
the invoking instance of IloCplex
, an exception is thrown.
IloCplex.ControlCallback
Constructor Summary | |
protected |
IloCplex.HeuristicCallback()
Constructs a user-written callback class which attempts to find an integer feasible solution at a node, and pass it to IloCplex as the new incumbent. |
Method Summary | |
protected IloCplex.CplexStatus |
getCplexStatus()
This method returns the ILOG CPLEX status of the instance of IloCplex at the current node (that is, the state of the
optimizer at the node) during the last call to solve (which may have
been called directly in the callback or by IloCplex when
processing the node LP). |
protected IloCplex.Status |
getStatus()
Returns the solution status. |
protected void |
setBounds(IloNumVar[] var,
double[] lb,
double[] ub)
Changes the upper and lower bounds variable in the array var . |
protected void |
setBounds(IloNumVar[] var,
double[] lb,
double[] ub,
int start,
int num)
Changes the upper and lower bounds variable in the array var . |
protected void |
setBounds(IloNumVar var,
double lb,
double ub)
Changes the upper and lower bounds for a single variable var . |
protected void |
setSolution(IloNumVar[] vars,
double[] vals)
Sets solution variables to the values at the current node. |
protected void |
setSolution(IloNumVar[] vars,
double[] vals,
double obj)
Sets solution variables to the values at the current node. |
protected void |
setSolution(IloNumVar[] vars,
double[] vals,
int start,
int num)
Sets solution variables to the values at the current node. |
protected void |
setSolution(IloNumVar[] vars,
double[] vals,
int start,
int num,
double obj)
Sets solution variables to the values at the current node. |
protected boolean |
solve()
Solves the current node LP using the default algorithm. |
protected boolean |
solve(int alg)
Solves the current node LP using a chosen algorithm. |
Methods inherited from class ilog.cplex.IloCplex.ControlCallback |
getDownPseudoCost,
getFeasibilities,
getFeasibilities,
getFeasibility,
getLB,
getLBs,
getLBs,
getObjCoef,
getObjCoefs,
getObjCoefs,
getObjValue,
getSlack,
getSlacks,
getSlacks,
getSOSFeasibility,
getSOSFeasibility,
getUB,
getUBs,
getUBs,
getUpPseudoCost,
getValue,
getValue,
getValues,
getValues |
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 |
protected IloCplex.HeuristicCallback()
IloCplex
as the new incumbent.Method Detail |
protected void setBounds(IloNumVar var, double lb, double ub) throws IloException
var
.
For the variable var
, this method sets its
upper bound to the corresponding value ub
and
its lower bound to the value
lb
. Setting bounds has no effect beyond the scope of the
current invocation of the callback.var
- The variable for which the bounds are to be changed.lb
- The lower bound of var
to be changed.ub
- The upper bound of var
to be changed.protected void setBounds(IloNumVar[] var, double[] lb, double[] ub) throws IloException
var
.
For each variable in the array var
, this method sets its
upper bound to the corresponding value in the array ub
and
its lower bound to the corresponding value in the array
lb
. Setting bounds has no effect beyond the scope of the
current invocation of the callback.var
- The array of variables for which the bounds are to be changed.lb
- The array of lower bounds to be set.ub
- The array of upper bounds to be set.protected void setBounds(IloNumVar[] var, double[] lb, double[] ub, int start, int num) throws IloException
var
.
For each variable in the array var
, this method sets its
upper bound to the corresponding value in the array ub
and
its lower bound to the corresponding value in the array
lb
. Setting bounds has no effect beyond the scope of the
current invocation of the callback.var
- The array of variables for which the bounds are to be changed.lb
- The array of lower bounds to be set.ub
- The array of upper bounds to be set.start
- The index of the first variable in var
for
which the bounds are to be set.num
- The number of variables in var
for
which the bounds are to be set.protected boolean solve(int alg)
setBounds
. The algorithm
alg
will be used to find the solution.alg
- The algorithm to use to solve the node LP.IloCplex.Algorithm
protected boolean solve()
setBounds
. It
uses the dual simplex algorithm to find the solution.protected IloCplex.Status getStatus()
IloCplex
at the current node during the last call to solve
(which may have been called directly in the callback or by
IloCplex
when processing the node LP).
The class IloCplex.Status lists the possible status values.
protected IloCplex.CplexStatus getCplexStatus()
IloCplex
at the current node (that is, the state of the
optimizer at the node) during the last call to solve (which may have
been called directly in the callback or by IloCplex
when
processing the node LP).
The class IloCplex.CplexStatus lists the possible status values.
protected void setSolution(IloNumVar[] vars, double[] vals, int start, int num) throws IloException
vars
, this method uses the
value in the corresponding element of the array vals
to
set the value of the variable at the current node.
If the user heuristic was successful in finding a new candidate for an
incumbent, setSolution
can be used to pass it over to
IloCplex
. IloCplex
then analyses the solution
and, if it is both feasible and better than the current incumbent, uses
it as the new incumbent. A solution is specified using arrays
vars
and vals
, where vals[i]
specifies the solution value for vars[i]
.
vars
- An array of variables to be set to the current node value.vals
- The array of values to which var
will be set.start
- The index of the first variable in the array
var
to be set.num
- The number of variables in var
to be set.protected void setSolution(IloNumVar[] vars, double[] vals) throws IloException
vars
, this method uses the
value in the corresponding element of the array vals
to
set the value of the variable at the current node.
If the user heuristic was successful in finding a new candidate for an
incumbent, setSolution
can be used to pass it over to
IloCplex
. IloCplex
then analyses the solution
and, if it is both feasible and better than the current incumbent, uses
it as the new incumbent. A solution is specified using arrays
vars
and vals
, where vals[i]
specifies the solution value for vars[i]
.
vars
- An array of variables to be set to the current node value.vals
- The array of values to which var
will be set.protected void setSolution(IloNumVar[] vars, double[] vals, int start, int num, double obj) throws IloException
vars
, this method uses the
value in the corresponding element of the array vals
to
set the value of the variable at the current node. obj
is
used as the objective value at the current node.
If the user heuristic was successful in finding a new candidate for an
incumbent, setSolution
can be used to pass it over to
IloCplex
. IloCplex
then analyses the solution
and, if it is both feasible and better than the current incumbent, uses
it as the new incumbent. A solution is specified using arrays
vars
and vals
, where vals[i]
specifies the solution value for vars[i]
.
vars
- An array of variables to be set to the current node value.vals
- The array of values to which var
will be set.start
- The index of the first variable in the array
var
to be set.num
- The number of variables in var
to be set.obj
- The objective value at the current node.protected void setSolution(IloNumVar[] vars, double[] vals, double obj) throws IloException
vars
, this method uses the
value in the corresponding element of the array vals
to
set the value of the variable at the current node. obj
is
used as the objective value at the current node.
If the user heuristic was successful in finding a new candidate for an
incumbent, setSolution
can be used to pass it over to
IloCplex
. IloCplex
then analyses the solution
and, if it is both feasible and better than the current incumbent, uses
it as the new incumbent. A solution is specified using arrays
vars
and vals
, where vals[i]
specifies the solution value for vars[i]
.
vars
- An array of variables to be set to the current node value.vals
- The array of values to which var
will be set.obj
- The objective value at the current node.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |