CPXXsetinfocallbackfunc and CPXsetinfocallbackfunc
The routine CPXXsetinfocallbackfunc/CPXsetinfocallbackfunc sets the
user-written callback routine that CPLEX calls regularly during the
optimization of a mixed integer program and during certain cut generation
routines.
int CPXXsetinfocallbackfunc( CPXENVptr env, int(CPXPUBLIC *callback)(CPXCENVptr, void *, int, void *), void * cbhandle )
int CPXsetinfocallbackfunc( CPXENVptr env, int(CPXPUBLIC *callback)(CPXCENVptr, void *, int, void *), void * cbhandle )
Description
The routine CPXXsetinfocallbackfunc/CPXsetinfocallbackfunc sets the
user-written callback routine that CPLEX calls regularly during the
optimization of a mixed integer program and during certain cut generation
routines.
This routine enables the user to create a
separate callback function to be called during the solution of mixed integer
programming problems (MIPs).
Unlike any other callback routines, this user-written
callback function only retrieves information about MIP search.
It does not control the search, though it allows the search to terminate.
The user-written callback function
is allowed to call only two other routines:
CPXXgetcallbackinfo/CPXgetcallbackinfo and
CPXXgetcallbackincumbent/CPXgetcallbackincumbent.
The prototype for the callback function is identical to that of
CPXXsetmipcallbackfunc/CPXsetmipcallbackfunc.
Arguments
- env
-
A pointer to the CPLEX environment, as returned by
CPXXopenCPLEX/CPXopenCPLEX. - callback
-
A pointer to a user-written callback function. Setting
callbacktoNULLwill prevent any callback function from being called during optimization. The call tocallbackwill occur after every node during optimization and during certain cut generation routines. This function must be written by the user. Its prototype is explained in the Callback description. - cbhandle
-
A pointer to user private data. This pointer will be passed to the callback function.
Return
The routine returns 0 (zero) if successful and nonzero if an error occurs.Example
status = CPXsetinfocallbackfunc (env, mycallback, NULL);
Callback description
int CPXPUBLIC
callback (CPXCENVptr env,
void *cbdata,
int wherefrom,
void *cbhandle);
This is the user-written callback routine.
Callback return value
A nonzero return value terminates the optimization. That is, if the user-written callback function returns nonzero, it signals that CPLEX should terminate optimization.
Callback arguments
env
A pointer to the CPLEX environment that was passed into the associated optimization routine.
cbdata
A pointer passed from the optimization routine to the user-written
callback function that identifies the problem being optimized. The only
purpose for the cbdata pointer is to pass it to the routine
CPXXgetcallbackinfo/CPXgetcallbackinfo.
wherefrom
An integer value reporting from which optimization algorithm the user-written callback function was called. Possible values and their meaning appear in the table.
| Value | Symbolic Constant | Meaning |
101 |
CPX_CALLBACK_MIP |
From mipopt |
107 |
CPX_CALLBACK_MIP_PROBE |
From probing or clique merging |
108 |
CPX_CALLBACK_MIP_FRACCUT |
From Gomory fractional cuts |
109 |
CPX_CALLBACK_MIP_DISJCUT |
From disjunctive cuts |
110 |
CPX_CALLBACK_MIP_FLOWMIR |
From Mixed Integer Rounding (MIR) cuts |
cbhandle
A pointer to user private data as passed to
CPXXsetinfocallbackfunc/CPXsetinfocallbackfunc.