 |
 |
 |
 |
Purpose |
 |
 |
Create a new empty column (variable) in the problem.
|
 |
Synopsis |
 |
 |
int QSnew_col (QSprob p, double obj, double lower, double upper,
const char *name)
|
 |
Arguments |
 |
p |
 |
a handle to an initialized problem. |
obj |
 |
the objective function coefficient for the variable. |
lower |
 |
the lower bound for the variable (use -QS_MAXDOUBLE if no lower bound). |
upper |
 |
the upper bound for the variable (use QS_MAXDOUBLE if no upper bound). |
name |
 |
the name of the variable (can be NULL ). |
|
 |
Returns |
 |
 |
A zero value if the function terminated correctly, and a non-zero value if an error occurred.
|
 |
Description |
 |
 |
The QSnew_col function can be used to add a new variable to an existing LP problem. This function should be used in cases where the new variable does not appear in the existing rows of the LP problem, and in cases where the variable's coefficients in the existing rows are not yet known in the application. (In other cases, QSadd_col should be used to add the variable.) As an example of a possible use of QSnew_col, the function can be called to initialize the variables of an LP after a call to QScreate_prob; the constraint matrix is then created with calls to QSadd_row. A call to QSnew_col can also be used before adding a constraint that introduces a new variable to an existing problem, permitting the coefficients of the new variable to be specified in the arguments of QSadd_row. When specifying obj , lower , and upper , 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 variable w, with an objective coefficient of 1.1, and with */
/* 1.0 <= w <= 2.0. */
int rval;
const char *name = "w";
rval = QSnew_col (p, 1.1, 1.0, 2.0, name);
if (rval) {
fprintf (stderr, "QSnew_col failed with return code %d\n", rval);
}
|
 |
|
|