CPXXsetmipcallbackfunc and CPXsetmipcallbackfunc

The routine CPXXsetmipcallbackfunc/CPXsetmipcallbackfunc sets the user-written callback routine to be called in the branch-and-cut tree, including the root node, during the optimization of a mixed integer program and during some cut generation routines.

int  CPXXsetmipcallbackfunc( CPXENVptr env, int(CPXPUBLIC *callback)(CPXCENVptr, void *, int, void *), void * cbhandle )

int  CPXsetmipcallbackfunc( CPXENVptr env, int(CPXPUBLIC *callback)(CPXCENVptr, void *, int, void *), void * cbhandle )

Description

The routine CPXXsetmipcallbackfunc/CPXsetmipcallbackfunc sets the user-written callback routine to be called in the branch-and-cut tree, including the root node, during the optimization of a mixed integer program and during some cut generation routines.

This routine works in the same way as the routine CPXXsetlpcallbackfunc/CPXsetlpcallbackfunc. It enables the user to create a separate callback function to be called during the solution of mixed integer programming problems (MIPs).

The prototype for the callback function is identical to that of CPXXsetlpcallbackfunc/CPXsetlpcallbackfunc.

Arguments

env

A pointer to the CPLEX environment, as returned by one of the CPXXopenCPLEX/CPXopenCPLEX routines.

callback

A pointer to a user-written callback function. Setting callback to NULL will prevent any callback function from being called during optimization. The call to callback will 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 = CPXsetmipcallbackfunc (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 terminates the 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 cuts

cbhandle

A pointer to user private data as passed to CPXXsetmipcallbackfunc/CPXsetmipcallbackfunc.