QSopt QSopt_primal QSopt > Callable Library > Function List
  QSopt
  Downloads
  LP Info
  Software
  Problem Formats
  Callable Library
  Overview
Function List
  Rational Solver
  Beta
  Contact Info
Purpose
Solve the LP problem with the primal simplex algorithm.
Synopsis
int QSopt_primal (QSprob p, int *status)
Arguments
p a handle to an initialized problem.
status returns a code to indicate the status of the final solution.
Returns
A zero value if the function terminated correctly, and a non-zero value if an error occurred.
Description

In general, there is not a clear-cut winner between the primal and dual simplex algorithms. If performance is important in an application, it may pay to make tests of both methods to determine which function to use in the given setting.

After a call to QSopt_primal, the status variable should be checked to determine the status of the solution. In the most common cases, either an optimal solution is found (indicated by a value of QS_LP_OPTIMAL), or the problem is shown to be in infeasible (QS_LP_INFEASIBLE), or the problem is shown to be unbounded (QS_LP_UNBOUNDED). Optimization Status Codes gives a full list of the possible values for status.

The QSset_param function can be used to select the pricing rule that is used in QSopt_primal. The appropriate value for the whichparam argument of QSset_param is given below.

Constant Parameter
QS_PARAM_PRIMAL_PRICING Primal Pricing

The QSopt library has available four pricing rules for the primal simplex algorithm. The pricing rule can be specified in QSset_param by setting the newvalue argument to one of the values given below.

Constant Rule
QS_PRICE_PDANTZIG Primal Dantzig
QS_PRICE_PDEVEX Primal Devex
QS_PRICE_PSTEEP Primal steepest-edge

See Parameter Setting for the Optimizer for more parameters associated with the optimization algorithm

Example
int status, rval;

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

rval = QSopt_primal (p, &status);
if (rval) 
    fprintf (stderr, "QSopt_primal failed with return code %d\n", rval);
} else {
    switch (status) {
    case QS_LP_OPTIMAL:
        printf ("Found optimal solution to LP\n");
        break;
    case QS_LP_INFEASIBLE:
        printf ("No feasible solution exists for the LP\n");
        break;
    case QS_LP_UNBOUNDED:
        printf ("The LP objective is unbounded\n");
        break;
    default:
        printf ("LP could not be solved, status = %d\n", status);
        break;
    }
}
 
QSopt | Problem Formats | Downloads Back
Last Updated: November 2003