ilog.cplex
Class IloCplex.SolveCallback

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

public abstract static class IloCplex.SolveCallback
extends IloCplex.MIPCallback

The base class for user-written solve callbacks to control how node relaxations are solved within branch and cut.

An instance of this class can be used to solve nodes during a branch-and-cut search. It allows you to set a starting point when a node is being solved or to select the solution algorithm on a per-node basis.

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.SolveCallback()
          Constructor for user-written solve callback.
 
Method Summary
protected  IloCplex.CplexStatus getCplexStatus()
          Returns the IloCplex.CplexStatus of the last solve call.
protected  IloCplex.Status getStatus()
          Returns the solution status of the last solve call.
 boolean isDualFeasible()
          Returns true if a dual feasible solution is available for the current node.
 boolean isPrimalFeasible()
          Returns true if a primal feasible solution is available for the current node.
protected  void setVectors(double[] x, ilog.concert.IloNumVar[] var, double[] pi, ilog.concert.IloRange[] rng)
          Specifies a starting point for the next invocation of method solve.
protected  void setVectors(double[] x, ilog.concert.IloNumVar[] var, int xstart, int xnum, double[] pi, ilog.concert.IloRange[] rng, int cstart, int cnum)
          Specifies a starting point for the next invocation of the method solve.
protected  boolean solve()
          Solves the current node using the default algorithm (IloCplex.Algorithm.Auto).
protected  boolean solve(int alg)
          Solves the current node using the algorithm alg.
protected  void useSolution()
          Instructs IloCplex to use a 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.SolveCallback

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

Method Detail

solve

protected boolean solve(int alg)
                 throws IloException
Solves the current node using the algorithm alg. See IloCplex.Algorithm for a choice of algorithms to use.

Parameters:
alg - The IloCplex.Algorithm to use to solve the current node.
Returns:
A Boolean value indicating whether a feasible solution has been found.
IloException

solve

protected boolean solve()
                 throws IloException
Solves the current node using the default algorithm (IloCplex.Algorithm.Auto).

Returns:
A Boolean value indicating whether a feasible solution has been found.
IloException

getStatus

protected IloCplex.Status getStatus()
                             throws IloException
Returns the solution status of the last solve call.

Returns:
The solution status of the last solve call.
IloException

getCplexStatus

protected IloCplex.CplexStatus getCplexStatus()
                                       throws IloException
Returns the IloCplex.CplexStatus of the last solve call.

Returns:
The IloCplex.CplexStatus of the last solve call.
IloException

isDualFeasible

public boolean isDualFeasible()
                       throws IloException
Returns true if a dual feasible solution is available for the current node. If false is returned the solution may still be dual feasible, but the algorithm has not determined the feasibility before it terminated.

IloException

isPrimalFeasible

public boolean isPrimalFeasible()
                         throws IloException
Returns true if a primal feasible solution is available for the current node. If false is returned the solution may still be primal feasible, but the algorithm has not determined the feasibility before it terminated.

IloException

useSolution

protected void useSolution()
Instructs IloCplex to use a solution.

Instructs IloCplex to use the solution generated with this callback instead of solving the node itself.

If useSolution is not called, IloCplex uses the algorithm selected with parameter IloCplex.IntParam.RootAlg or IloCplex.IntParam.NodeAlg to solve the node.


setVectors

protected void setVectors(double[] x,
                          ilog.concert.IloNumVar[] var,
                          double[] pi,
                          ilog.concert.IloRange[] rng)
                   throws IloException
Specifies a starting point for the next invocation of method solve.

Starting point information is exploited at the next call of method solve. In particular, if the node is being solved with the simplex optimizer, the starting point information provided with this method is used to construct a starting basis for the Simplex method.

The starting point information is provided in the parameters of this method. null can be passed for any of the parameters. However, if x is not null, var must not be null. Similarly, if pi is not null, rng must not be null.

For all variables given in var, x[j] specifies the starting primal value for variable var[j]. Similarly, for all constraints specified in rng, pi[i] specifies the starting dual value for rng[i].

Parameters:
x - The array of primal starting values for the variables specified in var.
var - The array of variables for which to specify primal starting values.
pi - The array of dual starting values for the constraints specified in rng.
rng - The array of constraints for which to specify dual starting values.
IloException

setVectors

protected void setVectors(double[] x,
                          ilog.concert.IloNumVar[] var,
                          int xstart,
                          int xnum,
                          double[] pi,
                          ilog.concert.IloRange[] rng,
                          int cstart,
                          int cnum)
                   throws IloException
Specifies a starting point for the next invocation of the method solve.

Starting point information is exploited at the next call of solve. In particular, if the node is being solved with the Simplex optimizer, the starting point information provided with this method is used to construct a starting basis for the Simplex method.

The starting point information is provided in the parameters of this method. null can be passed for any of the parameters. However, if x is not null, var must not be null. Similarly, if pi is not null, rng must not be null.

x[j] specifies the starting primal value for variable var[j]. Similarly, pi[i] specifies the starting dual value for rng[i].

Parameters:
x - An array containing the primal starting values for the variables specified in var.
var - An array containing the variables for which to specify primal starting values.
xstart - The first element in x and var to be used.
xnum - The number of elements in x and var to be used.
pi - An array containing the dual starting values for the constraints specified in rng.
rng - An array containing the constraints for which to specify dual starting values.
cstart - The first element in pi and rng to be used.
cnum - The number of elements in pi and rng to be used.
IloException