Solves a linear problem using the "Two-Phase Simplex" method.
The {@link SimplexSolver} supports the following {@link OptimizationData} data providedas arguments to {@link #optimize(OptimizationData)}:
- objective function: {@link LinearObjectiveFunction} - mandatory
- linear constraints {@link LinearConstraintSet} - mandatory
- type of optimization: {@link org.apache.commons.math3.optim.nonlinear.scalar.GoalType GoalType}- optional, default: {@link org.apache.commons.math3.optim.nonlinear.scalar.GoalType#MINIMIZE MINIMIZE}
- whether to allow negative values as solution: {@link NonNegativeConstraint} - optional, default: true
- pivot selection rule: {@link PivotSelectionRule} - optional, default {@link PivotSelectionRule#DANTZIG}
- callback for the best solution: {@link SolutionCallback} - optional
- maximum number of iterations: {@link org.apache.commons.math3.optim.MaxIter} - optional, default: {@link Integer#MAX_VALUE}
Note: Depending on the problem definition, the default convergence criteria may be too strict, resulting in {@link NoFeasibleSolutionException} or{@link TooManyIterationsException}. In such a case it is advised to adjust these criteria with more appropriate values, e.g. relaxing the epsilon value.
Default convergence criteria:
- Algorithm convergence: 1e-6
- Floating-point comparisons: 10 ulp
- Cut-Off value: 1e-10
The cut-off value has been introduced to handle the case of very small pivot elements in the Simplex tableau, as these may lead to numerical instabilities and degeneracy. Potential pivot elements smaller than this value will be treated as if they were zero and are thus not considered by the pivot selection mechanism. The default value is safe for many problems, but may need to be adjusted in case of very small coefficients used in either the {@link LinearConstraint} or {@link LinearObjectiveFunction}.
@since 2.0