Skip to content

Commit

Permalink
BUG fixed printing of convergence message in minimize_scalar in scipy…
Browse files Browse the repository at this point in the history
…/optimize (scipy#8273)

followed suggestion by dlax in scipy#8273 and converted disp from bool to int
also corrected docstring of _minimize_scalar_bounded (disp is int instead of bool)
  • Loading branch information
chrisb83 authored and dlax committed Jan 11, 2018
1 parent 4b6f71a commit a03fd3f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions scipy/optimize/_minimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,11 @@ def minimize_scalar(fun, bracket=None, bounds=None, args=(),
if bounds is None:
raise ValueError('The `bounds` parameter is mandatory for '
'method `bounded`.')
# replace boolean "disp" option, if specified, by an integer value, as
# expected by _minimize_scalar_bounded()
disp = options.get('disp')
if isinstance(disp, bool):
options['disp'] = 2 * int(disp)
return _minimize_scalar_bounded(fun, bounds, args, **options)
elif meth == 'golden':
return _minimize_scalar_golden(fun, bracket, args, **options)
Expand Down
8 changes: 6 additions & 2 deletions scipy/optimize/optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -1728,8 +1728,12 @@ def _minimize_scalar_bounded(func, bounds, args=(),
-------
maxiter : int
Maximum number of iterations to perform.
disp : bool
Set to True to print convergence messages.
disp: int, optional
If non-zero, print messages.
0 : no message printing.
1 : non-convergence notification messages only.
2 : print a message on convergence too.
3 : print iteration results.
xatol : float
Absolute error in solution `xopt` acceptable for convergence.
Expand Down

0 comments on commit a03fd3f

Please sign in to comment.