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 2015/06/11 14:10:40 UTC

[2/2] [math] Merge branch 'master' of https://luc@git-wip-us.apache.org/repos/asf/commons-math.git

Merge branch 'master' of
https://luc@git-wip-us.apache.org/repos/asf/commons-math.git

Conflicts:
	src/changes/changes.xml


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/2990f6ca
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/2990f6ca
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/2990f6ca

Branch: refs/heads/master
Commit: 2990f6caad0db0f7c7a2df22d65f1031ed9e33e1
Parents: 8f35fcb a55ae85
Author: Luc Maisonobe <lu...@apache.org>
Authored: Thu Jun 11 14:09:52 2015 +0200
Committer: Luc Maisonobe <lu...@apache.org>
Committed: Thu Jun 11 14:09:52 2015 +0200

----------------------------------------------------------------------
 src/changes/changes.xml                         |  9 +--
 .../math4/optim/linear/SimplexSolver.java       |  2 +
 .../math4/optim/linear/SimplexTableau.java      | 25 +++++++-
 .../math4/optim/linear/SimplexSolverTest.java   | 66 ++++++++++++++------
 4 files changed, 77 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/2990f6ca/src/changes/changes.xml
----------------------------------------------------------------------
diff --cc src/changes/changes.xml
index 4094a48,132509b..2620bc7
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@@ -54,9 -54,11 +54,14 @@@ If the output is not quite correct, che
      </release>
  
      <release version="4.0" date="XXXX-XX-XX" description="">
 +      <action dev="luc" type="fix" issue="MATH-1232"> <!-- backported to 3.6 -->
 +        Fixed error message for unknown parameter name in ODE.
 +      </action>
+       <action dev="tn" type="fix" issue="MATH-1230">
+         The "SimplexSolver" will now throw a "DimensionMismatchException"
+         when calling "optimize(...)" with linear constraints whose dimension
+         does not match the dimension of the objective function.
+       </action>
        <action dev="luc" type="fix" issue="MATH-1226"> <!-- backported to 3.6 -->
          Fixed wrong event detection in case of close events pairs.
        </action>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/2990f6ca/src/main/java/org/apache/commons/math4/optim/linear/SimplexSolver.java
----------------------------------------------------------------------
diff --cc src/main/java/org/apache/commons/math4/optim/linear/SimplexSolver.java
index d4b4259,743fe9b..a835765
--- a/src/main/java/org/apache/commons/math4/optim/linear/SimplexSolver.java
+++ b/src/main/java/org/apache/commons/math4/optim/linear/SimplexSolver.java
@@@ -146,6 -147,8 +146,8 @@@ public class SimplexSolver extends Line
       *
       * @return {@inheritDoc}
       * @throws TooManyIterationsException if the maximal number of iterations is exceeded.
 -     * @throws DimensionMismatchException if the dimension of the constraints does not match the
 -     *   dimension of the objective function
++     * @throws org.apache.commons.math4.exception.DimensionMismatchException if the dimension
++     * of the constraints does not match the dimension of the objective function
       */
      @Override
      public PointValuePair optimize(OptimizationData... optData)

http://git-wip-us.apache.org/repos/asf/commons-math/blob/2990f6ca/src/main/java/org/apache/commons/math4/optim/linear/SimplexTableau.java
----------------------------------------------------------------------
diff --cc src/main/java/org/apache/commons/math4/optim/linear/SimplexTableau.java
index e869a74,f0a842f..f11632b
--- a/src/main/java/org/apache/commons/math4/optim/linear/SimplexTableau.java
+++ b/src/main/java/org/apache/commons/math4/optim/linear/SimplexTableau.java
@@@ -154,6 -160,23 +160,23 @@@ class SimplexTableau implements Seriali
      }
  
      /**
+      * Checks that the dimensions of the objective function and the constraints match.
 -     * @param f the objective function
 -     * @param constraints the set of constraints
++     * @param objectiveFunction the objective function
++     * @param c the set of constraints
+      * @throws DimensionMismatchException if the constraint dimensions do not match with the
+      *   dimension of the objective function
+      */
 -    private void checkDimensions(final LinearObjectiveFunction f,
 -                                 final Collection<LinearConstraint> constraints) {
 -        final int dimension = f.getCoefficients().getDimension();
 -        for (final LinearConstraint constraint : constraints) {
++    private void checkDimensions(final LinearObjectiveFunction objectiveFunction,
++                                 final Collection<LinearConstraint> c) {
++        final int dimension = objectiveFunction.getCoefficients().getDimension();
++        for (final LinearConstraint constraint : c) {
+             final int constraintDimension = constraint.getCoefficients().getDimension();
+             if (constraintDimension != dimension) {
+                 throw new DimensionMismatchException(constraintDimension, dimension);
+             }
+         }
+     }
+     /**
       * Initialize the labels for the columns.
       */
      protected void initializeColumnLabels() {