QSopt QSget_row_index QSopt > Callable Library > Function List
  QSopt
  Downloads
  LP Info
  Software
  Problem Formats
  Callable Library
  Overview
Function List
  Rational Solver
  Beta
  Contact Info
Purpose
Obtain the index of a named row.
Synopsis
int QSget_row_index (QSprob p, const char *name, int *rowindex)
Arguments
p a handle to an initialized problem.
name a string containing the name of a row.
rowindex returns the index of the row in the problem (a value between 0 and nrows - 1, where nrows is the number of rows in the problem); if the row is not in the problem, rowindex is set to -1.
Returns
A zero value if the function terminated correctly, and a non-zero value if an error occurred.
Description

This function returns the index of a constraint specified by name (all rows in an initialized QSprob have associated names). The function provides an easy way to keep track of a named row, particularly after calls that delete rows (and change the indices of those that remain).

Example
/* p is an initialized QSprob, a handle to an existing LP problem  */
/* Find the index of the constraint r1.                            */

int rval, rowindex;
const char *name = "r1";

rval = QSget_row_index (p, name, &rowindex);
if (rval) {
    fprintf (stderr, "could not get index, error code %d\n", rval);
} else {
    if (rowindex == -1) {
        printf ("%s is not in the problem\n", name);
    } else {
        printf ("%s is row number %d\n", name, rowindex);
    }
}
 
QSopt | Problem Formats | Downloads Back
Last Updated: November 2003