QSopt QSget_bounds 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 lower and upper bounds into arrays.
Synopsis
int QSget_bounds (QSprob p, double *lower, double *upper)
Arguments
p a handle to an initialized problem.
lower returns the variable lower bounds as an array; this field can be NULL, if it is not NULL then it should point to an array of length at least ncols, the number of columns in the problem.
upper returns the variable upper bounds as an array; this field can be NULL, if it is not NULL then it should point to an array of length at least ncols.
Returns
A zero value if the function terminated correctly, and a non-zero value if an error occurred.
Description

This function returns the lower and upper bounds on all variables (if one of the two arrays is not needed, its argument can be set to NULL). The calling function must allocate the memory for the two arrays (unless they are set to NULL); the arrays should be of length at least ncols, the number of columns in the problem. If some variable does not have a lower bound, the corresponding value of lower will be set to -QS_MAXDOUBLE. Similarly, if some variable does not have an upper bound, the corresponding value of upper will be set to QS_MAXDOUBLE.

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

int j, rval, ncols;
double *lower, *upper;

ncols = QSget_colcount (p);
lower = (double *) malloc (ncols * sizeof (double));
upper = (double *) malloc (ncols * sizeof (double));

rval = QSget_bounds (p, lower, upper);
if (rval) {
    fprintf (stderr, "could not obtain bounds, error code %d\n", rval);
} else {
    for (j = 0; j < ncols; j++) {
        if (lower[j] == -QS_MAXDOUBLE) {
            printf ("-infinity");
        } else {
            printf ("%f", lower[j]);
        }
          printf (" <= Variable %d <= ", j);
        if (upper[j] == QS_MAXDOUBLE) {
            printf ("+infinity\n");
        } else {
            printf ("%f\n", upper[j]);
        }
    }
}

free (lower);
free (upper);
 
QSopt | Problem Formats | Downloads Back
Last Updated: November 2003