pybop.optimisers.scipy_optimisers#
Classes#
Adapts SciPy's differential_evolution function for global optimization. |
|
Adapts SciPy's minimize function for use as an optimization strategy. |
Module Contents#
- class pybop.optimisers.scipy_optimisers.SciPyDifferentialEvolution(bounds=None, strategy='best1bin', maxiter=1000, popsize=15, tol=1e-05)[source]#
Bases:
pybop.optimisers.base_optimiser.BaseOptimiserAdapts SciPy’s differential_evolution function for global optimization.
This class provides a global optimization strategy based on differential evolution, useful for problems involving continuous parameters and potentially multiple local minima.
- Parameters:
bounds (sequence or
Bounds) – Bounds for variables. Must be provided as it is essential for differential evolution.strategy (str, optional) – The differential evolution strategy to use. Defaults to ‘best1bin’.
maxiter (int, optional) – Maximum number of iterations to perform. Defaults to 1000.
popsize (int, optional) – The number of individuals in the population. Defaults to 15.
- _runoptimise(cost_function, x0=None)[source]#
Executes the optimization process using SciPy’s differential_evolution function.
- Parameters:
cost_function (callable) – The objective function to minimize.
x0 (array_like, optional) – Ignored parameter, provided for API consistency.
- Returns:
A tuple (x, final_cost) containing the optimized parameters and the value of
cost_functionat the optimum.- Return type:
tuple
- name()[source]#
Provides the name of the optimization strategy.
- Returns:
The name ‘SciPyDifferentialEvolution’.
- Return type:
str
- class pybop.optimisers.scipy_optimisers.SciPyMinimize(method=None, bounds=None, maxiter=None, tol=1e-05)[source]#
Bases:
pybop.optimisers.base_optimiser.BaseOptimiserAdapts SciPy’s minimize function for use as an optimization strategy.
This class provides an interface to various scalar minimization algorithms implemented in SciPy, allowing fine-tuning of the optimization process through method selection and option configuration.
- Parameters:
method (str, optional) – The type of solver to use. If not specified, defaults to ‘Nelder-Mead’. Options: ‘Nelder-Mead’, ‘Powell’, ‘CG’, ‘BFGS’, ‘Newton-CG’, ‘L-BFGS-B’, ‘TNC’, ‘COBYLA’, ‘SLSQP’, ‘trust-constr’, ‘dogleg’, ‘trust-ncg’, ‘trust-exact’, ‘trust-krylov’.
bounds (sequence or
Bounds, optional) – Bounds for variables as supported by the selected method.maxiter (int, optional) – Maximum number of iterations to perform.
- _runoptimise(cost_function, x0)[source]#
Executes the optimization process using SciPy’s minimize function.
- Parameters:
cost_function (callable) – The objective function to minimize.
x0 (array_like) – Initial guess for the parameters.
- Returns:
A tuple (x, final_cost) containing the optimized parameters and the value of cost_function at the optimum.
- Return type:
tuple