| Overview | Group | Tree | Graph | Index | Concepts | 

An instance of the class IloCplex::HeuristicCallbackI
 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 current node;IloCplex about the variable bounds
 at the current node;In short, this callback allows you to attempt to construct an integer
 feasible solution at a node and pass it to the invoking instance of
 IloCplex to use as its new incumbent. The API supports you in
 finding such a solution by allowing you iteratively to change bounds of the
 variables and re-solve the node relaxation. 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 relaxation 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.
See Also:
IloCplex, IloCplex::Callback, IloCplex::CallbackI, IloCplex::ControlCallbackI, IloCplex::MIPCallbackI, ILOHEURISTICCALLBACK0
| Method Summary | |
|---|---|
protected IloCplex::CplexStatus | getCplexStatus() | 
protected IloAlgorithm::Status | getStatus() | 
protected IloBool | isDualFeasible() | 
protected IloBool | isPrimalFeasible() | 
protected void | setBounds(const IloIntVarArray, const IloNumArray, const IloNumArray) | 
protected void | setBounds(const IloNumVarArray, const IloNumArray, const IloNumArray) | 
protected void | setBounds(const IloIntVar, IloNum, IloNum) | 
protected void | setBounds(const IloNumVar, IloNum, IloNum) | 
protected void | setSolution(const IloIntVarArray, const IloNumArray, IloNum) | 
protected void | setSolution(const IloIntVarArray, const IloNumArray) | 
protected void | setSolution(const IloNumVarArray, const IloNumArray, IloNum) | 
protected void | setSolution(const IloNumVarArray, const IloNumArray) | 
protected IloBool | solve(IloCplex::Algorithm) | 
Inherited Methods from CallbackI | 
|---|
abort, duplicateCallback, getEnv, getModel, getNcols, getNQCs, getNrows, main | 
| Method Detail | 
|---|
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 HeuristicCallbackI::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.
This method returns the status of the solution found by the
 instance of IloCplex at the current node during the last call
 to HeuristicCallbackI::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.
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.
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.
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.
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.
This method sets the lower bound to lb and the
 upper bound to ub for the variable var at the
 current node. 
 Setting bounds has no effect beyond the scope of the current
 invocation of the callback.
This method sets the lower bound to lb and the
 upper bound to ub for the variable var at the
 current node. Setting bounds has no effect beyond the scope of the current
 invocation of the callback.
For each variable in the array vars, this method uses
 the value in the corresponding element of the array vals
 to define a heuristic solution to be considered as a new incumbent.
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].
The parameter obj is used to tell IloCplex
 the objective value of the injected solution.  This allows
 IloCplex to skip the computation of that value, but care
 must be taken not to provide an incorrect value.
For each variable in the array vars, this method uses
 the value in the corresponding element of the array vals
 to define a heuristic solution to be considered as a new incumbent.
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]. 
For each variable in the array vars, this method uses
 the value in the corresponding element of the array vals
 to define a heuristic solution to be considered as a new incumbent.
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].
The parameter obj is used to tell IloCplex
 the objective value of the injected solution.  This allows
 IloCplex to skip the computation of that value, but care
 must be taken not to provide an incorrect value.
For each variable in the array vars, this method uses
 the value in the corresponding element of the array vals
 to define a heuristic solution to be considered as a new incumbent.
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]. 
This method can be used to solve the current node relaxation, usually
 after some bounds have been changed using HeuristicCallbackI::setBounds. By default it uses the dual simplex algorithm,
 but this can be overwritten using the optional parameter alg.
 See the enumeration IloCplex::Algorithm
 for a list of the available optimizers.