pybop.optimisers.base_pints_optimiser#
Classes#
A base class for defining optimisation methods from the PINTS library. |
|
A class to hold PINTS options for the optimisation process. |
Module Contents#
- class pybop.optimisers.base_pints_optimiser.BasePintsOptimiser(problem: pybop.problems.problem.Problem, pints_optimiser: pints.Optimiser, options: PintsOptions | None = None)[source]#
Bases:
pybop.optimisers.base_optimiser.BaseOptimiserA base class for defining optimisation methods from the PINTS library.
- Parameters:
problem (pybop.Problem) – The problem to minimise.
pints_optimiser (pints.Optimiser) – The PINTS optimiser class to be used.
options (PintsOptions, optional) – Options for the PINTS optimiser. If None, default options are used.
- _run() pybop.OptimisationResult[source]#
Internal method to run the optimisation using a PINTS optimiser.
- Returns:
result – The result of the optimisation including the optimised parameter values and cost.
- Return type:
pybop.OptimisationResult
See also
This
- static default_options() PintsOptions[source]#
Returns the default options for the PINTS optimiser.
- f_guessed_tracking()[source]#
Check if f_guessed instead of f_best is being tracked. Credit: PINTS
- Returns:
True if f_guessed is being tracked, False otherwise.
- Return type:
bool
- set_f_guessed_tracking(use_f_guessed=False)[source]#
Set the method used to track the optimiser progress. Credit: PINTS
- Parameters:
use_f_guessed (bool, optional) – If True, track f_guessed; otherwise, track f_best (default: False).
- set_max_evaluations(evaluations=None)[source]#
Set a maximum number of evaluations stopping criterion. Credit: PINTS
- Parameters:
evaluations (int, optional) – The maximum number of evaluations after which to stop the optimisation (default: None).
- set_max_iterations(iterations: str | int | None = 'default')[source]#
Set the maximum number of iterations as a stopping criterion. Credit: PINTS
- Parameters:
iterations (int, optional) – The maximum number of iterations to run. Set to None to remove this stopping criterion.
- set_max_unchanged_iterations(iterations=15, absolute_tolerance=1e-05, relative_tolerance=0.01)[source]#
Set the maximum number of iterations without significant change as a stopping criterion. Credit: PINTS
- Parameters:
iterations (int, optional) – The maximum number of unchanged iterations to run (default: 15). Set to None to remove this stopping criterion.
absolute_tolerance (float, optional) – The minimum significant change (absolute tolerance) in the objective function value that resets the unchanged iteration counter (default: 1e-5).
relative_tolerance (float, optional) – The minimum significant proportional change (relative tolerance) in the objective function value that resets the unchanged iteration counter (default: 1e-2).
- set_min_iterations(iterations=2)[source]#
Set the minimum number of iterations as a stopping criterion.
- Parameters:
iterations (int, optional) – The minimum number of iterations to run (default: 2). Set to None to remove this stopping criterion.
- set_population_size(population_size=None)[source]#
Set the population size for population-based optimisers, if specified.
- set_threshold(threshold=None)[source]#
Adds a stopping criterion, allowing the routine to halt once the objective function goes below a set
threshold.This criterion is disabled by default, but can be enabled by calling this method with a valid
threshold. To disable it, useset_threshold(None). Credit: PINTS- Parameters:
threshold (float, optional) – The threshold below which the objective function value is considered optimal (default: None).
- class pybop.optimisers.base_pints_optimiser.PintsOptions[source]#
Bases:
pybop.optimisers.base_optimiser.OptimiserOptionsA class to hold PINTS options for the optimisation process.
- max_iterations[source]#
Maximum number of iterations for the optimisation (default: None).
- Type:
int
- sigma[source]#
Standard deviation or step-size parameter for the optimiser (default: 5e-2).
- Type:
float | np.ndarray | list
- max_unchanged_iterations[source]#
Maximum iterations without improvement before stopping (default: 15).
- Type:
int