CPXXpreaddrows and CPXpreaddrows

The routine CPXXpreaddrows/CPXpreaddrows adds rows to an LP problem object and its associated presolved LP problem object.

int  CPXXpreaddrows( CPXCENVptr env, CPXLPptr lp, CPXDIM rcnt, CPXNNZ nzcnt, double const * rhs, char const * sense, CPXNNZ const * rmatbeg, CPXDIM const * rmatind, double const * rmatval, char const *const * rowname )

int  CPXpreaddrows( CPXCENVptr env, CPXLPptr lp, int rcnt, int nzcnt, double const * rhs, char const * sense, int const * rmatbeg, int const * rmatind, double const * rmatval, char ** rowname )

Description

Warning:

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 CPXXpreaddrows/CPXpreaddrows adds rows to an LP problem object and its associated presolved LP problem object. The CPLEX parameter that specifies the primal and dual reduction type ( CPXPARAM_Preprocessing_Reduce) must be set to CPX_PREREDUCE_PRIMALONLY(1) or CPX_PREREDUCE_NOPRIMALORDUAL(0) at the time of the presolve in order to add rows and preserve the presolved problem. This routine should be used in place of CPXXaddrows and CPXaddrows when you want to preserve the presolved problem.

The arguments of CPXXpreaddrows/CPXpreaddrows are the same as those of CPXXaddrows and CPXaddrows with the exception that new columns may not be added, so there are no rcnt and rowname arguments. The new rows are added to both the original LP problem object and the associated presolved LP problem object.

Table 1. Values of sense
sense[i] 'L' <= constraint
sense[i] 'E' = constraint
sense[i] 'G' >= constraint
sense[i] 'R' ranged constraint

Examples:


status = CPXpreaddrows (env, lp, rcnt, nzcnt, rhs, sense, rmatbeg, rmatind,
		 rmatval, newrowname);

See also the example adpreex1.c in the standard distribution.

Arguments

env
A pointer to the CPLEX environment as returned by CPXXopenCPLEX/CPXopenCPLEX.
lp
A pointer to a CPLEX problem object as returned by CPXXcreateprob/CPXcreateprob.
rcnt
An integer that specifies the number of new rows to be added to the constraint matrix.
nzcnt
An integer that specifies 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. May be NULL, in which case the new righthand side values are set to 0.0 (zero).
sense
An array of length rcnt containing the sense of each constraint to be added to the CPLEX problem object. May be NULL, in which case the new constraints are created as equality constraints. 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 CPXXcopylp/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], specifies the column index of the corresponding coefficient, rmatval[i]. UnlikeCPXcopylp, all rows must be contiguous, and rmatbeg[0] must be 0 (zero).
rowname
An array containing pointers to character strings that represent the names of the new rows, or equivalently, the constraint names. May be NULL, in which case the new rows are assigned default names if the rows already resident in the CPLEX problem object have names; otherwise, no names are associated with the constraints. If row names are passed to CPXXaddrows/CPXaddrows but existing constraints have no names assigned, default names are created for them.

Return

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