CPXgetlpcallbackfunc


Description

The routine CPXgetlpcallbackfunc() is used to access the user-written callback routine to be called after each iteration during the optimization of a linear or quadratic program, and also periodically during the CPLEX presolve algorithm.

Return Value

The routine returns a zero on success, and a nonzero if an error occurs.

Synopsis

  int CPXgetlpcallbackfunc (CPXCENVptr env,
                            int (CPXPUBLIC **callback_p)
                                      (CPXCENVptr, void *, int, void *),
                            void **cbhandle_p);

Arguments

CPXCENVptr env

The pointer to the CPLEX environment as returned by CPXopenCPLEX().

int (CPXPUBLIC **callback_p) (CPXCENVptr, void *, int, void *)

The address of the pointer to the current user-written callback function. If no callback function has been set, the pointer evaluates to NULL.

void **cbhandle_p

The address of a variable to hold the user's private pointer.

Callback

Description

This is the user-written callback routine referenced above.

Return Value

A nonzero terminates the optimization.

Synopsis

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

Arguments

CPXCENVptr 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 LP problem being optimized. The only purpose for the cbdata pointer is to pass it to the routine CPXgetcallbackinfo().

int wherefrom

An integer value indicating which optimization algorithm the user-written callback function was called from. 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 
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 
CPX_CALLBACK_QPBARRIER 
From QP barrier 
CPX_CALLBACK_QPSIMPLEX 
From QP simplex 

void *cbhandle

Pointer to user private data, as passed to CPXsetlpcallbackfunc().

Example

  status = CPXgetlpcallbackfunc (env, mycallback, NULL);

See Also

CPXgetcallbackinfo()
The example lpex4.c in the CPLEX User's Manual.

Previous Page: CPXgetlogfile Return to Top Next Page: CPXgetmethod