You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Stephen Crowley (JIRA)" <ji...@apache.org> on 2017/10/04 15:50:00 UTC

[jira] [Created] (MATH-1433) BaseMultiStartMultivariateOptimizer.doOptimize() swallows exceptions

Stephen Crowley created MATH-1433:
-------------------------------------

             Summary: BaseMultiStartMultivariateOptimizer.doOptimize() swallows exceptions
                 Key: MATH-1433
                 URL: https://issues.apache.org/jira/browse/MATH-1433
             Project: Commons Math
          Issue Type: Bug
    Affects Versions: 3.6
         Environment:         // Multi-start loop.
        for (int i = 0; i < starts; i++) {
            // CHECKSTYLE: stop IllegalCatch
            try {
                // Decrease number of allowed evaluations.
                optimData[maxEvalIndex] = new MaxEval(maxEval - totalEvaluations);
                // New start value.
                double[] s = null;
                if (i == 0) {
                    s = startPoint;
                } else {
                    int attempts = 0;
                    while (s == null) {
                        if (attempts++ >= getMaxEvaluations()) {
                            throw new TooManyEvaluationsException(getMaxEvaluations());
                        }
                        s = generator.nextVector();
                        for (int k = 0; s != null && k < s.length; ++k) {
                            if ((min != null && s[k] < min[k]) || (max != null && s[k] > max[k])) {
                                // reject the vector
                                s = null;
                            }
                        }
                    }
                }
                optimData[initialGuessIndex] = new InitialGuess(s);
                // Optimize.
                final PAIR result = optimizer.optimize(optimData);
                store(result);
            } catch (RuntimeException mue) {
                lastException = mue;
            }
            // CHECKSTYLE: resume IllegalCatch

            totalEvaluations += optimizer.getEvaluations();
        }
            Reporter: Stephen Crowley


it took me a while to figure out that the random vector generator was throwing an exception that was being swallowed. that should never happen




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)