QSopt QSget_obj 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 objective function coefficients into an array.
Synopsis
int QSget_obj (QSprob p, double *obj)
Arguments
p a handle to an initialized problem.
obj returns the objective function coefficients as an array; this field should point to an array of length at least ncols, the number of columns in the problem.
Returns
A zero value if the function terminated correctly, and a non-zero value if an error occurred.
Description

This function returns the coefficients of the objective function as a dense vector, that is, all coefficients (both zero and non-zero) are returned in the array obj. The calling function must allocate the memory for the obj array; it should be of length at least ncols.

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

int rval, ncols;
double *obj;

ncols = QSget_colcount (p);
obj = (double *) malloc (ncols * sizeof (double));

rval = QSget_obj (p, obj);
if (rval) {
    fprintf (stderr, 
             "Could not get objective, error code %d\n", rval);
} else {
    printf ("Objective Function\n");
    for (i = 0; i < ncols; i++) {
        printf ("%f\n", obj[i]);
    }
}

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