NO FRAMES

CPXaddrows

int CPXPUBLIC CPXaddrows(CPXCENVptr env, CPXLPptr lp, int ccnt, int rcnt, int nzcnt, const double * rhs, const char * sense, const int * rmatbeg, const int * rmatind, const double * rmatval, char ** colname, char ** rowname)
Definition file: cplex.h
Include files: cplex.h

The routine CPXaddrows adds constraints to a specified CPLEX problem object. This routine may be called any time after a call to CPXcreateprob.

When you add a ranged row, CPXaddrows sets the corresponding range value to 0 (zero). Use the routine CPXchgrngval to change the range value.

Values of sense
sense[i]= 'L'≤ constraint
sense[i]= 'E'= constraint
sense[i]= 'G'≥ constraint
sense[i]= 'R'ranged constraint
Note
The use of CPXaddrows as a way to add new columns is discouraged in favor of a direct call to CPXnewcols before calling CPXaddrows.

Example

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

See also the example lpex3.c in the ILOG CPLEX User's Manual and in the standard distribution.

Parameters:

env

A pointer to the CPLEX environment as returned by CPXopenCPLEX.

lp

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

ccnt

An 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.

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 right-hand side term for each constraint to be added to the CPLEX problem object. May be NULL, in which case the new right-hand side values are set to 0.0.

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 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.

colname

An array of length ccnt containing pointers to character strings that represent the names of the new columns added to the CPLEX problem object, or equivalently, the new variable names. May be NULL, in which case the new columns are assigned default names if the columns already resident in the CPLEX 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.

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 CPXaddrows but existing constraints have no names assigned, default names are created for them.

Returns:

The routine returns zero on success and nonzero if an error occurs.