> Advanced Programming Techniques > Using Callbacks > Implementing Callbacks in the Callable Library > Return Values for Callbacks

A user-written callback should return a nonzero value if the user wishes 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 will terminate. 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 (value 13).

For both LP/QP/QCP and MIP problems, if the LP/QP/QCP callback returns a nonzero value during presolve 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 will terminate and the status returned by IloCplex::getStatus or CPXgetstat will be one of the values in Table 22.2.

Table 22.2 Status of Nonzero Callbacks for MIPs
Value 
Symbolic constant 
Meaning 
113 
CPXMIP_ABORT_FEAS 
current solution integer feasible 
114 
CPXMIP_ABORT_INFEAS 
no integer feasible solution found