Previous Page: CPXnewcolsFirst PageNext Page: CPXobjsa

CPXnewrows


Description

The routine CPXnewrows() adds empty constraints to a specified CPLEX LP problem object. This routine may be called any time after a call to CPXcreateprob().

For each row, the user can specify the sense, right-hand side value, range value and name of the constraint. The added rows will be indexed to put them at the end of the problem. Thus, if rcnt rows are added to a problem object already having k rows, the new rows will have indices k, k+1, ... k+rcnt-1. The constraint coefficients in the new rows will be zero; the constraint coefficients can be changed with calls to CPXchgcoef(), CPXchgcoeflist() or CPXaddcols().

Return Value

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

Synopsis

int CPXnewrows (CPXENVptr env,
                CPXLPptr lp,
                int rcnt,
                double *rhs,
                char *sense,
                double *rngval,
                char **rowname);

Arguments


CPXENVptr env
The pointer to the CPLEX environment as returned by one of the CPXopenCPLEX routines.

CPXLPptr lp
A pointer to a CPLEX LP problem object as returned by CPXcreateprob().

int rcnt
An integer that indicates the number of new rows to be added to the problem object.

double *rhs
An array of length rcnt containing the right-hand side term for each constraint to be added to the problem object. This array may be NULL, in which case the right-hand side terms are set to 0.0 for the new constraints.

char *sense
An array of length rcnt containing the sense of each constraint to be added to the problem object.

sense[i]  
= 'L'  
constraint  
sense[i]  
= 'E'  
= constraint  
sense[i]  
= 'G'  
constraint  
sense[i]  
= 'R'  
ranged constraint  

This array may be NULL, in which case the sense of each constraint is set to be an equality constraint 'E'.

double *rngval
An array of length rcnt containing the range values for the new constraints. If a new constraint has sense[i]='R', then the value of constraint i can be between rhs[i] and rhsi[i]+rngval[i]. This array may be NULL, in which case the range values are all set to 0.

char **rowname
An array of length rcnt 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 problem object have names; otherwise no names are associated with the constraints. If row names are passed to CPXnewrows() but existing constraints have no names assigned, default names are created for them.

Example

status = CPXnewrows (env, lp, rcnt, rhs, sense, NULL, newrowname);

See Also

Example lpex8.c in the CPLEX User's Manual.

Previous Page: CPXnewcolsFirst PageNext Page: CPXobjsa