[jira] [Created] (MATH-728) Errors in BOBYQAOptimizer when numberOfInterpolationPoints is greater than 2*dim+1

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (MATH-728) Errors in BOBYQAOptimizer when numberOfInterpolationPoints is greater than 2*dim+1

ASF GitHub Bot (Jira)
Errors in BOBYQAOptimizer when numberOfInterpolationPoints is greater than 2*dim+1
----------------------------------------------------------------------------------

                 Key: MATH-728
                 URL: https://issues.apache.org/jira/browse/MATH-728
             Project: Commons Math
          Issue Type: Bug
    Affects Versions: 3.0
         Environment: Mac Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11M3527)

            Reporter: Bruce A Johnson


I've been having trouble getting BOBYQA to minimize a function (actually a non-linear least squares fit) so as one change I increased the number of interpolation points.  It seems that anything larger than 2*dim+1 causes an error (typically at

line 1662
                   interpolationPoints.setEntry(nfm, ipt, interpolationPoints.getEntry(ipt, ipt));

I'm guessing there is an off by one error in the translation from FORTRAN.  Changing the BOBYQAOptimizerTest as follows (increasing number of interpolation points by one) will cause failures.

Bruce



Index: src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java
===================================================================
--- src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java (revision 1221065)
+++ src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java (working copy)
@@ -258,7 +258,7 @@
 //        RealPointValuePair result = optim.optimize(100000, func, goal, startPoint);
         final double[] lB = boundaries == null ? null : boundaries[0];
         final double[] uB = boundaries == null ? null : boundaries[1];
-        BOBYQAOptimizer optim = new BOBYQAOptimizer(2 * dim + 1);
+        BOBYQAOptimizer optim = new BOBYQAOptimizer(2 * dim + 2);
         RealPointValuePair result = optim.optimize(maxEvaluations, func, goal, startPoint, lB, uB);
 //        System.out.println(func.getClass().getName() + " = "
 //              + optim.getEvaluations() + " f(");


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (MATH-728) Errors in BOBYQAOptimizer when numberOfInterpolationPoints is greater than 2*dim+1

ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/MATH-728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13172888#comment-13172888 ]

Bruce A Johnson commented on MATH-728:
--------------------------------------

Making this change fixes the problem and seems reasonable, but one of the original translators (from FORTRAN to Java) should look this section of code over.


@@ -1657,10 +1657,10 @@
                     final int tmp2 = jpt;
                     jpt = ipt - n;
                     ipt = tmp2;
-                    throw new PathIsExploredException(); // XXX
+                    //throw new PathIsExploredException(); // XXX
                 }
-                interpolationPoints.setEntry(nfm, ipt, interpolationPoints.getEntry(ipt, ipt));
-                interpolationPoints.setEntry(nfm, jpt, interpolationPoints.getEntry(jpt, jpt));
+                interpolationPoints.setEntry(nfm, ipt-1, interpolationPoints.getEntry(ipt, ipt-1));
+                interpolationPoints.setEntry(nfm, jpt-1, interpolationPoints.getEntry(jpt, jpt-1));


               

