Skip to main content
FRAMES NO FRAMES

Class IloCplex::SolveCallbackI

Definition file: ilcplex/ilocplexi.h
Map of IloCplex::SolveCallbackIIloCplex::SolveCallbackIIloCplex::SolveCallbackIIloCplex::ControlCallbackIIloCplex::MIPCallbackIIloCplex::MIPInfoCallbackIIloCplex::OptimizationCallbackIIloCplex::CallbackI
Note

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.

An instance of the class IloCplex::SolveCallbackI can be used to solve subproblems (for example, node and heuristic subproblems) during branch-and-cut search. It allows you to set a starting point for the solve or to select 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 there.

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

See Also:

Method Summary
public IloCplex::CplexStatusgetCplexStatus() const
public IloAlgorithm::StatusgetStatus() const
protected Callback::TypegetType() const
public IloBoolisDualFeasible() const
public IloBoolisPrimalFeasible() const
public voidsetStart(const IloNumArray x, const IloIntVarArray var, const IloNumArray pi, const IloRangeArray rng)
public voidsetStart(const IloNumArray x, const IloNumVarArray var, const IloNumArray pi, const IloRangeArray rng)
public IloBoolsolve(IloCplex::Algorithm alg=Dual)
protected SolveCallbackI(IloEnv env)
public voiduseSolution()
Inherited Methods from ControlCallbackI
getDownPseudoCost, getDownPseudoCost, getFeasibilities, getFeasibilities, getFeasibility, getFeasibility, getFeasibility, getFeasibility, getLB, getLB, getLBs, getLBs, getNodeData, getNodeId, getObjValue, getSlack, getSlacks, getUB, getUB, getUBs, getUBs, getUpPseudoCost, getUpPseudoCost, getValue, getValue, getValue, getValues, getValues, isSOSFeasible, isSOSFeasible, setNodeData
Inherited Methods from MIPCallbackI
getCurrentNodeDepth, getObjCoef, getObjCoef, getObjCoefs, getObjCoefs, getType, getUserThreads, MIPCallbackI
Inherited Methods from MIPInfoCallbackI
getBestObjValue, getCutoff, getDirection, getDirection, getIncumbentObjValue, getIncumbentSlack, getIncumbentSlacks, getIncumbentValue, getIncumbentValue, getIncumbentValue, getIncumbentValues, getIncumbentValues, getMIPRelativeGap, getMyThreadNum, getNcuts, getNiterations, getNiterations64, getNnodes, getNnodes64, getNremainingNodes, getNremainingNodes64, getPriority, getPriority, getQuality, getType, hasIncumbent, MIPInfoCallbackI
Inherited Methods from OptimizationCallbackI
getModel, getNcols, getNQCs, getNrows
Inherited Methods from CallbackI
abort, duplicateCallback, getCplexTime, getDetTime, getEndDetTime, getEndTime, getEnv, getStartDetTime, getStartTime, getType, main
Method Detail

SolveCallbackI

protected SolveCallbackI(IloEnv env)

This constructor creates a callback for use in an application for solving the node LPs during branch-and-cut searches.


getCplexStatus

public IloCplex::CplexStatus getCplexStatus() const

This method returns the 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 SolveCallbackI::solve (which may have been called directly in the callback or by IloCplex when processing the node).

The enumeration IloCplex::CplexStatus lists the possible status values.


getStatus

public IloAlgorithm::Status getStatus() const

This method returns the status of the solution found by the instance of IloCplex at the current node during the last call to SolveCallbackI::solve (which may have been called directly in the callback or by IloCplex when processing the node).

The enumeration IloAlgorithm::Status lists the possible status values.


isDualFeasible

public IloBool isDualFeasible() const

This method returns IloTrue if the solution provided by the last solve call is dual feasible. Note that an IloFalse return value does not necessarily mean that the solution is not dual feasible. It simply means that the relevant algorithm was not able to conclude it was dual feasible when it terminated.


isPrimalFeasible

public IloBool isPrimalFeasible() const

This method returns IloTrue if the solution provided by the last solve call is primal feasible. Note that an IloFalse return value does not necessarily mean that the solution is not primal feasible. It simply means that the relevant algorithm was not able to conclude it was primal feasible when it terminated.


setStart

public void setStart(const IloNumArray x, const IloIntVarArray var, const IloNumArray pi, const IloRangeArray rng)

This method allows a user to specify a starting point for the following invocation of the solve method in a solve callback. Zero can be passed for any of the arguments. However, if x is not zero, then var must not be zero either. Similarly, if pi is not zero, then rng must not be zero either.

Note

When CPLEX is solving a MIP and the argument pi is not zero, then you must disable presolve. If you do not disable presolve in those conditions, then the method set fails when it is unable to crush a pi vector for the original model into appropriate values for the presolved model.

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

CPLEX uses this information at the next call to solve to construct a starting point for the algorithm.


setStart

public void setStart(const IloNumArray x, const IloNumVarArray var, const IloNumArray pi, const IloRangeArray rng)

This method allows a user to specify a starting point for the following invocation of the solve method in a solve callback. Zero can be passed for any of the arguments. However, if x is not zero, then var must not be zero either. Similarly, if pi is not zero, then rng must not be zero either.

Note

When CPLEX is solving a MIP and the argument pi is not zero, then you must disable presolve. If you do not disable presolve in those conditions, then the method setStart fails when it is unable to crush a pi vector for the original model into appropriate values for the presolved model.

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

CPLEX uses this information at the next call to solve to construct a starting point for the algorithm.


solve

public IloBool solve(IloCplex::Algorithm alg=Dual)

This method uses the algorithm alg to solve the current node LP. See IloCplex::Algorithm for a choice of algorithms to use.


useSolution

public void useSolution()

A call to this method instructs IloCplex to use the solution generated with this callback.

If useSolution is not called, IloCplex uses the algorithm selected with the parameters IloCplex::RootAlg for the solution of the root, or IloCplex::NodeAlg to solve the node.


getType

protected Callback::Type getType() const

This method returns the callback type of the invoking callback object.