NO FRAMES

CPXsetnetcallbackfunc

int CPXPUBLIC CPXsetnetcallbackfunc(CPXENVptr env, int(CPXPUBLIC *callback)(CPXCENVptr, void *, int, void *) , void * cbhandle)
Definition file: cplex.h
Include files: cplex.h

The routine CPXsetnetcallbackfunc is used to set the user-written callback routine to 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 way as the routine CPXsetlpcallbackfunc. 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.

Callback description

 int callback (CPXENVptr 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 CPXgetcallbackinfo.

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.

ValueSymbolic ConstantMeaning
3CPX_CALLBACK_NETWORKFrom network simplex

cbhandle

Pointer to user private data, as passed to CPXsetnetcallbackfunc.

Parameters

env

A pointer to the CPLEX environment as returned by CPXopenCPLEX.

callback

A pointer to a user-written callback function. Setting callback to NULL prevents any callback function from being called during optimization. The call to callback occurs after every log message is issued during optimization and periodically during the CPLEX presolve algorithms. This function is written by the user.

cbhandle

A pointer to user private data. This pointer is passed to the callback function.

Example

 status = CPXsetnetcallbackfunc (env, myfunc, NULL);
 

See Also:

Returns:

If the operation is successful, the routine returns zero; if not, it returns nonzero to indicate an error.