Previous Page: CPXsetmipcallbackfuncFirst PageNext Page: CPXsetstrparam

CPXsetnetcallbackfunc


Description

The CPXsetnetcallbackfunc() is used to set the user-written callback routine which will be called each time a log message is issued during the optimization of a network program. If the display log is turned off, the callback routine will still be called.

This routine works in the same manner as the CPXsetlpcallbackfunc() routine. It enables the user to create a separate callback function to be called during the solution of a network problem. The prototype for the callback function is identical to that of CPXsetlpcallbackfunc().

Return Value

If the operation is successful, CPXsetnetcallbackfunc() returns the value 0; if not, it returns a nonzero value to indicate an error.

Synopsis

int CPXsetnetcallbackfunc (CPXENVptr env,
                           int (CPXPUBLIC *callback)
                                    (CPXENVptr, void *, int, void *),
                           void *cbhandle);

Arguments


CPXENVptr env
The pointer to the CPLEX environment as returned by one of the CPXopenCPLEX routines.

int (CPXPUBLIC *callback) (CPXENVptr, void *, int, void *)
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 iteration during optimization and periodically during the CPLEX presolve algorithms. This function is written by the user, and is prototyped as it appears below.

void *cbhandle
A pointer to user private data. This pointer will be passed to the callback function.

Callback

Synopsis

int callback (CPXENVptr env,
              void *cbdata,
              int wherefrom,
              void *cbhandle);

Callback

Arguments


CPXENVptr env
The pointer to the CPLEX environment that was passed into the associated optimization routine.

void *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 CPXgetcallbackinfo() routine.

int wherefrom
An integer value indicating from which optimization algorithm the user-written callback function was called. Possible values and their meaning appear in the table below.

Value  
Symbolic Constant  
Meaning  
1  
CPX_CALLBACK_PRIMAL  
From primal simplex  
2  
CPX_CALLBACK_DUAL  
From dual simplex  
3  
CPX_CALLBACK_NETWORK  
From network simplex  
4  
CPX_CALLBACK_PRIMAL_CROSSOVER  
From primal crossover  
5  
CPX_CALLBACK_DUAL_CROSSOVER  
From dual crossover  
6  
CPX_CALLBACK_BARRIER  
From barrier  
7  
CPX_CALLBACK_PRESOLVE  
From presolve  
101  
CPX_CALLBACK_MIP  
From mipopt  

void *cbhandle
Pointer to user private data, as passed to CPXsetlpcallbackfunc() or CPXsetmipcallbackfunc().

Example

status = CPXsetnetcallbackfunc (env, myfunc, NULL);

Previous Page: CPXsetmipcallbackfuncFirst PageNext Page: CPXsetstrparam