QSopt QSget_basis_array QSopt > Callable Library > Function List
  QSopt
  Downloads
  LP Info
  Software
  Problem Formats
  Callable Library
  Overview
Function List
  Rational Solver
  Beta
  Contact Info
Purpose
Copy the current basis into arrays.
Synopsis
int QSget_basis_array (QSprob p, char *cstat, char *rstat)
Arguments
p a handle to an initialized problem.
cstat returns an array specifying the status of each column (variable) in the basis; this field can be NULL, if it is not NULL it should point to an array of length at least ncols, the number of columns in the problem.
rstat returns an array specifying the status of each row (constraint) in the basis; this field can be NULL, if it is not NULL it should point to an array of length at least nrows, the number of rows in the problem.
Returns
A zero value if the function terminated correctly, and a non-zero value if an error occurred.
Description

The status of the columns (variables) in the basis are specified in the array cstat. Each entry in the cstat array is one of the following four values

Value Constant Meaning
0 QS_COL_BSTAT_LOWER Variable is non-basic, at lower bound
1 QS_COL_BSTAT_BASIC Variable is basic
2 QS_COL_BSTAT_UPPER Variable is non-basic, at upper bound
3 QS_COL_BSTAT_FREE Variable is non-basic and free

Similarly, the status of the rows (constraints) in the basis (that is, the status of the logical variables [either slack variables or artificial variables] corresponding to the rows) are specified in the array rstat. Each entry in the rstat array is one of the following two values

Value Constant Meaning
0 QS_ROW_BSTAT_LOWER Logical variable is non-basic, at lower bound
1 QS_ROW_BSTAT_BASIC Logical variable is basic
2 QS_ROW_BSTAT_UPPER Logical variable is non-basic, at upper bound

Note that a logical variable has an associated upper bound only if it corresponds to a range constraint.

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

int rval, ncols, nrows;
char *cstat, *rstat;

ncols = QSget_colcount (p);
nrows = QSget_rowcount (p);

cstat = (char *) malloc (ncols * sizeof (char));
rstat = (char *) malloc (nrows * sizeof (char));

rval = QSget_basis_array (p, cstat, rstat);
if (rval) {
    fprintf (stderr, "Could not get the basis, error code %d\n", rval);
} else {
    /* The basis information is stored in the arrays. */
}

free (cstat);
free (rstat);
 
QSopt | Problem Formats | Downloads Back
Last Updated: November 2003