commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Crowley (JIRA)" <j...@apache.org>
Subject [jira] [Created] (MATH-1433) BaseMultiStartMultivariateOptimizer.doOptimize() swallows exceptions
Date Wed, 04 Oct 2017 15:50:00 GMT
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)

Mime
View raw message