public abstract static class IloCplex.MIPInfoCallback extends IloCplex.Callback
An instance of the class MIPInfoCallback represents a
user-written callback in an application that uses an instance of
IloCplex to solve a mixed integer program (MIP).
IloCplex calls the user-written callback prior to solving each
node in the branch-and-cut search. This class allows you to access an
incumbent solution, an incumbent node, and an incumbent objective value from
a user-written callback. It also allows you to access priority orders and
statistical information, such as the number of cuts that have been generated.
Methods are also available to query the number of generated cuts for each
type of cut CPLEX generates. See the ILOG CPLEX User's Manual for more
information about cuts.
This class also provides a common application programming interface (API) for these subclasses:
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.
| Modifier | Constructor and Description |
|---|---|
protected |
IloCplex.MIPInfoCallback()
Constructor for user-written MIP informational callback.
|
| Modifier and Type | Method and Description |
|---|---|
protected double |
getBestObjValue()
This method returns a bound on the optimal solution value of the active
problem at the moment the callback is called.
|
protected double |
getCutoff()
Returns the cutoff for the objective value when nodes are being solved during
branch-and-cut search.
|
protected IloCplex.BranchDirection |
getDirection(IloNumVar var)
Returns the branch direction for variable
var. |
protected double |
getIncumbentObjValue()
Returns the objective value of the current best integer solution at the
moment the callback is called.
|
protected double |
getIncumbentValue(IloNumExpr expr)
Returns the value of
expr for the current best integer solution. |
protected double |
getIncumbentValue(IloNumVar var)
Returns the value of
var for the current best integer solution. |
protected double[] |
getIncumbentValues(IloNumVar[] vars)
Returns incumbent solution values for an array of variables.
|
protected double[] |
getIncumbentValues(IloNumVar[] vars,
int start,
int num)
Returns the incumbent solution values for a set of variables.
|
protected double |
getMIPRelativeGap() |
protected int |
getMyThreadNum()
Returns the identifier of the parallel thread being currently executed.
|
protected int |
getNiterations()
Returns the total number of iterations for solving node relaxations during
the current optimization.
|
protected int |
getNnodes()
Returns the number of nodes processed so far in the active branch-and-cut
search.
|
protected int |
getNremainingNodes()
Returns the number of nodes remaining to be processed, or, equivalently, the
number of active nodes in the tree.
|
protected int |
getPriority(IloNumVar var)
Returns the branch priority for variable
var. |
protected boolean |
hasIncumbent()
Returns
true if an incumbent solution has been found when the
callback is called. |
abort, getCplexTime, getDetTime, getEndDetTime, getEndTime, getEnvImpl, getModel, getNcols, getNQCs, getNrows, getStartDetTime, getStartTime, mainprotected IloCplex.MIPInfoCallback()
This constructor can be called only to construct objects of derived
user-written callback classes, but not to construct
MIPInfoCallback objects directly.
protected double getBestObjValue()
IloException - If the method fails, an exception of type
IloException, or one of its derived
classes, is thrown.protected double getCutoff()
throws IloException
IloExceptionprotected double getIncumbentObjValue()
throws IloException
IloExceptionprotected double getIncumbentValue(IloNumVar var) throws IloException
var for the current best integer solution.
This method returns the value of variable var in the current
incumbent solution (that is, the best integer solution found so far).IloExceptionvar - The variable whose incumbent solution value is being queried.var in the current incumbent
solution.protected double getMIPRelativeGap()
protected double getIncumbentValue(IloNumExpr expr) throws IloException
expr for the current best integer solution.
This method returns the value of variable expr in the current
incumbent solution (that is, the best integer solution found so far).IloExceptionexpr - The expression whose incumbent solution value is being queried.var in the current incumbent
solution.protected int getMyThreadNum()
This number is between 0 (zero) and the value returned by the method
getUserThreads()-1.
protected IloCplex.BranchDirection getDirection(IloNumVar var)
var.var - The variable whose branch direction is being queried.var.protected int getPriority(IloNumVar var)
var.var - The variable whose branch priority is being queried.varprotected double[] getIncumbentValues(IloNumVar[] vars) throws IloException
IloExceptionvars - The array of variables whose incumbent solution values are being
queried.var. The solution value for variable var[j]
is returned as element j of the returned array.protected double[] getIncumbentValues(IloNumVar[] vars, int start, int num) throws IloException
IloExceptionvars - An array containing the variables whose incumbent solution
values are being queried.start - The index of the first variable in vars for which
to return the incumbent solution value.num - The number of variables in vars for which to return
the incumbent solution values.var. The solution for variable var[j+start]
is returned as element j of the returned array.protected int getNiterations()
throws IloException
IloExceptionprotected int getNnodes()
throws IloException
IloExceptionprotected int getNremainingNodes()
throws IloException
IloExceptionprotected boolean hasIncumbent()
throws IloException
true if an incumbent solution has been found when the
callback is called.IloExceptiontrue if an incumbent solution has been found.