CPXXcutcallbackadd and CPXcutcallbackadd
The routine CPXXcutcallbackadd/CPXcutcallbackadd adds lazy constraints
and globally valid cuts to the
current node LP subproblem during MIP branch and cut.
int CPXXcutcallbackadd( CPXCENVptr env, void * cbdata, int wherefrom, CPXDIM nzcnt, double rhs, int sense, CPXDIM const * cutind, double const * cutval, int purgeable )
int CPXcutcallbackadd( CPXCENVptr env, void * cbdata, int wherefrom, int nzcnt, double rhs, int sense, int const * cutind, double const * cutval, int purgeable )
Description
This is an advanced routine. Advanced routines typically demand a thorough understanding of the algorithms used by CPLEX. Thus they incur a higher risk of incorrect behavior in your application, behavior that can be difficult to debug. Therefore, the team encourages you to consider carefully whether you can accomplish the same task by means of other Callable Library routines instead.
The routine CPXXcutcallbackadd/CPXcutcallbackadd adds lazy constraints
and globally valid cuts to the
current node LP subproblem during MIP branch and cut.
This routine can be called only from within a user-written cut
callback; thus it can be called only when the value of its argument
wherefrom is one of the values with a name beginning
CPX_CALLBACK_MIP_CUT_.
The cut may be for the original problem if the parameter
MIP callback switch between original model and reduced, presolved model
(CPXPARAM_MIP_Strategy_CallbackReducedLP)
was set to CPX_OFF before the
call to CPXXmipopt/CPXmipopt
that calls the callback.
In this case, the
linear reduction switch (deprecated)
(CPXPARAM_Preprocessing_Linear)
should also be set to CPX_OFF (zero).
Otherwise, the cut is used on the presolved problem.
Arguments
- env
-
A pointer to the CPLEX environment, as returned by
CPXXopenCPLEX/CPXopenCPLEX. - cbdata
-
The pointer passed to the user-written callback. This argument must be the value of
cbdatapassed to the user-written callback. - wherefrom
-
An integer value that reports where the user-written callback was called from. This argument must be the value of
wherefrompassed to the user-written callback. - nzcnt
-
An integer value that specifies the number of coefficients in the cut, or equivalently, the length of the arrays
cutindandcutval. - rhs
- A double value that specifies the value of the righthand side of the cut.
- sense
-
An integer value that specifies the sense of the cut.
The sense must be one of these three values:
- less than or equal to, designated by 'L'
- equal to, designated by 'E'
- greater than or equal to, designated by 'G'
- cutind
- An array containing the column indices of cut coefficients.
- cutval
- An array containing the values of cut coefficients.
- purgeable
- An integer value specifying how CPLEX should treat the cut. See the table for possible values.
Return
The routine returns 0 (zero) if successful and nonzero if an error occurs.
Example
status = CPXcutcallbackadd (env,
cbdata,
wherefrom,
mynzcnt,
myrhs,
'L',
mycutind,
mycutval,
0);
See also the example admipex5.c
in the standard distribution.
Special considerations
If the routine CPXXcutcallbackadd/CPXcutcallbackadd is called from a
generator of lazy constraints, then CPLEX returns
CPX_BAD_ARGUMENT if the argument purgeable
is set to CPX_USECUT_FILTER. (A user cut filter
makes no sense in the context of purging lazy constraints.) In other words,
if the value of the argument wherefrom is
CPX_CALLBACK_MIP_CUT_FEAS or
CPX_CALLBACK_MIP_CUT_UNBD, then the argument
purgeable must not be
CPX_USECUT_FILTER.
When you add a lazy constraint by means of the routine
CPXXcutcallbackadd/CPXcutcallbackadd
with the symbolic value CPX_USECUT_PURGE as
the argument purgeable
in a lazy constraint callback, you are authorizing
CPLEX to purge (that is, eliminate) the lazy constraint
under certain circumstances, for example, if the constraint becomes slack.
Consequently, in view of such purging, the user must not
assume that any previously added constraints are still in the
current relaxation. In other words, the purged constraint may be violated
in subsequent relaxations.
CPX_USECUT_FORCE |
The cut is added to the relaxation and stays there |
CPX_USECUT_PURGE |
The cut is added to the relaxation but can be purged later on if CPLEX deems the cut ineffective. |
CPX_USECUT_FILTER |
The cut is treated exactly as cuts generated by CPLEX; that is, CPLEX applies its filtering process and may not even add the cut to the relaxation, for example, if CPLEX deems other cuts more effective, or if the cut is too dense. |