pybop.optimisers.scipy_optimisers#

Module Contents#

Classes#

SciPyDifferentialEvolution

Adapts SciPy's differential_evolution function for global optimization.

SciPyMinimize

Adapts SciPy's minimize function for use as an optimization strategy.

class pybop.optimisers.scipy_optimisers.SciPyDifferentialEvolution(bounds=None, strategy='best1bin', maxiter=1000, popsize=15)[source]#

Bases: pybop.optimisers.base_optimiser.BaseOptimiser

Adapts 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, bounds=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.

  • bounds (sequence or Bounds) – Bounds for the variables, required for differential evolution.

Returns:

A tuple (x, final_cost) containing the optimized parameters and the value of cost_function at the optimum.

Return type:

tuple

name()[source]#

Provides the name of the optimization strategy.

Returns:

The name ‘SciPyDifferentialEvolution’.

Return type:

str

needs_sensitivities()[source]#

Determines if the optimization algorithm requires gradient information.

Returns:

False, indicating that gradient information is not required for differential evolution.

Return type:

bool

class pybop.optimisers.scipy_optimisers.SciPyMinimize(method=None, bounds=None, maxiter=None)[source]#

Bases: pybop.optimisers.base_optimiser.BaseOptimiser

Adapts 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 ‘COBYLA’.

  • 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, bounds)[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.

  • bounds (sequence or Bounds) – Bounds for the variables.

Returns:

A tuple (x, final_cost) containing the optimized parameters and the value of cost_function at the optimum.

Return type:

tuple

name()[source]#

Provides the name of the optimization strategy.

Returns:

The name ‘SciPyMinimize’.

Return type:

str

needs_sensitivities()[source]#

Determines if the optimization algorithm requires gradient information.

Returns:

False, indicating that gradient information is not required.

Return type:

bool