Overview | Group | Tree | Graph | Index | Concepts |
This is an advanced routine. Advanced routines typically demand a profound understanding of the algorithms used by ILOG CPLEX. Thus they incur a higher risk of incorrect behavior in your application, behavior that can be difficult to debug. Therefore, ILOG encourages you to consider carefully whether you can accomplish the same task by means of other Callable Library routines instead.
The routine CPXsetsolvecallbackfunc
sets and modifies the
user-written callback to be called during MIP optimization to optimize the
subproblem.
Example
status = CPXsetsolvecallbackfunc(env, mysolvefunc, mydata);
See also the example admipex1.c
in the standard distribution.
Parameters
env
A pointer to the CPLEX environment,
as returned by CPXopenCPLEX
.
solvecallback
A pointer to a user-written solve callback. If the callback is set to NULL, no callback is called during optimization.
cbhandle
A pointer to user private data. This pointer is passed to the callback.
Callback description
int callback (CPXENVptr env, void *cbdata, int wherefrom, void *cbhandle, int *useraction_p);
ILOG CPLEX calls the solve callback before ILOG CPLEX solves the
subproblem defined by the current node. The user can choose to solve the
subproblem in the solve callback instead by setting the user action
parameter of the callback. The optimization that the user provides to solve
the subproblem must provide a CPLEX solution. That is, the
Callable Library routine CPXgetstat
must return a nonzero value. The user may access the
lp pointer of the subproblem with the Callable Library routine
CPXgetcallbacknodelp
.
Callback return value
The callback returns zero on success and nonzero if an error occurs.
Callback arguments
env
A pointer to the CPLEX environment, as returned by
CPXopenCPLEX
.
cbdata
A pointer passed from the optimization routine to the user-written callback that identifies the problem being optimized. The only purpose of this pointer is to pass it to the callback information routines.
wherefrom
An integer value indicating where in the optimization this function was
called. It will have the value CPX_CALLBACK_MIP_SOLVE
.
cbhandle
A pointer to user private data.
useraction_p
A pointer to an integer indicating the to be taken on completion of the user callback. Table 11 summarizes the possible actions.
Value | Symbolic Constant | Action |
---|---|---|
0 | CPX_CALLBACK_DEFAULT | Use ILOG CPLEX subproblem optimizer |
1 | CPX_CALLBACK_FAIL | Exit optimization |
2 | CPX_CALLBACK_SET | The subproblem has been solved in the callback |