org.apache.commons.math3.optim.linear
public class SimplexSolver extends LinearOptimizer
Modifier and Type | Field and Description |
---|---|
private static double |
DEFAULT_EPSILON
Default amount of error to accept for algorithm convergence.
|
private static int |
DEFAULT_ULPS
Default amount of error to accept in floating point comparisons (as ulps).
|
private double |
epsilon
Amount of error to accept for algorithm convergence.
|
private int |
maxUlps
Amount of error to accept in floating point comparisons (as ulps).
|
evaluations, iterations
Constructor and Description |
---|
SimplexSolver()
Builds a simplex solver with default settings.
|
SimplexSolver(double epsilon,
int maxUlps)
Builds 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.
|
PointValuePair |
doOptimize()
Performs the bulk of the 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.
|
getConstraints, getFunction, isRestrictedToNonNegative, optimize
computeObjectiveValue, getGoalType
getLowerBound, getStartPoint, getUpperBound
getConvergenceChecker, getEvaluations, getIterations, getMaxEvaluations, getMaxIterations, incrementEvaluationCount, incrementIterationCount
private static final double DEFAULT_EPSILON
private static final int DEFAULT_ULPS
private final double epsilon
private final int maxUlps
public SimplexSolver()
public SimplexSolver(double epsilon, int maxUlps)
epsilon
- Amount of error to accept for algorithm convergence.maxUlps
- Amount of error to accept in floating point comparisons.private java.lang.Integer getPivotColumn(SimplexTableau tableau)
tableau
- Simple tableau for the problem.private java.lang.Integer getPivotRow(SimplexTableau tableau, int col)
tableau
- Simple tableau for the problem.col
- Column to test the ratio of (see getPivotColumn(SimplexTableau)
).protected void doIteration(SimplexTableau tableau) throws TooManyIterationsException, UnboundedSolutionException
tableau
- Simple tableau for the problem.TooManyIterationsException
- if the allowed number of iterations has been exhausted.UnboundedSolutionException
- if the model is found not to have a bounded solution.protected void solvePhase1(SimplexTableau tableau) throws TooManyIterationsException, UnboundedSolutionException, NoFeasibleSolutionException
tableau
- Simple tableau for the problem.TooManyIterationsException
- if the allowed number of iterations has been exhausted.UnboundedSolutionException
- if the model is found not to have a bounded solution.NoFeasibleSolutionException
- if there is no feasible solution?public PointValuePair doOptimize() throws TooManyIterationsException, UnboundedSolutionException, NoFeasibleSolutionException
doOptimize
in class BaseOptimizer<PointValuePair>
TooManyIterationsException
UnboundedSolutionException
NoFeasibleSolutionException
Copyright (c) 2003-2013 Apache Software Foundation