Repository navigation
Releases
amm-optimizer 0.7.0
The research-only options that 0.6.0 deprecated are removed. The algorithm is unchanged: every configuration that ships, the research presets included, runs bit for bit as in 0.6.0, and every config hash is the same.
Removed
- The 92 research-only
Variantfields and 29 research-only option values that 0.6.0
deprecated. No shipped configuration used them (c23-c46,ATMConfig(),
ATMConfig.composite(),anytime=True), and every one of those runs and hashes exactly as
in 0.6.0. Setting a removed field to anything but its old default, or choosing a removed
value, raisesValueErrornaming 0.7.0 (0.6.x still has them); a 0.6.0 configuration
dictionary that holds a removed field at its old default still loads.
config.REMOVED_FIELDSandconfig.REMOVED_CHOICESlist them. Fields:local_method,
simplex_max_dim,nm_refine_max_dim,refine_fraction,refine_min_budget_per_dim,
refine_max_dim,cma_regimes,cma_lq_max_dim,cma_model_sigma,cma_placement,
cma_placement_max_dim,probe_faces,sampled_polish_per_dim,cma_restart,
es_small_dim,es_small_max_budget_per_dim,local_force,fork_seed,
prefix_plateau_rugged,rugged_try_cap_per_dim,rugged_try_max_per_dim,
prefix_nan_min_per_dim,prefix_plateau_ties,smooth_bfgs_second,
cma_handoff_cap_low_per_dim,cma_handoff_cap_low_max_per_dim,es_lean_start,
sep_parabolic,sep_parabolic_late,sep_parabolic_scope,targeted_gate,
targeted_amplitude,reset_on_success,scale_learning,scale_rate,scale_cap,
cov_steps,cov_path,eval_memo,width_units,crossover,noise,skip_starved,
width_mode,sr_shared_target,restart_mode,stag_tolfun,stag_tolx,ipop_factor,
ipop_max_pool,qn_false_success,qn_floor,step_box_check,box_steps,
prefix_nan_clip,prefix_nan_reprobe,prefix_fractal_min_dim,
prefix_fractal_min_per_dim,stage_extend_restart,stage_extend_max_per_dim,
sep_route_low,sep_route_low_dim,centre_point,centre_point_min_dim,sr_eta,
sr_targets,sr_widths,sr_max_width,es_init_factor,cov_cap,cov_max_dim,
chain_min_per_dim,sep_route_min_per_dim,additive_min_dim,basin_max_dim,
basin_min_per_dim,basin_descents_max_per_dim,small_engine_max_per_dim,
small_engine_radius,prefix_ridge_radius,small_switch_max_dim,
small_switch_max_per_dim,small_switch_cos,small_switch_radius,small_switch_rest,
cma_model_max_dim,cma_handoff_cap_min_dim,cma_local_nonsep_min_dim,sep_share,
sep_min_budget_per_dim,pool_max,pool_divisor. Values:amplitude_control
"success_rate";nm_stage"qnprefix","qnprefix30g";cma_restart_rule"economy";
sep_check"pair";pop_lambda"cap4","budget","steps","ipop4",
"stepsgrow";pop_switch_start"carry";rugged_try_rest"cut";prefix_nan_reading
"smooth";cma_local"population","ipop";cma_local_nonsep"ipop",
"population","qn","qn2","qn5","qn6","qn10","qn11","qn13","qn13n",
"qn15";es_kind"slsqplq10","slsqplq10hk";cma_model"lq". - The deprecation machinery for them:
config.RESEARCH_FIELDS,config.RESEARCH_CHOICES,
theirFutureWarningandtools/research_fields.py. - The research material that the package does not need: the research arms,
quick_scan.py
andlegacy_vs_reference.pyofbenchmarks, the research arms of the characterisation
snapshots (tests/characterisation_arms.json) and the tests of the removed
options. The named-configuration snapshots, the golden traces and the reference files stay.
Changed
Varianthas 72 fields, down from 164. The options that every configuration left at one
value (thesr_*widths,es_init_factor,cov_cap,cov_max_dim,pool_max,
pool_divisorand the routing thresholds ofapi) are module constants with those values;
config_hashstill hashes each removed field at its old default, so every hash is unchanged
(the default andc46are2153948ebed51150).- Internal restructuring with identical results: the phases share one budgeted objective
(_budget.py),cobyqa_phase.run_cobyqa_restartsabsorbsrun_cobyqa_from,Box.uniform
draws the uniform points, and the long routing functions (api._minimize,
es_phase.run_es_phase,cma_phase.run_cma,pop_cma.run_population_cma, the SLSQP
routes) are split into helpers in the same draw order. Ruff checks McCabe complexity (at
most 40). - Source comments no longer cite research cycles, batches or intermediate composites
(tests/test_no_research_ids.py);docs/HISTORY.mdkeeps the provenance. - The full CI tier's coverage gate is raised (
tools/ci.py).
amm-optimizer 0.6.0
Bug fixes, a SciPy-compatible API and early stopping, with the research options deprecated. The default algorithm is unchanged: every configuration that ships runs bit for bit as in 0.5.0 on inputs that worked before, the default and c46 reproduce the paper's benchmark runs exactly, and c46's config hash is still 2153948ebed51150.
Added
-
Early stopping.
minimize(..., callback=, ftarget=):callback(intermediate_result)is called after every evaluation that improves the best value, with anOptimizeResultholdingx,fun,nfevandnit; raisingStopIterationfrom it ends the run.ftargetends the run once the best value is at or below it. Either way the best point so far is returned, withstatus2 or 1, and no evaluation follows the stop.catch_interrupt=True(opt-in) turns Ctrl-C into a result too (status3,success=False, aRuntimeWarning). Without these arguments every run is bit for bit as before: the callback path draws no random numbers and changes no evaluation. -
rngaccepts anumpy.random.Generator(the run's seed is one draw,rng.integers(2**32)), andseedaccepts anumpy.random.SeedSequence. A run without a seed draws one from the operating system and records it, soresult.seedrepeats any run (seed=result.seed); it isNoneonly when aRandomStatewas continued. -
Preset names in
config=:config="default"(AMM, the default preset, frozen asc46),"c46","atm"(ATMConfig()),"composite"(ATMConfig.composite()) or a research preset;presets.gettakes the same names. Anything else that is not anATMConfigis aTypeError. -
examples/with three short scripts:quickstart.py,scipy_migration.pyandearly_stopping.py. -
docs/HISTORY.md: how the research compositesc23toc46came about (from thepresetsmodule docstring, which is now a short list). -
A documentation site, for https://amm-optimizer.readthedocs.io: getting started, a user
guide (bounds, budgets, seeds, the anytime mode, profiling), the presets, the API reference
generated from the docstrings, the changelog, the deprecation policy and how to cite AMM
(mkdocs.yml,.readthedocs.yaml, adocsextra). CI builds it withmkdocs build --strict,
and the package metadata links it asDocumentation. -
Each release tag gets a GitHub Release once PyPI has the files: its notes are the version's
CHANGELOG section, and it carries the wheel, the sdist and a CycloneDX SBOM. -
CI: a floor leg with the oldest supported NumPy and SciPy (2.0 and 1.18.0, Python 3.12), and
coverage reports on Codecov.
Changed
- The result is a
scipy.optimize.OptimizeResult(amm_optimizer.OptimizeResultsubclasses it):r.xworks as before, andr["x"],r.keys()anddict(r)work as in SciPy. New fields:nit(the number of evaluations that improved the best value, the timescallbackis called),success,status(0 budget used or plan finished, 1ftargetreached, 2 stopped by the callback, 3 interrupted),messageandseed. It is no longer a dataclass, so code that calleddataclasses.replaceordataclasses.asdicton a result needsdict(r)or item assignment instead. - A non-finite value at the starting point is a failed evaluation, like a non-finite value anywhere else: the run carries on, and any finite value beats it. It used to raise
ValueError, so only runs that failed before behave differently; an objective undefined at the centre of the box now works. A run in which every value fails returnsfun=infat the starting point. presets.names()lists the presets on display,("default", "c46", "atm", "composite");presets.names(research=True)adds the research compositesc23toc45, which all stay loadable withpresets.get.minimize's docstring documents the new arguments and recommendscallbackorftarget, not an exception raised insidefun, for cutting an anytime run short.- An
x0outsideboundsis clipped onto the box, with aUserWarning, on every box. On the bbob box[-5, 5]it used to be evaluated as given; on any other box it was already clipped, silently, so those runs are unchanged.amm_optimizer.api.minimize, the engine, does not checkx0.
Deprecated
- 92 research-only
Variantfields and 29 research-only values of the other fields emit a
FutureWarningwhen set and will be removed in 0.7.0 (warnings.filterwarnings("ignore", "Variant", FutureWarning)silences them meanwhile). No shipped configuration (c23-c46,
ATMConfig(),ATMConfig.composite(),anytime=True) uses them, so none of those warns,
and their config hashes and results are unchanged. The lists areconfig.RESEARCH_FIELDSand
config.RESEARCH_CHOICES, measured bytools/research_fields.py. Fields:targeted_gate,
targeted_amplitude,reset_on_success,sr_eta,sr_targets,sr_widths,
sr_max_width,es_init_factor,es_small_dim,es_small_max_budget_per_dim,
scale_learning,scale_rate,scale_cap,cov_cap,cov_steps,cov_path,
cov_max_dim,local_force,fork_seed,prefix_plateau_rugged,chain_min_per_dim,
sep_route_min_per_dim,additive_min_dim,basin_max_dim,basin_min_per_dim,
basin_descents_max_per_dim,small_engine_max_per_dim,small_engine_radius,
rugged_try_cap_per_dim,rugged_try_max_per_dim,prefix_ridge_radius,
small_switch_max_dim,small_switch_max_per_dim,small_switch_cos,
small_switch_radius,small_switch_rest,sampled_polish_per_dim,qn_false_success,
qn_floor,probe_faces,eval_memo,step_box_check,box_steps,
prefix_nan_min_per_dim,prefix_nan_clip,prefix_nan_reprobe,prefix_plateau_ties,
prefix_fractal_min_dim,prefix_fractal_min_per_dim,stage_extend_restart,
stage_extend_max_per_dim,sep_route_low,sep_route_low_dim,centre_point,
centre_point_min_dim,smooth_bfgs_second,cma_restart,cma_model_max_dim,
cma_lq_max_dim,cma_model_sigma,cma_handoff_cap_min_dim,
cma_handoff_cap_low_per_dim,cma_handoff_cap_low_max_per_dim,es_lean_start,
cma_regimes,cma_placement,cma_placement_max_dim,cma_local_nonsep_min_dim,
sep_parabolic,sep_parabolic_late,sep_parabolic_scope,sep_share,
sep_min_budget_per_dim,width_units,crossover,noise,skip_starved,width_mode,
sr_shared_target,restart_mode,stag_tolfun,stag_tolx,ipop_factor,
ipop_max_pool,local_method,simplex_max_dim,nm_refine_max_dim,refine_fraction,
refine_min_budget_per_dim,refine_max_dim,pool_max,pool_divisor. Values:
amplitude_control"success_rate";es_kind"slsqplq10","slsqplq10hk";
cma_local_nonsep"ipop","population","qn","qn2","qn5","qn6","qn10",
"qn11","qn13","qn13n","qn15";nm_stage"qnprefix","qnprefix30g";
cma_model"lq";cma_restart_rule"economy";cma_local"population","ipop";
sep_check"pair";pop_lambda"cap4","budget","steps","ipop4","stepsgrow";
pop_switch_start"carry";rugged_try_rest"cut";prefix_nan_reading"smooth".
Fixed
fungets its own copy of every point, as in SciPy. It used to receive writeable views of the optimizer's buffers, so an objective that wrote intoxchanged the search, and one that keptxsaw it change.- Bad inputs fail before any evaluation, with plain errors: a non-finite
x0(ValueError); aconfigthat is neither anATMConfignor a preset name (TypeError), or names no preset (ValueError); anrngthat is not a NumPyGeneratororRandomState(TypeErrornamingseed=); aseedthat is not an integer or aSeedSequence(TypeError) or is outside[0, 2**32)(ValueError); aboolbudget(TypeError, it was taken as 1). Afunthat returns an array, a list, a complex number orNonegets aTypeErrorthat says what it returned. - The value at the starting point is a
floatlike every other value; afunreturningFractionno longer crashes. - Warnings raised by
funreach the caller on the COBYQA and basin routes, which used to ignore every warning. SciPy's own overflow warnings from finite differences over a failed evaluation are no longer shown. - The diagnostic logs stay bounded.
anytime.LAST_STAGES(aliasSTAGE_LOG) holds the stages of the most recent anytime run only;cma_phase.PROBE_LOGrecords only whilecma_phase.RECORD_PROBESis true. - Runs in separate threads no longer share the step unit of
Variant.box_steps. It was the module globalqn_phase.X_UNIT, which every call wrote, so two threads on different boxes used whichever unit was written last; it is now a context variable (qn_phase.set_x_unit/qn_phase.x_unit()), one per thread. Every run is bit for bit as before.