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 18:12:00 UTC

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

     [ https://issues.apache.org/jira/browse/MATH-1433?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stephen Crowley updated MATH-1433:
----------------------------------
    Attachment: BaseMultiStartMultivariateOptimizerTest.java

test case

> 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
>              Labels: easyfix
>         Attachments: BaseMultiStartMultivariateOptimizerTest.java
>
>
> 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)