[Scipy-tickets] [SciPy] #791: optimize.broyden* termination conditions
SciPy
scipy-tickets@scipy....
Wed Nov 12 18:18:09 CST 2008
#791: optimize.broyden* termination conditions
--------------------+-------------------------------------------------------
Reporter: pv | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone: 0.7.0
Component: Other | Version:
Severity: major | Keywords:
--------------------+-------------------------------------------------------
Scipy r5056:
The optimize.broyden1/2/3 methods currently offer only the number of
iterations as a termination condition.
This is, however, often not very useful. Users of optimization/root-
finding algorithms typically except the algorithm to terminate when
certain tolerances (on residuals or estimated accuracy) are met, or when a
maximum for number of iterations is reached.
Also, if Broyden methods are run to extremely close to the solution, the
step length decreases, which eventually causes problems (in the Jacobian
update, I believe). Consider a simple problem for which the default value
of 'iter' is too large:
{{{
import scipy.optimize as so
import traceback
def f(x)
return x
print "fsolve"
print so.fsolve(f, [10])
try:
print "broyden1"
print so.broyden1(f, [10])[0]
except:
traceback.print_exc()
try:
print "broyden2"
print so.broyden2(f, [10])[0]
except:
traceback.print_exc()
try:
print "broyden3"
print so.broyden3(f, [10])[0]
except:
traceback.print_exc()
}}}
which yields
{{{
fsolve
0.0
broyden1
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
File "scipy/optimize/nonlin.py", line 353, in broyden1
File "scipy/optimize/nonlin.py", line 96, in solve
File "numpy/core/defmatrix.py", line 515, in getI
return asmatrix(func(self))
File "scipy/linalg/basic.py", line 342, in inv
File "numpy/lib/function_base.py", line 724, in asarray_chkfinite
raise ValueError, "array must not contain infs or NaNs"
ValueError: array must not contain infs or NaNs
broyden2
nan
broyden3
nan
}}}
The number of iterations required is usually not known a priori, and
guessing it by calling broyden* is cumbersome.
--
Ticket URL: <http://scipy.org/scipy/scipy/ticket/791>
SciPy <http://www.scipy.org/>
SciPy is open-source software for mathematics, science, and engineering.
More information about the Scipy-tickets
mailing list