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.optimisers.base_optimiser.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:
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).
- _pints_optimiser#
- property evaluator: pybop._evaluation.PopulationEvaluator | pybop._evaluation.SequentialEvaluator#
- property iteration#
- property max_iterations#
Returns the maximum number of iterations for the optimisation.
- property name#
Returns the name of the PINTS optimisation strategy.
- property optimiser: pints.Optimiser#
- class pybop.optimisers.base_pints_optimiser.PintsOptions[source]#
Bases:
pybop.optimisers.base_optimiser.OptimiserOptionsA class to hold PINTS options for the optimisation process.
- default_max_iterations#
Default maximum number of iterations (default: 1000).
- Type:
int
- max_iterations#
Maximum number of iterations for the optimisation (default: None).
- Type:
int
- min_iterations#
Minimum number of iterations required (default: 2).
- Type:
int
- max_unchanged_iterations#
Maximum iterations without improvement before stopping (default: 15).
- Type:
int
- use_f_guessed#
Whether to use guessed function values (default: False).
- Type:
bool
- absolute_tolerance#
Absolute tolerance for convergence (default: 1e-5).
- Type:
float
- relative_tolerance#
Relative tolerance for convergence (default: 1e-2).
- Type:
float
- max_evaluations#
Maximum number of function evaluations (default: None).
- Type:
int | None
- threshold#
Threshold value for optimisation stopping criteria (default: None).
- Type:
float | None
- absolute_tolerance: float = 1e-05#
- default_max_iterations = 1000#
- max_evaluations: int | None = None#
- max_iterations: int = 1000#
- max_unchanged_iterations: int = 15#
- min_iterations: int = 2#
- relative_tolerance: float = 0.01#
- threshold: float | None = None#
- use_f_guessed: bool = False#