QSopt QSget_basis_order QSopt > Callable Library > Beta
  QSopt
  Downloads
  LP Info
  Software
  Problem Formats
  Callable Library
  Overview
  Function List
  Rational Solver
  Beta
  Contact Info
Purpose
Obtain the variable ordering in the current basis.
Synopsis
int QSget_basis_order (QSprob p, int *basorder)
Arguments
p a handle to an initialized problem.
basorder returns the ordering of the basic variables as an array; this field should point to an array of length at least nrows; the indices of logical variables are returned as ncols + i for row i.
Returns
A zero value if the function terminated correctly, and a non-zero value if an error occurred. Note that QSget_basis_order 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 an array of column and row indices, specifying the ordering of the variables in the current basis. If an entry k is less than ncols (the number of columns in the problem), then it means column k. If an entry k is greater than or equal to ncols, then it means row k-ncols.

The calling function must allocate the memory for the array basorder; the array should be of length at least nrows (the number of rows in the problem).

Example
/* p is an initialized QSprob, a handle to an existing LP problem  */

int i, rval, ncols, nrows;
int *basorder;

ncols = QSget_colcount (p);
nrows = QSget_rowcount (p);
basorder = (int *) malloc (nrows * sizeof (int));

rval = QSget_basis_order (p, basorder);
if (rval) {
    fprintf (stderr, "could not obtain order, error code %d\n", rval);
} else {
    for (i = 0; i < nrows; i++) {
        if (basorder[i] < ncols) {
            printf ("Basis[%d] = Column %d\n", i, basorder[i]);
        } else {
            printf ("Basis[%d] = Row %d\n", i, basorder[i] - ncols);
        }
    }
}

free (basorder);

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