From efb3e07afe66351f9879601d4bb3dd4b6d89f059 Mon Sep 17 00:00:00 2001 From: Thomas Neidhart Date: Sun, 5 Aug 2012 14:00:33 +0000 Subject: [PATCH] Fixed warnings spotted by checkgilles. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1369591 13f79535-47bb-0310-9956-ffa450edef68 --- .../commons/math3/optimization/linear/SimplexSolver.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/commons/math3/optimization/linear/SimplexSolver.java b/src/main/java/org/apache/commons/math3/optimization/linear/SimplexSolver.java index bb7960b19..9446882c2 100644 --- a/src/main/java/org/apache/commons/math3/optimization/linear/SimplexSolver.java +++ b/src/main/java/org/apache/commons/math3/optimization/linear/SimplexSolver.java @@ -140,10 +140,11 @@ public class SimplexSolver extends AbstractLinearOptimizer { if (getIterations() < getMaxIterations() / 2) { Integer minRow = null; int minIndex = tableau.getWidth(); + final int varStart = tableau.getNumObjectiveFunctions(); + final int varEnd = tableau.getWidth() - 1; for (Integer row : minRatioPositions) { - int i = tableau.getNumObjectiveFunctions(); - for (; i < tableau.getWidth() - 1 && !row.equals(minRow); i++) { - Integer basicRow = tableau.getBasicRow(i); + for (int i = varStart; i < varEnd && !row.equals(minRow); i++) { + final Integer basicRow = tableau.getBasicRow(i); if (basicRow != null && basicRow.equals(row)) { if (i < minIndex) { minIndex = i;