ilog.cplex
Class IloCplex.SolveCallback

java.lang.Object
  |
  +--ilog.cplex.IloCplex.Callback
        |
        +--ilog.cplex.IloCplex.MIPCallback
              |
              +--ilog.cplex.IloCplex.SolveCallback

public abstract static class IloCplex.SolveCallback
extends IloCplex.MIPCallback

An instance of this class can be used to solve node LPs during a branch and cut search. It allows a starting point to be set for the solve or selecting the algorithm on a per-node basis.

The methods of this class are protected for use in deriving a user-written callback class, and in implementing the main method in it.

If an attempt is made to access information not available to an instance of this class, an exception is thrown.

See Also:
IloCplex.MIPCallback

Constructor Summary
protected IloCplex.SolveCallback()
           
 
Method Summary
protected  IloCplex.CplexStatus getCplexStatus()
          Queries the status of the last solve call.
protected  IloCplex.Status getStatus()
          Queries the status of the last solve call.
protected  void setVectors(double[] x, IloNumVar[] var, double[] pi, IloRange[] rng)
          Sets a starting point for the next call to solve.
protected  void setVectors(double[] x, IloNumVar[] var, int xstart, int xnum, double[] pi, IloRange[] rng, int cstart, int cnum)
          Sets starting points for calls to solve.
protected  boolean solve()
          Solves the current LP node using the default (dual) algorithm.
protected  boolean solve(int alg)
          Solves the current node LP 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, 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

IloCplex.SolveCallback

protected IloCplex.SolveCallback()
Method Detail

solve

protected boolean solve(int alg)
Solves the current node LP 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 LP node.
Returns:
The solution status, feasible or optimal.

solve

protected boolean solve()
Solves the current LP node using the default (dual) algorithm.
Returns:
The dual algorithm solution.

getStatus

protected IloCplex.Status getStatus()
Queries the status of the last solve call.
Returns:
The status of the last solve call.

getCplexStatus

protected IloCplex.CplexStatus getCplexStatus()
Queries the status of the last solve call.
Returns:
The status of the last solve call.

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 LP itself.

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


setVectors

protected void setVectors(double[] x,
                          IloNumVar[] var,
                          double[] pi,
                          IloRange[] rng)
                   throws IloException
Sets a starting point for the next call to solve. This method allowsa starting point to be specified for the following invocation of method solve(). Zero can be passed for any of the parameters. However if x or dj are not 0, var must not be 0. Similarly, if slack or pi are not 0, rng must not be 0.

For all variables given in var, x[i] specifies the starting value for variable var[i]. Similarly, dj[i] specifies the starting reduced cost for variable var[i]. For all ranges specified in rng, slack[i] specifies the starting slack value for rng[i]. Similarly, pi[i] specifies the starting dual value for rng[i].

This information is exploited at the next call to solve, to construct a starting point for the algorithm. In particular, if the extracted model is an LP, and the root algorithm is Dual, Primal, BarrierDual, or BarrierPrimal, the information is used to construct a starting basis for the Simplex method. If the extracted model is a MIP, only x values can be used, and a value must be specified for all variables of type ILOINT. If the provided values are compatible with an integer feasible solution, that solution becomes the incumbent for the next search, otherwise the starting information is ignored. Parameter MIPStart must be turned on set to IloTrue) for the starting point to take effect.

Parameters:
x - The array containing starting value for the corresponding variables in var.
var - The array of variables at the starting point for the next call tosolve.
pi - The array of starting dual values for the corresponding range in rng.
rng - The array of ranges corresponding to the variables in var.

setVectors

protected void setVectors(double[] x,
                          IloNumVar[] var,
                          int xstart,
                          int xnum,
                          double[] pi,
                          IloRange[] rng,
                          int cstart,
                          int cnum)
                   throws IloException
Sets starting points for calls to solve. This method allows starting points to be specified for invocations of the method solve(). Zero can be passed for any of the parameters. However if x[i] or dj[i] are not 0, var[i] must not be 0. Similarly, if pi is not 0, rng[i] must not be 0.

For all variables given in var, x[i] specifies the starting value for variable var[i]. Similarly, dj[i] specifies the starting reduced cost for variable var[i]. pi[i] specifies the starting dual value for rng[i].

This information is exploited at the next call to solve(), to construct starting points for the algorithm. In particular, if the extracted model is an LP, and the root algorithm is Dual, Primal, BarrierDual, or BarrierPrimal, the information is used to construct a starting basis for the Simplex method. If the extracted model is a MIP, only x[i] values can be used, and a value must be specified for all variables of type ILOINT. If the provided values are compatible with an integer feasible solution, that solution becomes the incumbent for the next search, otherwise the starting information is ignored. Parameter MIPStart must be turned on set to IloTrue) for the starting point to take effect.

Parameters:
x - An array containing starting values for variables in var.
var - The array of variables at the starting point for the next call tosolve.
xstart - The index of the first starting value in the array of starting values x
xnum - The number of members of the array x corresponding to the variables var to be used.
pi - The array of starting dual values for the corresponding range inrng.
rng - The array of ranges corresponding to the variables in var.
cstart - The index of the first range value in the array rng, corresponding to the first variable in the array var.
cnum - The number of range values in the array rng for the variables in var.