Description
The routine CPXaddrows() adds constraints to a specified LP problem object problem object. This routine may be called any time after a call to CPXcreateprob(). CPXaddrows() sets the corresponding range value to 0. Use the CPXchgcoef() routine to change the range value.Return Value
The routine returns a zero on success, and a nonzero if an error occurs.Synopsis
int CPXaddrows (CPXENVptr env,
CPXLPptr lp,
int ccnt,
int rcnt,
int nzcnt,
double *rhs,
char *sense,
int *rmatbeg,
int *rmatind,
double *rmatval,
char **colname,
char **rowname);
CPXENVptr envThe pointer to the CPLEX environment as returned by one of the
CPXopenCPLEX routines.
CPXLPptr lpA pointer to a CPLEX LP problem object as returned by
CPXcreateprob().
int ccntAn integer that indicates the number of new columns in the constraints being added to the constraint matrix. When new columns are added, they are given an objective coefficient of zero, a lower bound of zero, and an upper bound of CPX_INFBOUND. The use of
CPXaddrows() as a way to add new columns is discouraged in favor of a direct call to CPXnewcols() before calling CPXaddrows().
int rcntAn integer that indicates the number of new rows to be added to the constraint matrix.
int nzcntAn 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.
double *rhsAn array of length
rcnt containing the right-hand side term for each constraint to be added to the LP problem object. May be NULL, in which case, the new right-hand side values are set to 0.0.
char *senseAn array of length
rcnt containing the sense of each constraint to be added to the LP problem object. May be NULL, in which case, the new constraints are created as equality constraints.
sense[i]
|
= 'L'
|
|
sense[i]
|
= 'E'
|
= constraint
|
sense[i]
|
= 'G'
|
|
sense[i]
|
= 'R'
|
ranged constraint
|
int *rmatbeg int *rmatind double *rmatvalThese three arguments are arrays that describe 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) but the nonzero coefficients are grouped by row instead of column in the array rmatval. 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(), the rows all need to be contiguous and rmatbeg[0] must be 0.
char **colnameAn array of length
ccnt containing pointers to character strings that represent the names of the new columns added to the LP problem object, or equivalently, the new variable names. colname may be NULL, in which case the new columns are assigned default names if the columns already resident in the LP problem object have names; otherwise no names are associated with the variables. If column names are passed to CPXaddrows() but existing variables have no names assigned, default names are created for them.
char **rownameAn array containing pointers to character strings that represent the names of the new rows, or equivalently, the constraint names.
rowname may be NULL in which case the new rows are assigned default names if the rows already resident in the LP problem object have names; otherwise no names are associated with the constraints. If row names are passed to CPXaddrows() but existing constraints have no names assigned, default names are created for them.
status = CPXaddrows (env, lp, ccnt, rcnt, nzcnt, rhs,
sense, rmatbeg, rmatind, rmatval,
newcolname, newrowname);