org.apache.commons.math3.optimization.linear

## Class SimplexSolver

- java.lang.Object
- - org.apache.commons.math3.optimization.linear.AbstractLinearOptimizer
  - - org.apache.commons.math3.optimization.linear.SimplexSolver

- All Implemented Interfaces:
    LinearOptimizer

      public class SimplexSolver
      extends AbstractLinearOptimizer

  Solves a linear problem using the Two-Phase Simplex Method.
  Since:
    2.0
  Version:
    $Id: SimplexSolver.java 1296553 2012-03-03 01:52:06Z erans $

- - ### Field Summary

    - ### Fields inherited from class org.apache.commons.math3.optimization.linear.AbstractLinearOptimizer

      `DEFAULT_MAX_ITERATIONS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SimplexSolver()` Build a simplex solver with default settings.
    `SimplexSolver(double epsilon, int maxUlps)` Build a simplex solver with a specified accepted amount of error

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `doIteration(org.apache.commons.math3.optimization.linear.SimplexTableau tableau)` Runs one iteration of the Simplex method on the given model.
    `PointValuePair` | `doOptimize()` Perform the bulk of optimization algorithm.
    `protected void` | `solvePhase1(org.apache.commons.math3.optimization.linear.SimplexTableau tableau)` Solves Phase 1 of the Simplex method.

    - ### Methods inherited from class org.apache.commons.math3.optimization.linear.AbstractLinearOptimizer

      `getConstraints, getFunction, getGoalType, getIterations, getMaxIterations, incrementIterationsCounter, optimize, restrictToNonNegative, setMaxIterations`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SimplexSolver

          public SimplexSolver()

      Build a simplex solver with default settings.

    - #### SimplexSolver

          public SimplexSolver(double epsilon,
                       int maxUlps)

      Build a simplex solver with a specified accepted amount of error
      Parameters:
        `epsilon` - the amount of error to accept for algorithm convergence
        `maxUlps` - amount of error to accept in floating point comparisons

  - ### Method Detail

    - #### doIteration

          protected void doIteration(org.apache.commons.math3.optimization.linear.SimplexTableau tableau)
                              throws MaxCountExceededException,
                                     UnboundedSolutionException

      Runs one iteration of the Simplex method on the given model.
      Parameters:
        `tableau` - simple tableau for the problem
      Throws:
        `MaxCountExceededException` - if the maximal iteration count has been exceeded
        `UnboundedSolutionException` - if the model is found not to have a bounded solution

    - #### solvePhase1

          protected void solvePhase1(org.apache.commons.math3.optimization.linear.SimplexTableau tableau)
                              throws MaxCountExceededException,
                                     UnboundedSolutionException,
                                     NoFeasibleSolutionException

      Solves Phase 1 of the Simplex method.
      Parameters:
        `tableau` - simple tableau for the problem
      Throws:
        `MaxCountExceededException` - if the maximal iteration count has been exceeded
        `UnboundedSolutionException` - if the model is found not to have a bounded solution
        `NoFeasibleSolutionException` - if there is no feasible solution

    - #### doOptimize

          public PointValuePair doOptimize()
                                    throws MaxCountExceededException,
                                           UnboundedSolutionException,
                                           NoFeasibleSolutionException

      Perform the bulk of optimization algorithm.
      Specified by:
        `doOptimize` in class `AbstractLinearOptimizer`
      Returns:
        the point/value pair giving the optimal value for objective function
      Throws:
        `MaxCountExceededException`
        `UnboundedSolutionException`
        `NoFeasibleSolutionException`

Copyright © 2003-2012 The Apache Software Foundation. All Rights Reserved.