CPXXcallbackpostheursoln and CPXcallbackpostheursoln
Posts a feasible solution to CPLEX.
int CPXXcallbackpostheursoln( CPXCALLBACKCONTEXTptrcontext, CPXDIMcnt, CPXDIM const *ind, double const *val, doubleobj, CPXCALLBACKSOLUTIONSTRATEGYstrat )
int CPXcallbackpostheursoln( CPXCALLBACKCONTEXTptrcontext, CPXDIMcnt, CPXDIM const *ind, double const *val, doubleobj, CPXCALLBACKSOLUTIONSTRATEGYstrat )
Description
- CPLEX checks whether the solution is incomplete. (A solution is incomplete if the solution does not specify a non-NaN value for each variable, where NaN means not a number.)
- If the solution is incomplete, then CPLEX applies the completion strategy specified by the argument strat.
- CPLEX checks the feasibility of the completed solution.
- CPLEX accepts the completed solution if the completed solution is feasible and improves on the current incumbent.
You must not call this routine from callbacks in the context CPX_CALLBACKCONTEXT_THREAD_UP or CPX_CALLBACKCONTEXT_THREAD_DOWN. If you do so, this routine returns CPXERR_UNSUPPORTED_OPERATION or CPXERR_NO_ENVIRONMENT.
You must not call this routine with Benders algorithm in any context.
It is possible that CPLEX does not handle the posted solution immediately. Generally, CPLEX adds the solution to a queue, and the next time that CPLEX runs heuristics, CPLEX looks at this queue for feasible solutions that come from an external source. This procedure implies that possibly CPLEX does not use the posted solution at all; for example, if CPLEX found a better solution before it looked at that queue again. Also possibly, CPLEX can run improvement heuristics on the specified solution, and these heuristics result in even better solutions. In such cases, the solution passed to this routine possibly does not appear as a new incumbent.
Arguments
- context
-
The callback context as passed into the callback function.
- cnt
-
The number of elements in
ind
andval
. - ind
-
Nonzero indices of solution values.
- val
-
Nonzero values of solution values. NaNs (that is, values that are not a number) are allowed in this array. They specify missing values in an incomplete solution.
- obj
-
Objective value of the new solution. This value is merely a hint for CPLEX: CPLEX recalculates this value after completing the solution. However, if the value passed into this routine is worse than the current incumbent at the time CPLEX processes the posted solution, then CPLEX can discard the posted solution.
- strat
-
Strategy to complete the solution in
ind
andval
if the solution is partial.