> Errors in BOBYQAOptimizer when numberOfInterpolationPoints is greater than 2*dim+1
> ----------------------------------------------------------------------------------
>
>                 Key: MATH-728
>                 URL: https://issues.apache.org/jira/browse/MATH-728
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Mac Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11M3527)
>            Reporter: Bruce A Johnson
>
> I've been having trouble getting BOBYQA to minimize a function (actually a non-linear least squares fit) so as one change I increased the number of interpolation points.  It seems that anything larger than 2*dim+1 causes an error (typically at
> line 1662
>                    interpolationPoints.setEntry(nfm, ipt, interpolationPoints.getEntry(ipt, ipt));
> I'm guessing there is an off by one error in the translation from FORTRAN.  Changing the BOBYQAOptimizerTest as follows (increasing number of interpolation points by one) will cause failures.
> Bruce
> Index: src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java
> ===================================================================
> --- src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java (revision 1221065)
> +++ src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java (working copy)
> @@ -258,7 +258,7 @@
>  //        RealPointValuePair result = optim.optimize(100000, func, goal, startPoint);
>          final double[] lB = boundaries == null ? null : boundaries[0];
>          final double[] uB = boundaries == null ? null : boundaries[1];
> -        BOBYQAOptimizer optim = new BOBYQAOptimizer(2 * dim + 1);
> +        BOBYQAOptimizer optim = new BOBYQAOptimizer(2 * dim + 2);
>          RealPointValuePair result = optim.optimize(maxEvaluations, func, goal, startPoint, lB, uB);
>  //        System.out.println(func.getClass().getName() + " = "
>  //              + optim.getEvaluations() + " f(");

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (MATH-728) Errors in BOBYQAOptimizer when numberOfInterpolationPoints is greater than 2*dim+1

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/MATH-728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13173194#comment-13173194 ]

Gilles commented on MATH-728:
-----------------------------

Thanks for spotting this. Revision 1221253 contains your fix, together with a unit test that exercises the setting of more interpolation points.

               

> Errors in BOBYQAOptimizer when numberOfInterpolationPoints is greater than 2*dim+1
> ----------------------------------------------------------------------------------
>
>                 Key: MATH-728
>                 URL: https://issues.apache.org/jira/browse/MATH-728
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Mac Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11M3527)
>            Reporter: Bruce A Johnson
>
> I've been having trouble getting BOBYQA to minimize a function (actually a non-linear least squares fit) so as one change I increased the number of interpolation points.  It seems that anything larger than 2*dim+1 causes an error (typically at
> line 1662
>                    interpolationPoints.setEntry(nfm, ipt, interpolationPoints.getEntry(ipt, ipt));
> I'm guessing there is an off by one error in the translation from FORTRAN.  Changing the BOBYQAOptimizerTest as follows (increasing number of interpolation points by one) will cause failures.
> Bruce
> Index: src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java
> ===================================================================
> --- src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java (revision 1221065)
> +++ src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java (working copy)
> @@ -258,7 +258,7 @@
>  //        RealPointValuePair result = optim.optimize(100000, func, goal, startPoint);
>          final double[] lB = boundaries == null ? null : boundaries[0];
>          final double[] uB = boundaries == null ? null : boundaries[1];
> -        BOBYQAOptimizer optim = new BOBYQAOptimizer(2 * dim + 1);
> +        BOBYQAOptimizer optim = new BOBYQAOptimizer(2 * dim + 2);
>          RealPointValuePair result = optim.optimize(maxEvaluations, func, goal, startPoint, lB, uB);
>  //        System.out.println(func.getClass().getName() + " = "
>  //              + optim.getEvaluations() + " f(");

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (MATH-728) Errors in BOBYQAOptimizer when numberOfInterpolationPoints is greater than 2*dim+1

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/MATH-728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13173238#comment-13173238 ]

Bruce A Johnson commented on MATH-728:
--------------------------------------

Thanks for checking this in, and it's worth noting that my function now minimizes properly.  It seems that with a large number of interpolation points there was an out of bounds error, but even where that out of bounds error wasn't thrown, the interpolation was set up wrong for the last few points, causing a failure to converge.  Others who have had trouble with convergence would do well to recheck with this fix.
               

