pybop.optimisers.base_optimiser#

Classes#

BaseOptimiser

A base class for defining optimisation methods.

Module Contents#

class pybop.optimisers.base_optimiser.BaseOptimiser(bounds=None)[source]#

A base class for defining optimisation methods.

This class serves as a template for creating optimisers. It provides a basic structure for an optimisation algorithm, including the initial setup and a method stub for performing the optimisation process. Child classes should override the optimise and _runoptimise methods with specific algorithms.

_runoptimise(cost_function, x0=None)[source]#

Contains the logic for the optimisation algorithm.

This method should be implemented by child classes to perform the actual optimisation.

Parameters:
  • cost_function (callable) – The cost function to be minimised by the optimiser.

  • x0 (ndarray, optional) – Initial guess for the parameters. Default is None.

Returns:

  • This method is expected to return the result of the optimisation, the format of which

  • will be determined by the child class implementation.

name()[source]#

Returns the name of the optimiser.

Returns:

The name of the optimiser, which is “BaseOptimiser” for this base class.

Return type:

str

optimise(cost_function, x0=None, maxiter=None)[source]#

Initiates the optimisation process.

This method should be overridden by child classes with the specific optimisation algorithm.

Parameters:
  • cost_function (callable) – The cost function to be minimised by the optimiser.

  • x0 (ndarray, optional) – Initial guess for the parameters. Default is None.

  • maxiter (int, optional) – Maximum number of iterations to perform. Default is None.

Return type:

The result of the optimisation process. The specific type of this result will depend on the child implementation.