[SciPy-Dev] minimize(): being strict on options

Pauli Virtanen pav at iki.fi
Sat May 19 05:08:45 EDT 2012


Hi,

Currently, the minimize() solvers silently accept unknown (= mistyped or
inapplicable) options. It might be useful to change this so that it
raises an error if unknown options are passed to a solver.

Alternatively, it could raise a warning instead --- when trying out
different solvers an error could be a PITA.

Code changes:

    tol = options.get('ftol', 1.48e-8)
    maxiter = options.get('maxiter', 500)

change to

    tol = options.pop('ftol', 1.48e-8)
    maxiter = options.pop('maxiter', 500)
    if options:
        warnings.warn("Unknown solver options: %r"
                        % sorted(options.keys()),
                      scipy.optimize.OptimizationWarning)

and

    class OptimizationWarning(UserWarning):
        pass

-- 
Pauli Virtanen




More information about the SciPy-Dev mailing list