Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 32699 invoked from network); 12 Aug 2009 15:06:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 12 Aug 2009 15:06:34 -0000 Received: (qmail 79218 invoked by uid 500); 12 Aug 2009 15:06:39 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 79124 invoked by uid 500); 12 Aug 2009 15:06:39 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 79114 invoked by uid 99); 12 Aug 2009 15:06:39 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Aug 2009 15:06:39 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Aug 2009 15:06:36 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id C005A234C004 for ; Wed, 12 Aug 2009 08:06:14 -0700 (PDT) Message-ID: <1409356097.1250089574772.JavaMail.jira@brutus> Date: Wed, 12 Aug 2009 08:06:14 -0700 (PDT) From: "Michael Nischt (JIRA)" To: issues@commons.apache.org Subject: [jira] Updated: (MATH-283) MultiDirectional optimzation loops forver if started at the correct solution In-Reply-To: <28815735.1250088734790.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/MATH-283?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Michael Nischt updated MATH-283: -------------------------------- Description: MultiDirectional.iterateSimplex loops forever if the starting point is the correct solution. see the attached test case (testMultiDirectionalCorrectStart) as an example. was: MultiDirectional.iterateSimplex loops forever if the starting point is the correct solution. see the following test case (testMultiDirectionalCorrectStart) as an example {quote} public class MultiDirectionalCorrectStartTest { @Test public void testMultiDirectionalIncorrectStart() throws FunctionEvaluationException, OptimizationException { // works fine try { testMultiDirectionalWithStart(0.1, 0.1); } catch(Exception e) { fail(e.getMessage()); } } @Test public void testMultiDirectionalCorrectStart() throws FunctionEvaluationException, OptimizationException { // fails because MultiDirectional.iterateSimplex is looping forever // the while(true) should be replaced with a convergence check try { testMultiDirectionalWithStart(0.0, 0.0); } catch(Exception e) { fail(e.getMessage()); } } private void testMultiDirectionalWithStart(double xStart, double yStart) throws FunctionEvaluationException, OptimizationException { MultiDirectional multiDirectional = new MultiDirectional(); multiDirectional.setMaxIterations(100); multiDirectional.setMaxEvaluations(1000); final Gaussian2D function = new Gaussian2D(); RealPointValuePair estimate = multiDirectional.optimize(function, GoalType.MAXIMIZE, new double[] {xStart, yStart} ); final double EPSILON = 1e-5; final double expectedMaximum = function.getMaximum(); final double actualMaximum = estimate.getValue(); assertEquals(expectedMaximum, actualMaximum, EPSILON); final double[] expectedPosition = function.getMaximumPosition(); final double[] actualPosition = estimate.getPoint(); assertEquals(expectedPosition[0], actualPosition[0], EPSILON ); assertEquals(expectedPosition[1], actualPosition[1], EPSILON ); } static class Gaussian2D implements MultivariateRealFunction { private static final double[] maximumPosition = { 0, 0 }; private final double std = 1; public double getMaximum() { return value(maximumPosition); } public double[] getMaximumPosition() { return maximumPosition.clone(); } public double value(double[] point) { final double x = point[0], y = point[1]; return 1/(2*Math.PI*std*std)*Math.exp(-(x*x + y*y) / (2*std*std)); } } } {quote} > MultiDirectional optimzation loops forver if started at the correct solution > ---------------------------------------------------------------------------- > > Key: MATH-283 > URL: https://issues.apache.org/jira/browse/MATH-283 > Project: Commons Math > Issue Type: Bug > Affects Versions: 2.0 > Environment: none specific for the issue (it's a programming bug) > Reporter: Michael Nischt > Priority: Blocker > Attachments: MultiDirectionalCorrectStartTest.java > > Original Estimate: 24h > Remaining Estimate: 24h > > MultiDirectional.iterateSimplex loops forever if the starting point is the correct solution. > see the attached test case (testMultiDirectionalCorrectStart) as an example. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.