QSopt QSget_binv_row QSopt > Callable Library > Beta
  QSopt
  Downloads
  LP Info
  Software
  Problem Formats
  Callable Library
  Overview
  Function List
  Rational Solver
  Beta
  Contact Info
Purpose
Copy row of basis inverse into array.
Synopsis
int QSget_binv_row (QSprob p, int indx, double *binvrow)
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).
binvrow returns the row of the basis inverse as an array; this field should point to an array of length at least nrows.
Returns
A zero value if the function terminated correctly, and a non-zero value if an error occurred. Note that QSget_binv_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 row (specified by indx) of the basis inverse for the current optimal basis for the problem. The ordering of the basic variables can be obtained with a call to the function QSget_basis_order. The calling function must allocate the memory for the array binvrow; the array should be of length at least nrows, the number of rows in the problem.

It is important to note that for the elements of the basis corresponding to rows, the signs given in the basis inverse 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 i, rval, nrows;
double *binv;

nrows = QSget_rowcount (p);
binv = (double *) malloc (nrows * sizeof (double));

rval = QSget_binv_row (p, indx, binv);
if (rval) {
    fprintf (stderr, "could not obtain binv, error code %d\n", rval);
} else {
    for (i = 0; i < nrows; i++) {
        printf ("binv[%d] = %f\n", i, binv[i]);
    }
}

free (binv);

 
QSopt | Problem Formats | Downloads Back
Last Updated: November 2003