Return values for callbacks

Documents return values appropriate in user-written callbacks.

A user-written callback should return a nonzero value if the user wants to stop the optimization and a value of zero otherwise.

For LP, QP, or QCP problems, if the callback returns a nonzero value, the solution process terminates. If the process was not terminated during the presolve process, the status returned by the function IloCplex::getStatus or the routines CPXsolution or CPXgetstat will be CPX_STAT_ABORT_USER, specifying that the process stopped because the user intervened..

For both LP, QP, QCP, and MIP problems, if the LP/QP/QCP callback returns a nonzero value during preprocessing, the optimizer will return the value CPXERR_PRESLV_ABORT, and no solution information will be available.

For MIP problems, if the callback returns a nonzero value, the solution process terminates, and the status returned by IloCplex::getStatus or CPXgetstat is one of the values in the table Table 1.
Table 1. Status of nonzero callbacks for MIPs
Symbolic constant Meaning
CPXMIP_ABORT_FEAS current solution integer feasible
CPXMIP_ABORT_INFEAS no integer feasible solution found