> Errors in BOBYQAOptimizer when numberOfInterpolationPoints is greater than 2*dim+1
> ----------------------------------------------------------------------------------
>
>                 Key: MATH-728
>                 URL: https://issues.apache.org/jira/browse/MATH-728
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Mac Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11M3527)
>            Reporter: Bruce A Johnson
>
> I've been having trouble getting BOBYQA to minimize a function (actually a non-linear least squares fit) so as one change I increased the number of interpolation points.  It seems that anything larger than 2*dim+1 causes an error (typically at
> line 1662
>                    interpolationPoints.setEntry(nfm, ipt, interpolationPoints.getEntry(ipt, ipt));
> I'm guessing there is an off by one error in the translation from FORTRAN.  Changing the BOBYQAOptimizerTest as follows (increasing number of interpolation points by one) will cause failures.
> Bruce
> Index: src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java
> ===================================================================
> --- src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java (revision 1221065)
> +++ src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java (working copy)
> @@ -258,7 +258,7 @@
>  //        RealPointValuePair result = optim.optimize(100000, func, goal, startPoint);
>          final double[] lB = boundaries == null ? null : boundaries[0];
>          final double[] uB = boundaries == null ? null : boundaries[1];
> -        BOBYQAOptimizer optim = new BOBYQAOptimizer(2 * dim + 1);
> +        BOBYQAOptimizer optim = new BOBYQAOptimizer(2 * dim + 2);
>          RealPointValuePair result = optim.optimize(maxEvaluations, func, goal, startPoint, lB, uB);
>  //        System.out.println(func.getClass().getName() + " = "
>  //              + optim.getEvaluations() + " f(");

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (MATH-728) Errors in BOBYQAOptimizer when numberOfInterpolationPoints is greater than 2*dim+1

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/MATH-728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13173259#comment-13173259 ]

Gilles commented on MATH-728:
-----------------------------

Anyone who wishes to use the "BOBYQAOptimizer" class should have a look at the MATH-621 issue.
As you have figured out, the code is really not ready yet. Unfortunately, the implementation being not "natural" in Java, it is not easy to separate algorithm complexity from Fortran-driven optimizations (which should be removed).
The problem is all compounded by the fall-through switch-cases which should also be recoded properly.

We are still in the middle of the river: Many things have been improved structure-wise but bugs could have crept in while doing so. Bugs like the one you discovered.
And we don't have a thorough test suite to ensure that every code path works as in the original Fortran.

The code was checked in under the assumption that it would be converted into "natural" Java, so that people can maintain it.
I wonder whether it should not be removed for the upcoming release...

               

> Errors in BOBYQAOptimizer when numberOfInterpolationPoints is greater than 2*dim+1
> ----------------------------------------------------------------------------------
>
>                 Key: MATH-728
>                 URL: https://issues.apache.org/jira/browse/MATH-728
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Mac Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11M3527)
>            Reporter: Bruce A Johnson
>
> I've been having trouble getting BOBYQA to minimize a function (actually a non-linear least squares fit) so as one change I increased the number of interpolation points.  It seems that anything larger than 2*dim+1 causes an error (typically at
> line 1662
>                    interpolationPoints.setEntry(nfm, ipt, interpolationPoints.getEntry(ipt, ipt));
> I'm guessing there is an off by one error in the translation from FORTRAN.  Changing the BOBYQAOptimizerTest as follows (increasing number of interpolation points by one) will cause failures.
> Bruce
> Index: src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java
> ===================================================================
> --- src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java (revision 1221065)
> +++ src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java (working copy)
> @@ -258,7 +258,7 @@
>  //        RealPointValuePair result = optim.optimize(100000, func, goal, startPoint);
>          final double[] lB = boundaries == null ? null : boundaries[0];
>          final double[] uB = boundaries == null ? null : boundaries[1];
> -        BOBYQAOptimizer optim = new BOBYQAOptimizer(2 * dim + 1);
> +        BOBYQAOptimizer optim = new BOBYQAOptimizer(2 * dim + 2);
>          RealPointValuePair result = optim.optimize(maxEvaluations, func, goal, startPoint, lB, uB);
>  //        System.out.println(func.getClass().getName() + " = "
>  //              + optim.getEvaluations() + " f(");

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (MATH-728) Errors in BOBYQAOptimizer when numberOfInterpolationPoints is greater than 2*dim+1

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/MATH-728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13173266#comment-13173266 ]

Bruce A Johnson commented on MATH-728:
--------------------------------------

