org.apache.commons.math.optimization.linear
public class SimplexSolver extends AbstractLinearOptimizer
Modifier and Type | Field and Description |
---|---|
private static double |
DEFAULT_EPSILON
Default amount of error to accept in floating point comparisons.
|
protected double |
epsilon
Amount of error to accept in floating point comparisons.
|
DEFAULT_MAX_ITERATIONS, function, goal, linearConstraints, nonNegative
Constructor and Description |
---|
SimplexSolver()
Build a simplex solver with default settings.
|
SimplexSolver(double epsilon)
Build a simplex solver with a specified accepted amount of error
|
Modifier and Type | Method and Description |
---|---|
protected void |
doIteration(SimplexTableau tableau)
Runs one iteration of the Simplex method on the given model.
|
RealPointValuePair |
doOptimize()
Perform the bulk of optimization algorithm.
|
private java.lang.Integer |
getPivotColumn(SimplexTableau tableau)
Returns the column with the most negative coefficient in the objective function row.
|
private java.lang.Integer |
getPivotRow(SimplexTableau tableau,
int col)
Returns the row with the minimum ratio as given by the minimum ratio test (MRT).
|
protected void |
solvePhase1(SimplexTableau tableau)
Solves Phase 1 of the Simplex method.
|
getIterations, getMaxIterations, incrementIterationsCounter, optimize, setMaxIterations
private static final double DEFAULT_EPSILON
protected final double epsilon
public SimplexSolver()
public SimplexSolver(double epsilon)
epsilon
- the amount of error to accept in floating point comparisonsprivate java.lang.Integer getPivotColumn(SimplexTableau tableau)
tableau
- simple tableau for the problemprivate java.lang.Integer getPivotRow(SimplexTableau tableau, int col)
tableau
- simple tableau for the problemcol
- the column to test the ratio of. See getPivotColumn(SimplexTableau)
protected void doIteration(SimplexTableau tableau) throws OptimizationException
tableau
- simple tableau for the problemOptimizationException
- if the maximal iteration count has been
exceeded or if the model is found not to have a bounded solutionprotected void solvePhase1(SimplexTableau tableau) throws OptimizationException
tableau
- simple tableau for the problemOptimizationException
- if the maximal number of iterations is
exceeded, or if the problem is found not to have a bounded solution, or
if there is no feasible solutionpublic RealPointValuePair doOptimize() throws OptimizationException
doOptimize
in class AbstractLinearOptimizer
OptimizationException
- if no solution fulfilling the constraints
can be found in the allowed number of iterationsCopyright (c) 2003-2013 Apache Software Foundation