 |
 |
 |
 |
Purpose |
 |
 |
Create a new empty row (constraint) in the problem
|
 |
Synopsis |
 |
 |
int QSnew_row (QSprob p, double rhs, char sense, const char *name)
|
 |
Arguments |
 |
p |
 |
a handle to an initialized problem. |
rhs |
 |
the right-hand-side value of the constraint. |
sense |
 |
the sense of the constraint (to specify an equation use 'E' , to specify a = constraint use 'L' , and to specify a ≤ constraint use 'G' ). |
name |
 |
the name of the constraint (can be NULL ). |
|
 |
Returns |
 |
 |
A zero value if the function terminated correctly, and a non-zero value if an error occurred.
|
 |
Description |
 |
 |
The QSnew_row function can be used to add a new constraint to an existing LP problem. This function should be used in cases where the new constraint has no non-zero coefficients in the existing columns of the LP problem, and in cases where the constraint's coefficients in the existing columns are not yet known in the application. (In other cases, QSadd_row should be used to add the constraint.) As an example of a possible use of QSnew_row, the function can be called to initialize the constraints of an LP after a call to QScreate_prob; the constraint matrix is then created with calls to QSadd_col. When specifying rhs , it is important not to give any value larger in magnitude than QS_MAXDOUBLE (1e30). This restriction is due to the internal structures used in the QSopt solvers.
|
 |
Example |
 |
 |
/* Assume p is initialized to the problem in the QSload_prob example. */
/* Add a >= constraint, with right-hand-side value 6.0 (and no name */
/* specified for the row). */
int rval;
rval = QSnew_row (p, 6.0, 'G', (const char *) NULL);
if (rval) {
fprintf (stderr, "QSnew_row failed with return code %d\n", rval);
}
|
 |
|
|