I, for one, am very happy to see BOBYQA in CM and will continue with "real world" testing.  If I find more issues I'll certainly report them, but so far it's looking very promising with my applications.
               

> Errors in BOBYQAOptimizer when numberOfInterpolationPoints is greater than 2*dim+1
> ----------------------------------------------------------------------------------
>
>                 Key: MATH-728
>                 URL: https://issues.apache.org/jira/browse/MATH-728
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Mac Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11M3527)
>            Reporter: Bruce A Johnson
>
> I've been having trouble getting BOBYQA to minimize a function (actually a non-linear least squares fit) so as one change I increased the number of interpolation points.  It seems that anything larger than 2*dim+1 causes an error (typically at
> line 1662
>                    interpolationPoints.setEntry(nfm, ipt, interpolationPoints.getEntry(ipt, ipt));
> I'm guessing there is an off by one error in the translation from FORTRAN.  Changing the BOBYQAOptimizerTest as follows (increasing number of interpolation points by one) will cause failures.
> Bruce
> Index: src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java
> ===================================================================
> --- src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java (revision 1221065)
> +++ src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java (working copy)
> @@ -258,7 +258,7 @@
>  //        RealPointValuePair result = optim.optimize(100000, func, goal, startPoint);
>          final double[] lB = boundaries == null ? null : boundaries[0];
>          final double[] uB = boundaries == null ? null : boundaries[1];
> -        BOBYQAOptimizer optim = new BOBYQAOptimizer(2 * dim + 1);
> +        BOBYQAOptimizer optim = new BOBYQAOptimizer(2 * dim + 2);
>          RealPointValuePair result = optim.optimize(maxEvaluations, func, goal, startPoint, lB, uB);
>  //        System.out.println(func.getClass().getName() + " = "
>  //              + optim.getEvaluations() + " f(");

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (MATH-728) Errors in BOBYQAOptimizer when numberOfInterpolationPoints is greater than 2*dim+1

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/MATH-728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13175424#comment-13175424 ]

Gilles commented on MATH-728:
-----------------------------

It would be very useful if you could provide unit tests that cover the still unexplored code paths (cf. lines containing "throw new PathIsExploredException();").
Thanks in advance for your contributions.

               

> Errors in BOBYQAOptimizer when numberOfInterpolationPoints is greater than 2*dim+1
> ----------------------------------------------------------------------------------
>
>                 Key: MATH-728
>                 URL: https://issues.apache.org/jira/browse/MATH-728
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Mac Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11M3527)
>            Reporter: Bruce A Johnson
>
> I've been having trouble getting BOBYQA to minimize a function (actually a non-linear least squares fit) so as one change I increased the number of interpolation points.  It seems that anything larger than 2*dim+1 causes an error (typically at
> line 1662
>                    interpolationPoints.setEntry(nfm, ipt, interpolationPoints.getEntry(ipt, ipt));
> I'm guessing there is an off by one error in the translation from FORTRAN.  Changing the BOBYQAOptimizerTest as follows (increasing number of interpolation points by one) will cause failures.
> Bruce
> Index: src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java
> ===================================================================
> --- src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java (revision 1221065)
> +++ src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java (working copy)
> @@ -258,7 +258,7 @@
>  //        RealPointValuePair result = optim.optimize(100000, func, goal, startPoint);
>          final double[] lB = boundaries == null ? null : boundaries[0];
>          final double[] uB = boundaries == null ? null : boundaries[1];
> -        BOBYQAOptimizer optim = new BOBYQAOptimizer(2 * dim + 1);
> +        BOBYQAOptimizer optim = new BOBYQAOptimizer(2 * dim + 2);
>          RealPointValuePair result = optim.optimize(maxEvaluations, func, goal, startPoint, lB, uB);
>  //        System.out.println(func.getClass().getName() + " = "
>  //              + optim.getEvaluations() + " f(");

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (MATH-728) Errors in BOBYQAOptimizer when numberOfInterpolationPoints is greater than 2*dim+1

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/MATH-728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13203505#comment-13203505 ]

