Author: tn
Date: Sat Jan 19 13:40:09 2013
New Revision: 1435544
URL: http://svn.apache.org/viewvc?rev=1435544&view=rev
Log:
[MATH-930] Add info the class javadoc wrt convergence criteria, add another
ctor to only adjust the epsilon value.
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optim/linear/SimplexSolver.java
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optim/linear/SimplexSolver.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optim/linear/SimplexSolver.java?rev=1435544&r1=1435543&r2=1435544&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optim/linear/SimplexSolver.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optim/linear/SimplexSolver.java
Sat Jan 19 13:40:09 2013
@@ -24,6 +24,23 @@ import org.apache.commons.math3.util.Pre
/**
* Solves a linear problem using the "Two-Phase Simplex" method.
+ * <p>
+ * <b>Note:</b> 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.
+ * <p>
+ * Default convergence criteria:
+ * <ul>
+ * <li>Algorithm convergence: 1e-6</li>
+ * <li>Floating-point comparisons: 10 ulp</li>
+ * </ul>
+ * <p>
+ * It may also be counter-productive to provide a too large value for {@link
MaxIter}
+ * as parameter in the call of {@link
#optimize(org.apache.commons.math3.optim.OptimizationData...)},
+ * as the {@link SimplexSolver} will use different strategies depending on the
current iteration
+ * count. After half of the allowed max iterations has already been reached,
the strategy to select
+ * pivot rows will change in order to break possible cycles due to degenerate
problems.
*
* @version $Id$
* @since 2.0
@@ -52,6 +69,15 @@ public class SimplexSolver extends Linea
* Builds a simplex solver with a specified accepted amount of error.
*
* @param epsilon Amount of error to accept for algorithm convergence.
+ */
+ public SimplexSolver(final double epsilon) {
+ this(epsilon, DEFAULT_ULPS);
+ }
+
+ /**
+ * Builds a simplex solver with a specified accepted amount of error.
+ *
+ * @param epsilon Amount of error to accept for algorithm convergence.
* @param maxUlps Amount of error to accept in floating point comparisons.
*/
public SimplexSolver(final double epsilon,