 |
 |
 |
 |
Purpose |
 |
 |
Copy row of tableau into array.
|
 |
Synopsis |
 |
 |
int QSget_tableau_row (QSprob p, int indx, double *tableaurow)
|
 |
Arguments |
 |
p |
 |
a handle to an initialized problem. |
indx |
 |
index of a row (so a value between 0 and nrows - 1 , where nrows is the number of rows in the problem). |
tableaurow |
 |
returns the row of the tableau as an array; this field should point to an array of length at least ncols + nrows . |
|
 |
Returns |
 |
 |
A zero value if the function terminated correctly, and a non-zero value if an error occurred. Note that QSget_tableau_row returns an error code if it is called with a specified problem that has not been solved with one of the optimization functions ( QSopt_dual or QSopt_primal) since the last time the problem was loaded or modified.
|
 |
Description |
 |
 |
This function returns a full row (including the logical variables) of the LP tableau corresponding to the indx 'th basic variable in the basis ordering returned by QSget_basis_order. The function will only work when the LP has been optimized, and otherwise returns an error. The calling function must allocate the memory for the array binvrow ; the array should be of length at least ncols + nrows , that is, the sum of the number of columns and the number of rows in the problem. It is important to note that for tableau entries corresponding to rows, the signs reflect the signs of the logical variables. For "ax <= b" and "ax = b" constraints, the sign of the logical variable is positive (the coefficient is +1), and for "ax >= b" and "b1 <= ax <= b2" constraints the sign of the logical variable is negative (the coefficient is -1).
|
 |
Example |
 |
 |
/* p is an initialized QSprob, a handle to an existing LP problem */
int j, rval, ncols, nrows;
double *tableau;
ncols = QSget_colcount (p);
nrows = QSget_rowcount (p);
tableau = (double *) malloc ((ncols + nrows) * sizeof (double));
rval = QSget_tableau_row (p, indx, tableau);
if (rval) {
fprintf (stderr, "could not obtain tableau, error code %d\n", rval);
} else {
for (j = 0; j < ncols + nrows; j++) {
printf ("tableau[%d] = %f\n", j, tableau[j]);
}
}
free (tableau);
|
 |
|
|