Gilles commented on MATH-728:
-----------------------------

Hi Bruce.

Would you be interested in testing your code with a large number of "additional" interpolation points?
I'm referring to the unit test "testConstrainedRosenWithMoreInterpolationPoints" in "BOBYQAOptimizerTest", at lines 236-256. It would be nice to know whether the failures, for some values of the number of points, reveal yet other bugs. (Or whether they are expected; in which case, the reason would be a welcome addition to the documentation...)

               

> Errors in BOBYQAOptimizer when numberOfInterpolationPoints is greater than 2*dim+1
> ----------------------------------------------------------------------------------
>
>                 Key: MATH-728
>                 URL: https://issues.apache.org/jira/browse/MATH-728
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Mac Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11M3527)
>            Reporter: Bruce A Johnson
>
> I've been having trouble getting BOBYQA to minimize a function (actually a non-linear least squares fit) so as one change I increased the number of interpolation points.  It seems that anything larger than 2*dim+1 causes an error (typically at
> line 1662
>                    interpolationPoints.setEntry(nfm, ipt, interpolationPoints.getEntry(ipt, ipt));
> I'm guessing there is an off by one error in the translation from FORTRAN.  Changing the BOBYQAOptimizerTest as follows (increasing number of interpolation points by one) will cause failures.
> Bruce
> Index: src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java
> ===================================================================
> --- src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java (revision 1221065)
> +++ src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java (working copy)
> @@ -258,7 +258,7 @@
>  //        RealPointValuePair result = optim.optimize(100000, func, goal, startPoint);
>          final double[] lB = boundaries == null ? null : boundaries[0];
>          final double[] uB = boundaries == null ? null : boundaries[1];
> -        BOBYQAOptimizer optim = new BOBYQAOptimizer(2 * dim + 1);
> +        BOBYQAOptimizer optim = new BOBYQAOptimizer(2 * dim + 2);
>          RealPointValuePair result = optim.optimize(maxEvaluations, func, goal, startPoint, lB, uB);
>  //        System.out.println(func.getClass().getName() + " = "
>  //              + optim.getEvaluations() + " f(");

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (MATH-728) Errors in BOBYQAOptimizer when numberOfInterpolationPoints is greater than 2*dim+1

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/MATH-728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13203540#comment-13203540 ]

Bruce A Johnson commented on MATH-728:
--------------------------------------

Hi Giles,

I'll try to do so over the next couple days.

cheers,

Bruce
               

> Errors in BOBYQAOptimizer when numberOfInterpolationPoints is greater than 2*dim+1
> ----------------------------------------------------------------------------------
>
>                 Key: MATH-728
>                 URL: https://issues.apache.org/jira/browse/MATH-728
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Mac Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11M3527)
>            Reporter: Bruce A Johnson
>
> I've been having trouble getting BOBYQA to minimize a function (actually a non-linear least squares fit) so as one change I increased the number of interpolation points.  It seems that anything larger than 2*dim+1 causes an error (typically at
> line 1662
>                    interpolationPoints.setEntry(nfm, ipt, interpolationPoints.getEntry(ipt, ipt));
> I'm guessing there is an off by one error in the translation from FORTRAN.  Changing the BOBYQAOptimizerTest as follows (increasing number of interpolation points by one) will cause failures.
> Bruce
> Index: src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java
> ===================================================================
> --- src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java (revision 1221065)
> +++ src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java (working copy)
> @@ -258,7 +258,7 @@
>  //        RealPointValuePair result = optim.optimize(100000, func, goal, startPoint);
>          final double[] lB = boundaries == null ? null : boundaries[0];
>          final double[] uB = boundaries == null ? null : boundaries[1];
> -        BOBYQAOptimizer optim = new BOBYQAOptimizer(2 * dim + 1);
> +        BOBYQAOptimizer optim = new BOBYQAOptimizer(2 * dim + 2);
>          RealPointValuePair result = optim.optimize(maxEvaluations, func, goal, startPoint, lB, uB);
>  //        System.out.println(func.getClass().getName() + " = "
>  //              + optim.getEvaluations() + " f(");

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (MATH-728) Errors in BOBYQAOptimizer when numberOfInterpolationPoints is greater than 2*dim+1

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/MATH-728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13206281#comment-13206281 ]

