Optimizers.optimizer module¶
Description¶
This module defines the ParaMol.Optimizers.optimizer.Optimizer class, which is the main Optimizer class.
-
class
ParaMol.Optimizers.optimizer.Optimizer(method, settings, create_optimizer=True)¶ Bases:
objectParaMol wrapper of the optimization methods.
Notes
This class is a wrapper for the currently implemented optimization methods, viz. “scipy”, “monte_carlo”, “simulated_annealing” and “gradient_descent”. It creates the optimizer when called if create_optimizer is set to True.
- Parameters
settings (dict) – Dictionary containing the optimizer settings.
method (str) – Name of the optimizer to be created. Available optimizers are “monte_carlo”, “scipy”, “simulated_annealing”, “gradient_descent” and “bayesian” (still being developed, not recommended).
create_optimizer (bool) – Flag that determines whether or not an instance of the available optimizers is created.
- Variables
method_name (str) – Name of the created optimizer.
settings (dict) – Dictionary containing the optimizer settings.
-
_create_optimizer(method, settings)¶ Method that creates an instance of a chosen optimizer.
- Parameters
settings (dict) – Dictionary containing global ParaMol settings.
method (str) – Name of the optimizer to be created. Available optimizers are “monte_carlo”, “scipy”, “simulated_annealing”, “gradient_descent” and “bayesian” (still being developed, not recommended).
- Returns
optimizer (any optimizer defined in the subpackage
ParaMol.Optimizers) – Instance of the created optimizer.
-
optimizers= ['scipy', 'monte_carlo', 'simulated_annealing', 'gradient_descent', 'bayesian']¶
-
run_optimization(f, parameters_values, constraints=None)¶ Method to run the parameter’s optimization per se.
- Parameters
f (callable) – Reference to the objective function method.
parameters_values (list) – 1D list containing the values of the parameters that will be optimized.
constraints (list of constraints) – Constraints to be applied during the optimization.
- Returns
pameters_values (list) – List containing the optimized parameter values