NO FRAMES

CPXaddusercuts

public int CPXaddusercuts(CPXCENVptr env, CPXLPptr lp, int rcnt, int nzcnt, const double * rhs, const char * sense, const int * rmatbeg, const int * rmatind, const double * rmatval, char ** rowname)
Definition file: cplex.h
Note

This is an advanced routine. Advanced routines typically demand a thorough 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 CPXaddusercuts is used to add constraints to the list of constraints that should be added to the LP subproblem of a MIP optimization if they are violated. CPLEX handles addition of the constraints and makes sure that all integer solutions satisfy all the constraints. The constraints are added to those specified in prior calls to CPXaddusercuts.

The constraints must be cuts that are implied by the constraint matrix. The CPLEX parameter CPX_PARAM_PRELINEAR should be set to CPX_OFF (0).

Use CPXfreeusercuts to clear the list of cuts.

The arguments of CPXaddusercuts are the same as those of CPXaddrows, with the exception that new columns may not be specified, so there are no ccnt and colname arguments. Furthermore, unlike CPXaddrows, CPXaddusercuts does not accept a NULL pointer for the array of righthand side values or senses.

Example

 status = CPXaddusercuts (env, lp, cutcnt, cutnzcnt, cutrhs,
                          cutsense, cutbeg, cutind, cutval, NULL);
 

See also admipex4.c in the standard distribution.

Values of sense
sense[i]= 'L'<= constraint
sense[i]= 'E'= constraint
sense[i]= 'G'>= constraint

Parameters:

env

A pointer to the CPLEX environment as returned by CPXopenCPLEX.

lp

A pointer to a CPLEX problem object as returned by CPXcreateprob.

rcnt

An integer that indicates the number of new rows to be added to the constraint matrix.

nzcnt

An integer that indicates the number of nonzero constraint coefficients to be added to the constraint matrix. This specifies the length of the arrays rmatind and rmatval.

rhs

An array of length rcnt containing the righthand side term for each constraint to be added to the CPLEX problem object.

sense

An array of length rcnt containing the sense of each constraint to be added to the CPLEX problem object. Possible values of this argument appear in the table.

rmatbeg

An array used with rmatind and rmatval to define the rows to be added.

rmatind

An array used with rmatbeg and rmatval to define the rows to be added.

rmatval

An array used with rmatbeg and rmatind to define the rows to be added. The format is similar to the format used to describe the constraint matrix in the routine CPXcopylp (see description of matbeg, matcnt, matind, and matval in that routine), but the nonzero coefficients are grouped by row instead of column in the array rmatval. The nonzero elements of every row must be stored in sequential locations in this array from position rmatbeg[i] to rmatbeg[i+1]-1 (or from rmatbeg[i] to nzcnt -1 if i=rcnt-1). Each entry, rmatind[i], indicates the column index of the corresponding coefficient, rmatval[i]. Unlike CPXcopylp, all rows must be contiguous, and rmatbeg[0] must be 0.

rowname

An array containing pointers to character strings that represent the names of the user cuts. May be NULL, in which case the new user cuts are assigned default names if the user cuts already resident in the CPLEX problem object have names; otherwise, no names are associated with the user cuts. If row names are passed to CPXaddusercuts but existing user cuts have no names assigned, default names are created for them.

Returns:

The routine returns zero if successful and nonzero if an error occurs.