Bruce A Johnson commented on MATH-728:
--------------------------------------

I've been playing with BOBYQA (downloaded from svn repository today, and commenting out the PathNotExplored exceptions).  A couple observations.
1) I can't make it fail with large number of interpolation points (as long as you stay under the (2n+1)*(2n+2)/2 recommended max. So this issue is resolved.
2) With large number of interpolation points the algorithm is significantly slower.  I'm minimizing a function  with a 169 parameters.  The function evaluation takes ~50 msec.  With n+2 interpolation points, the additional time for each step is about 10 msec.  With 2*n+1 points, the additional time is about 50 msec, and with about 6*n, the additional time is 250 msec.  So with larger nInterpolation points a lot of time is spent in the algorithm, besides evaluating the function.   At some point I'll try to do some profiling of the code.
3) It makes a big difference to normalize the parameters as the initial search region is dependent on the point with the smallest boundary difference.  So it seems one shouldn't directly fit the "natural" parameters but normalized values.
               

> Errors in BOBYQAOptimizer when numberOfInterpolationPoints is greater than 2*dim+1
> ----------------------------------------------------------------------------------
>
>                 Key: MATH-728
>                 URL: https://issues.apache.org/jira/browse/MATH-728
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Mac Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11M3527)
>            Reporter: Bruce A Johnson
>
> I've been having trouble getting BOBYQA to minimize a function (actually a non-linear least squares fit) so as one change I increased the number of interpolation points.  It seems that anything larger than 2*dim+1 causes an error (typically at
> line 1662
>                    interpolationPoints.setEntry(nfm, ipt, interpolationPoints.getEntry(ipt, ipt));
> I'm guessing there is an off by one error in the translation from FORTRAN.  Changing the BOBYQAOptimizerTest as follows (increasing number of interpolation points by one) will cause failures.
> Bruce
> Index: src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java
> ===================================================================
> --- src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java (revision 1221065)
> +++ src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java (working copy)
> @@ -258,7 +258,7 @@
>  //        RealPointValuePair result = optim.optimize(100000, func, goal, startPoint);
>          final double[] lB = boundaries == null ? null : boundaries[0];
>          final double[] uB = boundaries == null ? null : boundaries[1];
> -        BOBYQAOptimizer optim = new BOBYQAOptimizer(2 * dim + 1);
> +        BOBYQAOptimizer optim = new BOBYQAOptimizer(2 * dim + 2);
>          RealPointValuePair result = optim.optimize(maxEvaluations, func, goal, startPoint, lB, uB);
>  //        System.out.println(func.getClass().getName() + " = "
>  //              + optim.getEvaluations() + " f(");

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Resolved] (MATH-728) Errors in BOBYQAOptimizer when numberOfInterpolationPoints is greater than 2*dim+1

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

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

Gilles resolved MATH-728.
-------------------------

       Resolution: Fixed
    Fix Version/s: 3.0

Although the bug that triggered this issue is fixed, failures of the unit test are still miss an explanation...

The poor performance is to be expected given the current state of the code (e.g. many matrix calculations are done explicitly, with getters and setters, instead of calling methods of the matrix objects).

               

