[Scipy-svn] r6680 - in trunk/scipy/optimize: . tests

scipy-svn@scip... scipy-svn@scip...
Sat Sep 4 18:56:49 CDT 2010


Author: ptvirtan
Date: 2010-09-04 18:56:49 -0500 (Sat, 04 Sep 2010)
New Revision: 6680

Modified:
   trunk/scipy/optimize/linesearch.py
   trunk/scipy/optimize/tests/test_linesearch.py
Log:
BUG: optimize: bail out in scalar_search_wolfe1 when MINPACK reports it cannot find a suitable step size (fixes #1012)

Modified: trunk/scipy/optimize/linesearch.py
===================================================================
--- trunk/scipy/optimize/linesearch.py	2010-09-04 23:33:08 UTC (rev 6679)
+++ trunk/scipy/optimize/linesearch.py	2010-09-04 23:56:49 UTC (rev 6680)
@@ -151,7 +151,7 @@
         else:
             break
 
-    if task[:5] == 'ERROR':
+    if task[:5] == 'ERROR' or task[:4] == 'WARN':
         stp = None  # failed
 
     return stp, phi1, phi0

Modified: trunk/scipy/optimize/tests/test_linesearch.py
===================================================================
--- trunk/scipy/optimize/tests/test_linesearch.py	2010-09-04 23:33:08 UTC (rev 6679)
+++ trunk/scipy/optimize/tests/test_linesearch.py	2010-09-04 23:56:49 UTC (rev 6680)
@@ -159,6 +159,8 @@
                                                            amax=smax)
             assert_equal(self.fcount, fc+gc)
             assert_equal(ofv, f(x))
+            if s is None:
+                continue
             assert_equal(fv, f(x + s*p))
             assert_equal(gv, fprime(x + s*p))
             if s < smax:



More information about the Scipy-svn mailing list