scipy/scipy — pull request #217 by pv (2012-05-19 12:28:55+00:00)
Title: Tweaks to minimize() behavior, for discussion

Here's a bunch of tweaks to the minimize() behavior:

- Raise a warning when encountering options unknown to the solver.
- Add a `tol` parameter to minimize*() functions, for easy tolerance specification
- In solvers, rename `maxfev` to `maxiter` if the solver does not have a `maxiter` parameter. This makes the claim in `minimize()` that `maxiter` is a common parameter for all solvers true. `Iterations` are in any case fuzzily defined, so we may as well make this change...
- Rename `pgtol` to `gtol`
- In Cobyla, rename `rhoend` to `tol`. It cannot probably be called `xtol` although it is an x-tolerance, as it seems to be an absolute tolerance rather than a relative one.

Internal reorganization:

- Use Python parameter unpacking for extracting parameters from the options dict. The internal _minimize_* routines now specify any extra options they accept in their argument list, as usual. This is probably slightly cleaner and faster (didn't benchmark) way to unpack the parameters. It also allows easy detection of unknown parameters, without needing to modify the input dict (which makes the `.pop()` approach require an copy of the dictionary).

And some bugfixes:

- `ftol` in brent and golden is actually `xtol`
- There were a couple of unknown options passed down to the solvers, which was caught by the added warnings. I think checking the `options` dict for unknown keys is a must --- IIRC, this is something that I disliked also in Matlab's optimization interface.