> Errors in BOBYQAOptimizer when numberOfInterpolationPoints is greater than 2*dim+1
> ----------------------------------------------------------------------------------
>
>                 Key: MATH-728
>                 URL: https://issues.apache.org/jira/browse/MATH-728
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Mac Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11M3527)
>            Reporter: Bruce A Johnson
>             Fix For: 3.0
>
>
> I've been having trouble getting BOBYQA to minimize a function (actually a non-linear least squares fit) so as one change I increased the number of interpolation points.  It seems that anything larger than 2*dim+1 causes an error (typically at
> line 1662
>                    interpolationPoints.setEntry(nfm, ipt, interpolationPoints.getEntry(ipt, ipt));
> I'm guessing there is an off by one error in the translation from FORTRAN.  Changing the BOBYQAOptimizerTest as follows (increasing number of interpolation points by one) will cause failures.
> Bruce
> Index: src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java
> ===================================================================
> --- src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java (revision 1221065)
> +++ src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java (working copy)
> @@ -258,7 +258,7 @@
>  //        RealPointValuePair result = optim.optimize(100000, func, goal, startPoint);
>          final double[] lB = boundaries == null ? null : boundaries[0];
>          final double[] uB = boundaries == null ? null : boundaries[1];
> -        BOBYQAOptimizer optim = new BOBYQAOptimizer(2 * dim + 1);
> +        BOBYQAOptimizer optim = new BOBYQAOptimizer(2 * dim + 2);
>          RealPointValuePair result = optim.optimize(maxEvaluations, func, goal, startPoint, lB, uB);
>  //        System.out.println(func.getClass().getName() + " = "
>  //              + optim.getEvaluations() + " f(");

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Issue Comment Edited] (MATH-728) Errors in BOBYQAOptimizer when numberOfInterpolationPoints is greater than 2*dim+1

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/MATH-728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13206296#comment-13206296 ]

Gilles edited comment on MATH-728 at 2/11/12 11:47 PM:
-------------------------------------------------------

Although the bug that triggered this issue is fixed, failures of the unit test still miss an explanation...

The poor performance is to be expected given the current state of the code (e.g. many matrix calculations are done explicitly, with getters and setters, instead of calling methods of the matrix objects).

               
      was (Author: erans):
    Although the bug that triggered this issue is fixed, failures of the unit test are still miss an explanation...

The poor performance is to be expected given the current state of the code (e.g. many matrix calculations are done explicitly, with getters and setters, instead of calling methods of the matrix objects).

                 

> Errors in BOBYQAOptimizer when numberOfInterpolationPoints is greater than 2*dim+1
> ----------------------------------------------------------------------------------
>
>                 Key: MATH-728
>                 URL: https://issues.apache.org/jira/browse/MATH-728
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Mac Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11M3527)
>            Reporter: Bruce A Johnson
>             Fix For: 3.0
>
>
> I've been having trouble getting BOBYQA to minimize a function (actually a non-linear least squares fit) so as one change I increased the number of interpolation points.  It seems that anything larger than 2*dim+1 causes an error (typically at
> line 1662
>                    interpolationPoints.setEntry(nfm, ipt, interpolationPoints.getEntry(ipt, ipt));
> I'm guessing there is an off by one error in the translation from FORTRAN.  Changing the BOBYQAOptimizerTest as follows (increasing number of interpolation points by one) will cause failures.
> Bruce
> Index: src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java
> ===================================================================
> --- src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java (revision 1221065)
> +++ src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java (working copy)
> @@ -258,7 +258,7 @@
>  //        RealPointValuePair result = optim.optimize(100000, func, goal, startPoint);
>          final double[] lB = boundaries == null ? null : boundaries[0];
>          final double[] uB = boundaries == null ? null : boundaries[1];
> -        BOBYQAOptimizer optim = new BOBYQAOptimizer(2 * dim + 1);
> +        BOBYQAOptimizer optim = new BOBYQAOptimizer(2 * dim + 2);
>          RealPointValuePair result = optim.optimize(maxEvaluations, func, goal, startPoint, lB, uB);
>  //        System.out.println(func.getClass().getName() + " = "
>  //              + optim.getEvaluations() + " f(");

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira