odatse.algorithm.global_search module#
- class odatse.algorithm.global_search.Algorithm(info: Info, runner: Runner = None, domain=None, run_mode: str = 'initial')[source]#
Bases:
AlgorithmBaseAlgorithm class for global optimization using scipy.optimize routines.
The optimization method is selected by the
methodparameter in the[algorithm.global_search]section. Currently implemented:“DE” / “differential_evolution”: scipy.optimize.differential_evolution
“shgo”: scipy.optimize.shgo
“direct”: scipy.optimize.direct
“dual_annealing”: scipy.optimize.dual_annealing
The per-method differences (aliases, seed and workers handling, callback signature, defaults, output files) are described by the module-level _METHODS table.
All other entries of the section are passed verbatim as arguments of the selected scipy routine; argument names the routine does not accept abort before the optimization starts.
MPI parallelization uses a master-worker layout over the algorithm communicator: algorithm rank 0 drives the scipy optimizer, whose
workershook scatters candidate points (for DE, a whole generation at a time) to all algorithm ranks; the other ranks run an evaluation-server loop, evaluating their share of the points with their own solver group. This composes with solver-side parallelism (nsolve): the total parallelism is algsize (points) x nsolve (per point). The direct and dual_annealing methods do not support parallel evaluation and run entirely on rank 0.Initialize the Algorithm class.
- Parameters:
info (Info) – Information object containing algorithm settings.
runner (Runner) – Runner object for submitting jobs.
domain – Domain object defining the search space.
run_mode (str) – Mode of running the algorithm.
- __init__(info: Info, runner: Runner = None, domain=None, run_mode: str = 'initial') None[source]#
Initialize the Algorithm class.
- Parameters:
info (Info) – Information object containing algorithm settings.
runner (Runner) – Runner object for submitting jobs.
domain – Domain object defining the search space.
run_mode (str) – Mode of running the algorithm.
- _initialize() None[source]#
Set up initial state for a fresh run.
The global search does not use checkpointing, so this is a no-op.
- _output_results()[source]#
Output the results of the optimization to files.
Every algorithm rank writes the history of its own function evaluations; the iteration history and the result summary exist only on rank 0, which drove the optimizer.
- class odatse.algorithm.global_search._Method(func: Callable | None, requires: str | None, aliases: tuple, uses_seed: bool, supports_workers: bool, callback_style: str, defaults: dict, iter_file: str, iter_header: str)[source]#
Bases:
objectDeclarative description of one scipy.optimize global routine.
All per-method differences of the algorithm live here, so that adding a method amounts to adding one entry to the _METHODS table (plus tests and documentation); __init__, _run and _output_results are table-driven.