Optimizers
The package provides two families of optimization algorithms:
Gradient-based Optimizers
All gradient-based optimizers inherit from _OptimizerBase
and compute numerical gradients via finite differences.
Common Inputs
All gradient-based optimizers share these inputs:
parameters(Dict): optimization parameters, includinginitial_parametersandalgorithm_settingsitmax(Int, default 100): maximum number of iterationsget_best(Bool, default True): whether to return the best result node PKstructure(StructureData, optional): structure for lattice optimization
Common Outputs
optimized_parameters(List): the optimized parameter vectorfinal_value(Float): the final objective function valuehistory(List): iteration historyresult_node_pk(Int, optional): PK of the best AiiDA node
Convergence and Robustness
All gradient-based optimizers include:
Step clamping: limits step size to
max_step(default 0.1) to prevent instabilityRollback on worse objective: reverts parameters if the objective increases
Learning rate decay: reduces the step rate when stuck
Random jump escape: adds random perturbation when stuck for
allowed_stuckconsecutive iterations
Adam
Adaptive moment estimation optimizer.
Algorithm settings (inside algorithm_settings):
Parameter |
Type |
Default |
|---|---|---|
|
float |
5e-2 |
|
float |
0.5 |
|
float |
0.999 |
|
float |
1e-3 |
|
float |
1e-7 |
|
float |
1e-6 |
RMSprop
Root mean square propagation optimizer.
Algorithm settings:
Parameter |
Type |
Default |
|---|---|---|
|
float |
1e-3 |
|
float |
0.9 |
|
float |
1e-3 |
|
float |
1e-7 |
|
float |
1e-6 |
Conjugate Gradient (Polak-Ribiere)
Conjugate gradient optimizer with dynamic learning rate and periodic restarts.
Algorithm settings:
Parameter |
Type |
Default |
|---|---|---|
|
float |
1e-2 |
|
float |
1e-8 |
|
float |
1.0 |
|
float |
1.1 |
|
float |
0.5 |
|
int |
10 |
|
float |
1e-3 |
|
float |
1e-7 |
|
float |
1e-6 |
BFGS
BFGS quasi-Newton optimizer with backtracking line search (Armijo condition).
Algorithm settings:
Parameter |
Type |
Default |
|---|---|---|
|
float |
1.0 |
|
float |
0.5 |
|
float |
1e-4 |
|
int |
20 |
|
float |
1e-3 |
|
float |
1e-7 |
|
float |
1e-6 |
PyMOO Optimizers
PyMOO_Optimizer wraps algorithms
from the PyMOO library in an AiiDA WorkChain. It uses an ask-evaluate-tell loop
where each iteration submits a batch of evaluations.
Inputs
algorithm_name(Str): name of the PyMOO algorithmparameters(Dict): containsbounds,algorithm_settings, and optionaltolitmax(Int): maximum number of iterationsitmin(Int, default 10): minimum iterations before early stopping viatolstructure(StructureData, optional): structure for lattice optimizationget_best(Bool, default True): whether to return the best result PK
Early Stopping
If tol is specified, the optimizer stops when the spread of the best objective
values over 3 consecutive iterations falls below tol (after at least itmin
iterations).
Bounds
bounds can be:
A scalar multiplier
b: each parameterpgets bounds((1-b)*p, (1+b)*p)A list of [low, high] pairs: explicit bounds for each variable
The number of optimized variables is inferred automatically from the Bravais
lattice (when a structure is provided), from initial_parameters, or from the
length of the bounds list.
Supported Algorithms
Algorithm Settings
Each algorithm accepts specific keyword arguments inside algorithm_settings
(see AlgorithmBuilder).
Use string names for operators (e.g., "SBX" for crossover, "FRS" for
sampling, "TOS" for selection).