You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2011/10/01 16:52:22 UTC
svn commit: r1178006 - in /commons/proper/math/trunk/src:
main/java/org/apache/commons/math/optimization/
main/java/org/apache/commons/math/optimization/linear/ site/xdoc/
test/java/org/apache/commons/math/optimization/fitting/
test/java/org/apache/com...
Author: luc
Date: Sat Oct 1 14:52:21 2011
New Revision: 1178006
URL: http://svn.apache.org/viewvc?rev=1178006&view=rev
Log:
Replaced last remaining uses of OptimizationException.
the replacement exceptions are unchecked ones: UnboundSolutionException,
NoFeasibleSolutionException, MaxCountExceededException ...
JIRA: MATH-457
Removed:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/OptimizationException.java
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/AbstractLinearOptimizer.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/LinearOptimizer.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/NoFeasibleSolutionException.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/SimplexSolver.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/UnboundedSolutionException.java
commons/proper/math/trunk/src/site/xdoc/changes.xml
commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/fitting/GaussianFitterTest.java
commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/linear/SimplexSolverTest.java
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/AbstractLinearOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/AbstractLinearOptimizer.java?rev=1178006&r1=1178005&r2=1178006&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/AbstractLinearOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/AbstractLinearOptimizer.java Sat Oct 1 14:52:21 2011
@@ -19,9 +19,9 @@ package org.apache.commons.math.optimiza
import java.util.Collection;
+import org.apache.commons.math.exception.MathIllegalStateException;
import org.apache.commons.math.exception.MaxCountExceededException;
import org.apache.commons.math.optimization.GoalType;
-import org.apache.commons.math.optimization.OptimizationException;
import org.apache.commons.math.optimization.RealPointValuePair;
/**
@@ -104,7 +104,7 @@ public abstract class AbstractLinearOpti
public RealPointValuePair optimize(final LinearObjectiveFunction f,
final Collection<LinearConstraint> constraints,
final GoalType goalType, final boolean restrictToNonNegative)
- throws OptimizationException {
+ throws MathIllegalStateException {
// store linear problem characteristics
this.function = f;
@@ -121,10 +121,10 @@ public abstract class AbstractLinearOpti
/** Perform the bulk of optimization algorithm.
* @return the point/value pair giving the optimal value for objective function
- * @exception OptimizationException if no solution fulfilling the constraints
+ * @exception MathIllegalStateException if no solution fulfilling the constraints
* can be found in the allowed number of iterations
*/
protected abstract RealPointValuePair doOptimize()
- throws OptimizationException;
+ throws MathIllegalStateException;
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/LinearOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/LinearOptimizer.java?rev=1178006&r1=1178005&r2=1178006&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/LinearOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/LinearOptimizer.java Sat Oct 1 14:52:21 2011
@@ -19,8 +19,8 @@ package org.apache.commons.math.optimiza
import java.util.Collection;
+import org.apache.commons.math.exception.MathIllegalStateException;
import org.apache.commons.math.optimization.GoalType;
-import org.apache.commons.math.optimization.OptimizationException;
import org.apache.commons.math.optimization.RealPointValuePair;
/**
@@ -79,11 +79,11 @@ public interface LinearOptimizer {
* or {@link GoalType#MINIMIZE}
* @param restrictToNonNegative whether to restrict the variables to non-negative values
* @return point/value pair giving the optimal value for objective function
- * @exception OptimizationException if no solution fulfilling the constraints
+ * @exception MathIllegalStateException if no solution fulfilling the constraints
* can be found in the allowed number of iterations
*/
RealPointValuePair optimize(LinearObjectiveFunction f, Collection<LinearConstraint> constraints,
GoalType goalType, boolean restrictToNonNegative)
- throws OptimizationException;
+ throws MathIllegalStateException;
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/NoFeasibleSolutionException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/NoFeasibleSolutionException.java?rev=1178006&r1=1178005&r2=1178006&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/NoFeasibleSolutionException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/NoFeasibleSolutionException.java Sat Oct 1 14:52:21 2011
@@ -17,8 +17,8 @@
package org.apache.commons.math.optimization.linear;
+import org.apache.commons.math.exception.MathIllegalStateException;
import org.apache.commons.math.exception.util.LocalizedFormats;
-import org.apache.commons.math.optimization.OptimizationException;
/**
* This class represents exceptions thrown by optimizers when no solution
@@ -26,7 +26,7 @@ import org.apache.commons.math.optimizat
* @version $Id$
* @since 2.0
*/
-public class NoFeasibleSolutionException extends OptimizationException {
+public class NoFeasibleSolutionException extends MathIllegalStateException {
/** Serializable version identifier. */
private static final long serialVersionUID = -3044253632189082760L;
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/SimplexSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/SimplexSolver.java?rev=1178006&r1=1178005&r2=1178006&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/SimplexSolver.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/SimplexSolver.java Sat Oct 1 14:52:21 2011
@@ -20,7 +20,7 @@ package org.apache.commons.math.optimiza
import java.util.ArrayList;
import java.util.List;
-import org.apache.commons.math.optimization.OptimizationException;
+import org.apache.commons.math.exception.MaxCountExceededException;
import org.apache.commons.math.optimization.RealPointValuePair;
import org.apache.commons.math.util.MathUtils;
@@ -128,11 +128,11 @@ public class SimplexSolver extends Abstr
/**
* Runs one iteration of the Simplex method on the given model.
* @param tableau simple tableau for the problem
- * @throws OptimizationException if the maximal iteration count has been
- * exceeded or if the model is found not to have a bounded solution
+ * @throws MaxCountExceededException if the maximal iteration count has been exceeded
+ * @throws UnboundedSolutionException if the model is found not to have a bounded solution
*/
protected void doIteration(final SimplexTableau tableau)
- throws OptimizationException {
+ throws MaxCountExceededException, UnboundedSolutionException {
incrementIterationsCounter();
@@ -158,11 +158,12 @@ public class SimplexSolver extends Abstr
/**
* Solves Phase 1 of the Simplex method.
* @param tableau simple tableau for the problem
- * @exception 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 solution
+ * @throws MaxCountExceededException if the maximal iteration count has been exceeded
+ * @throws UnboundedSolutionException if the model is found not to have a bounded solution
+ * @throws NoFeasibleSolutionException if there is no feasible solution
*/
- protected void solvePhase1(final SimplexTableau tableau) throws OptimizationException {
+ protected void solvePhase1(final SimplexTableau tableau)
+ throws MaxCountExceededException, UnboundedSolutionException, NoFeasibleSolutionException {
// make sure we're in Phase 1
if (tableau.getNumArtificialVariables() == 0) {
@@ -181,7 +182,8 @@ public class SimplexSolver extends Abstr
/** {@inheritDoc} */
@Override
- public RealPointValuePair doOptimize() throws OptimizationException {
+ public RealPointValuePair doOptimize()
+ throws MaxCountExceededException, UnboundedSolutionException, NoFeasibleSolutionException {
final SimplexTableau tableau =
new SimplexTableau(function, linearConstraints, goal, nonNegative,
epsilon, maxUlps);
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/UnboundedSolutionException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/UnboundedSolutionException.java?rev=1178006&r1=1178005&r2=1178006&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/UnboundedSolutionException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/UnboundedSolutionException.java Sat Oct 1 14:52:21 2011
@@ -17,8 +17,8 @@
package org.apache.commons.math.optimization.linear;
+import org.apache.commons.math.exception.MathIllegalStateException;
import org.apache.commons.math.exception.util.LocalizedFormats;
-import org.apache.commons.math.optimization.OptimizationException;
/**
* This class represents exceptions thrown by optimizers when a solution
@@ -26,7 +26,7 @@ import org.apache.commons.math.optimizat
* @version $Id$
* @since 2.0
*/
-public class UnboundedSolutionException extends OptimizationException {
+public class UnboundedSolutionException extends MathIllegalStateException {
/** Serializable version identifier. */
private static final long serialVersionUID = 940539497277290619L;
Modified: commons/proper/math/trunk/src/site/xdoc/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/site/xdoc/changes.xml?rev=1178006&r1=1178005&r2=1178006&view=diff
==============================================================================
--- commons/proper/math/trunk/src/site/xdoc/changes.xml (original)
+++ commons/proper/math/trunk/src/site/xdoc/changes.xml Sat Oct 1 14:52:21 2011
@@ -52,6 +52,11 @@ The <action> type attribute can be add,u
If the output is not quite correct, check for invisible trailing spaces!
-->
<release version="3.0" date="TBD" description="TBD">
+ <action dev="luc" type="fix" issue="MATH-457" >
+ The last remaining uses of OptimizationException have been replaced by unchecked
+ exceptions (UnboundSolutionException, NoFeasibleSolutionException,
+ MaxCountExceededException ...)
+ </action>
<action dev="luc" type="fix" issue="MATH-487" >
The checked ConvergenceException has been replaced by an unchecked ConvergenceException.
</action>
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/fitting/GaussianFitterTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/fitting/GaussianFitterTest.java?rev=1178006&r1=1178005&r2=1178006&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/fitting/GaussianFitterTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/fitting/GaussianFitterTest.java Sat Oct 1 14:52:21 2011
@@ -18,7 +18,6 @@
package org.apache.commons.math.optimization.fitting;
import org.apache.commons.math.exception.MathIllegalArgumentException;
-import org.apache.commons.math.optimization.OptimizationException;
import org.apache.commons.math.optimization.general.LevenbergMarquardtOptimizer;
import org.junit.Assert;
@@ -182,12 +181,9 @@ public class GaussianFitterTest {
/**
* Basic.
- *
- * @throws OptimizationException in the event of a test case error
*/
@Test
- public void testFit01()
- throws OptimizationException {
+ public void testFit01() {
GaussianFitter fitter = new GaussianFitter(new LevenbergMarquardtOptimizer());
addDatasetToGaussianFitter(DATASET1, fitter);
double[] parameters = fitter.fit();
@@ -199,24 +195,18 @@ public class GaussianFitterTest {
/**
* Zero points is not enough observed points.
- *
- * @throws OptimizationException in the event of a test case error
*/
@Test(expected=MathIllegalArgumentException.class)
- public void testFit02()
- throws OptimizationException {
+ public void testFit02() {
GaussianFitter fitter = new GaussianFitter(new LevenbergMarquardtOptimizer());
fitter.fit();
}
/**
* Two points is not enough observed points.
- *
- * @throws OptimizationException in the event of a test case error
*/
@Test(expected=MathIllegalArgumentException.class)
- public void testFit03()
- throws OptimizationException {
+ public void testFit03() {
GaussianFitter fitter = new GaussianFitter(new LevenbergMarquardtOptimizer());
addDatasetToGaussianFitter(new double[][] {
{4.0254623, 531026.0},
@@ -227,13 +217,9 @@ public class GaussianFitterTest {
/**
* Poor data: right of peak not symmetric with left of peak.
- *
- * @throws OptimizationException in the event of a test case error
*/
@Test
- public void testFit04()
- throws OptimizationException
- {
+ public void testFit04() {
GaussianFitter fitter = new GaussianFitter(new LevenbergMarquardtOptimizer());
addDatasetToGaussianFitter(DATASET2, fitter);
double[] parameters = fitter.fit();
@@ -245,12 +231,9 @@ public class GaussianFitterTest {
/**
* Poor data: long tails.
- *
- * @throws OptimizationException in the event of a test case error
*/
@Test
- public void testFit05()
- throws OptimizationException {
+ public void testFit05() {
GaussianFitter fitter = new GaussianFitter(new LevenbergMarquardtOptimizer());
addDatasetToGaussianFitter(DATASET3, fitter);
double[] parameters = fitter.fit();
@@ -262,12 +245,9 @@ public class GaussianFitterTest {
/**
* Poor data: right of peak is missing.
- *
- * @throws OptimizationException in the event of a test case error
*/
@Test
- public void testFit06()
- throws OptimizationException {
+ public void testFit06() {
GaussianFitter fitter = new GaussianFitter(new LevenbergMarquardtOptimizer());
addDatasetToGaussianFitter(DATASET4, fitter);
double[] parameters = fitter.fit();
@@ -279,12 +259,9 @@ public class GaussianFitterTest {
/**
* Basic with smaller dataset.
- *
- * @throws OptimizationException in the event of a test case error
*/
@Test
- public void testFit07()
- throws OptimizationException {
+ public void testFit07() {
GaussianFitter fitter = new GaussianFitter(new LevenbergMarquardtOptimizer());
addDatasetToGaussianFitter(DATASET5, fitter);
double[] parameters = fitter.fit();
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/linear/SimplexSolverTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/linear/SimplexSolverTest.java?rev=1178006&r1=1178005&r2=1178006&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/linear/SimplexSolverTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/linear/SimplexSolverTest.java Sat Oct 1 14:52:21 2011
@@ -23,7 +23,6 @@ import java.util.ArrayList;
import java.util.Collection;
import org.apache.commons.math.optimization.GoalType;
-import org.apache.commons.math.optimization.OptimizationException;
import org.apache.commons.math.optimization.RealPointValuePair;
import org.apache.commons.math.util.MathUtils;
import org.junit.Test;
@@ -31,8 +30,7 @@ import org.junit.Test;
public class SimplexSolverTest {
@Test
- public void testMath434NegativeVariable() throws OptimizationException
- {
+ public void testMath434NegativeVariable() {
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] {0.0, 0.0, 1.0}, 0.0d);
ArrayList<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] {1, 1, 0}, Relationship.EQ, 5));
@@ -49,8 +47,7 @@ public class SimplexSolverTest {
}
@Test(expected = NoFeasibleSolutionException.class)
- public void testMath434UnfeasibleSolution() throws OptimizationException
- {
+ public void testMath434UnfeasibleSolution() {
double epsilon = 1e-6;
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] {1.0, 0.0}, 0.0);
@@ -64,8 +61,7 @@ public class SimplexSolverTest {
}
@Test
- public void testMath434PivotRowSelection() throws OptimizationException
- {
+ public void testMath434PivotRowSelection() {
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] {1.0}, 0.0);
double epsilon = 1e-6;
@@ -81,8 +77,7 @@ public class SimplexSolverTest {
}
@Test
- public void testMath434PivotRowSelection2() throws OptimizationException
- {
+ public void testMath434PivotRowSelection2() {
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] {0.0d, 1.0d, 1.0d, 0.0d, 0.0d, 0.0d, 0.0d}, 0.0d);
ArrayList<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
@@ -107,7 +102,7 @@ public class SimplexSolverTest {
}
@Test
- public void testMath272() throws OptimizationException {
+ public void testMath272() {
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 2, 2, 1 }, 0);
Collection<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] { 1, 1, 0 }, Relationship.GEQ, 1));
@@ -124,7 +119,7 @@ public class SimplexSolverTest {
}
@Test
- public void testMath286() throws OptimizationException {
+ public void testMath286() {
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 0.8, 0.2, 0.7, 0.3, 0.6, 0.4 }, 0 );
Collection<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] { 1, 0, 1, 0, 1, 0 }, Relationship.EQ, 23.0));
@@ -145,7 +140,7 @@ public class SimplexSolverTest {
}
@Test
- public void testDegeneracy() throws OptimizationException {
+ public void testDegeneracy() {
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 0.8, 0.7 }, 0 );
Collection<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] { 1, 1 }, Relationship.LEQ, 18.0));
@@ -158,7 +153,7 @@ public class SimplexSolverTest {
}
@Test
- public void testMath288() throws OptimizationException {
+ public void testMath288() {
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 7, 3, 0, 0 }, 0 );
Collection<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] { 3, 0, -5, 0 }, Relationship.LEQ, 0.0));
@@ -173,7 +168,7 @@ public class SimplexSolverTest {
}
@Test
- public void testMath290GEQ() throws OptimizationException {
+ public void testMath290GEQ() {
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 1, 5 }, 0 );
Collection<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] { 2, 0 }, Relationship.GEQ, -1.0));
@@ -185,7 +180,7 @@ public class SimplexSolverTest {
}
@Test(expected=NoFeasibleSolutionException.class)
- public void testMath290LEQ() throws OptimizationException {
+ public void testMath290LEQ() {
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 1, 5 }, 0 );
Collection<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] { 2, 0 }, Relationship.LEQ, -1.0));
@@ -194,7 +189,7 @@ public class SimplexSolverTest {
}
@Test
- public void testMath293() throws OptimizationException {
+ public void testMath293() {
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 0.8, 0.2, 0.7, 0.3, 0.4, 0.6}, 0 );
Collection<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] { 1, 0, 1, 0, 1, 0 }, Relationship.EQ, 30.0));
@@ -231,7 +226,7 @@ public class SimplexSolverTest {
}
@Test
- public void testSimplexSolver() throws OptimizationException {
+ public void testSimplexSolver() {
LinearObjectiveFunction f =
new LinearObjectiveFunction(new double[] { 15, 10 }, 7);
Collection<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
@@ -247,7 +242,7 @@ public class SimplexSolverTest {
}
@Test
- public void testSingleVariableAndConstraint() throws OptimizationException {
+ public void testSingleVariableAndConstraint() {
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 3 }, 0);
Collection<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] { 1 }, Relationship.LEQ, 10));
@@ -263,7 +258,7 @@ public class SimplexSolverTest {
* constraints) we can go straight to Phase 2.
*/
@Test
- public void testModelWithNoArtificialVars() throws OptimizationException {
+ public void testModelWithNoArtificialVars() {
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 15, 10 }, 0);
Collection<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] { 1, 0 }, Relationship.LEQ, 2));
@@ -278,7 +273,7 @@ public class SimplexSolverTest {
}
@Test
- public void testMinimization() throws OptimizationException {
+ public void testMinimization() {
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { -2, 1 }, -5);
Collection<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] { 1, 2 }, Relationship.LEQ, 6));
@@ -293,7 +288,7 @@ public class SimplexSolverTest {
}
@Test
- public void testSolutionWithNegativeDecisionVariable() throws OptimizationException {
+ public void testSolutionWithNegativeDecisionVariable() {
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { -2, 1 }, 0);
Collection<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] { 1, 1 }, Relationship.GEQ, 6));
@@ -307,7 +302,7 @@ public class SimplexSolverTest {
}
@Test(expected = NoFeasibleSolutionException.class)
- public void testInfeasibleSolution() throws OptimizationException {
+ public void testInfeasibleSolution() {
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 15 }, 0);
Collection<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] { 1 }, Relationship.LEQ, 1));
@@ -318,7 +313,7 @@ public class SimplexSolverTest {
}
@Test(expected = UnboundedSolutionException.class)
- public void testUnboundedSolution() throws OptimizationException {
+ public void testUnboundedSolution() {
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 15, 10 }, 0);
Collection<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] { 1, 0 }, Relationship.EQ, 2));
@@ -328,7 +323,7 @@ public class SimplexSolverTest {
}
@Test
- public void testRestrictVariablesToNonNegative() throws OptimizationException {
+ public void testRestrictVariablesToNonNegative() {
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 409, 523, 70, 204, 339 }, 0);
Collection<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] { 43, 56, 345, 56, 5 }, Relationship.LEQ, 4567456));
@@ -348,7 +343,7 @@ public class SimplexSolverTest {
}
@Test
- public void testEpsilon() throws OptimizationException {
+ public void testEpsilon() {
LinearObjectiveFunction f =
new LinearObjectiveFunction(new double[] { 10, 5, 1 }, 0);
Collection<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
@@ -365,7 +360,7 @@ public class SimplexSolverTest {
}
@Test
- public void testTrivialModel() throws OptimizationException {
+ public void testTrivialModel() {
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 1, 1 }, 0);
Collection<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] { 1, 1 }, Relationship.EQ, 0));
@@ -376,7 +371,7 @@ public class SimplexSolverTest {
}
@Test
- public void testLargeModel() throws OptimizationException {
+ public void testLargeModel() {
double[] objective = new double[] {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 12, 1, 1, 1, 1, 1, 1, 1,