QSopt QScreate_prob QSopt > Callable Library > Function List
  QSopt
  Downloads
  LP Info
  Software
  Problem Formats
  Callable Library
  Overview
Function List
  Rational Solver
  Beta
  Contact Info
Purpose
Initialize a new problem data structure for an empty problem.
Synopsis
QSprob QScreate_prob (const char *name, int objsense)
Arguments
name a string specifying the name of the problem (can be NULL)
objsense specifies if the problem is a minimization problem or a maximization problem; to specify a minimization problem set objsense to QS_MIN (that is, 1) and to specify a maximization problem set objsense to QS_MAX (that is, -1).
Returns
An initialized QSprob object, providing a handle to an empty problem. If an error occurred, the QSprob object is set to NULL.
Description

The QSprob provided by this function is the starting point for building an LP problem from within an application. The QSprob is a handle to an empty problem that can be filled-in by the functions listed in the Modifying an LP Problem section in the Callable Function Library.

To specify a minimization problem set objsense to QS_MIN (that is, 1), and to specify a maximization problem set objsense to QS_MAX (that is, -1); if objsense is given some other value, the objective function defaults to minimization.

A standard method is to follow the QScreate_prob call with calls to QSnew_row to initialize the constraints, then calls to QSadd_col to create the variables and to build the coefficients in the constraint matrix. Alternatively, one can first use QSnew_col to initialize the variables, then use QSadd_row to create the constraints and the constraint matrix. (Or mix the column and row operations, if that is more natural in the given application.)

Example
QSprob p;

p = QScreate_prob ("binky", QS_MIN);
if (p == (QSprob) NULL) {
    fprintf (stderr, "Unable to initialize LP data structure\n");
} else {
    /* Build the LP with calls to QSnew_row () and QSadd_col () */
}
 
QSopt | Problem Formats | Downloads Back
Last Updated: November 2003