pybop.optimisers.base_optimiser#

Classes#

BaseOptimiser

A base class for defining optimisation methods.

OptimiserOptions

A base class for optimiser options.

Module Contents#

class pybop.optimisers.base_optimiser.BaseOptimiser(problem: pybop.problems.problem.Problem, options: OptimiserOptions | None = None)[source]#

A base class for defining optimisation methods.

This class serves as a base class 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 _set_up_optimiser and the _run method with a specific algorithm.

Parameters:
abstractmethod _run() pybop._result.OptimisationResult[source]#

Contains the logic for the optimisation algorithm.

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

Raises:

NotImplementedError – If the method has not been implemented by the subclass.

abstractmethod _set_up_optimiser()[source]#

Parse optimiser options and prepare the optimiser.

This method should be implemented by child classes.

Raises:

NotImplementedError – If the method has not been implemented by the subclass.

static default_options() OptimiserOptions[source]#

Returns the default options for the optimiser.

abstractmethod name() str[source]#

Returns the name of the optimiser, to be overwritten by child classes.

Returns:

The name of the optimiser

Return type:

str

run() pybop._result.OptimisationResult[source]#

Run the optimisation and return the optimised parameters and final cost.

Returns:

results – The pybop optimisation result class.

Return type:

OptimisationResult

_logger = None[source]#
_multistart = 1[source]#
_needs_sensitivities = None[source]#
_options[source]#
_problem[source]#
default_max_iterations = 1000[source]#
property logger: pybop._logging.Logger | None[source]#
property options: OptimiserOptions[source]#

Returns the options for the optimiser.

property problem: pybop.problems.problem.Problem[source]#

Returns the optimisation problem object.

verbose = False[source]#
verbose_print_rate = 50[source]#
class pybop.optimisers.base_optimiser.OptimiserOptions[source]#

A base class for optimiser options.

multistart[source]#

Number of times to multistart the optimiser.

Type:

int

verbose[source]#

The verbosity level.

Type:

bool

verbose_print_rate[source]#

The distance between iterations to print verbose output.

Type:

int

validate()[source]#

Validate the options.

Raises:

ValueError – If the options are invalid.

multistart: int = 1[source]#
verbose: bool = False[source]#
verbose_print_rate: int = 50[source]#