|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math.optimization.linear.AbstractLinearOptimizer
org.apache.commons.math.optimization.linear.SimplexSolver
public class SimplexSolver
Solves a linear problem using the Two-Phase Simplex Method.
Field Summary | |
---|---|
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. |
Fields inherited from class org.apache.commons.math.optimization.linear.AbstractLinearOptimizer |
---|
constraints, DEFAULT_MAX_ITERATIONS, f, goalType, restrictToNonNegative |
Constructor Summary | |
---|---|
SimplexSolver()
Build a simplex solver with default settings. |
|
SimplexSolver(double epsilon)
Build a simplex solver with a specified accepted amount of error |
Method Summary | |
---|---|
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(int col,
SimplexTableau tableau)
Returns the row with the minimum ratio as given by the minimum ratio test (MRT). |
boolean |
isOptimal(SimplexTableau tableau)
Returns whether the problem is at an optimal state. |
private boolean |
isPhase1Solved(SimplexTableau tableau)
Checks whether Phase 1 is solved. |
protected void |
solvePhase1(SimplexTableau tableau)
Solves Phase 1 of the Simplex method. |
Methods inherited from class org.apache.commons.math.optimization.linear.AbstractLinearOptimizer |
---|
getIterations, getMaxIterations, incrementIterationsCounter, optimize, setMaxIterations |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final double DEFAULT_EPSILON
protected final double epsilon
Constructor Detail |
---|
public SimplexSolver()
public SimplexSolver(double epsilon)
epsilon
- the amount of error to accept in floating point comparisonsMethod Detail |
---|
private java.lang.Integer getPivotColumn(SimplexTableau tableau)
tableau
- simple tableau for the problem
private java.lang.Integer getPivotRow(int col, SimplexTableau tableau)
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 problem
OptimizationException
- if the maximal iteration count has been
exceeded or if the model is found not to have a bounded solutionprivate boolean isPhase1Solved(SimplexTableau tableau)
tableau
- simple tableau for the problem
public boolean isOptimal(SimplexTableau tableau)
tableau
- simple tableau for the problem
protected void solvePhase1(SimplexTableau tableau) throws OptimizationException
tableau
- simple tableau for the problem
OptimizationException
- 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 iterations
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |