QSopt QSget_column_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 column.
Synopsis
int QSget_column_index (QSprob p, const char *name, int *colindex)
Arguments
p a handle to an initialized problem.
name a string containing the name of a variable.
colindex returns the index of the variable in the problem (a value between 0 and ncols - 1, where ncols is the number of columns in the problem); if the variable is not in the problem, colindex 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 variable specified by name (all variables in an initialized QSprob have associated names). The function provides an easy way to keep track of a named variable, particularly after calls that delete columns (and change the indices of the remaining variables).

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

int rval, colindex;
const char *name = "z";

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