tauopt.engine.strategies.registry#
Strategy registry: name -> lazily-imported singleton.
Registry-dicts only – deliberately no plugin framework. Lazy import is load-bearing: the registry module itself must import under the featherweight install (pin P3); math deps load only when a strategy is used.
Module Contents#
Functions#
Register a custom strategy instance under |
|
Return the strategy singleton for |
|
All strategy names (built-ins plus registered instances), installed or not. |
|
The params keys |
|
The |
|
True when every probe module for the install extra (“local”, “botorch”) is importable; False for unknown extras. Checks via find_spec, so nothing actually imports (pin P3). |
|
True when |
|
The subset of known() usable in this environment. |
API#
- tauopt.engine.strategies.registry.register(strategy: tauopt.engine.strategies.base.Strategy) None#
Register a custom strategy instance under
strategy.name(overrides allowed – that is the research seam: swap a builtin for an experimental variant locally).
- tauopt.engine.strategies.registry.get(name: str) tauopt.engine.strategies.base.Strategy#
Return the strategy singleton for
name, importing a built-in’s module on first use (registered instances take precedence over built-ins). Raises KeyError for unknown names.
- tauopt.engine.strategies.registry.known() set[str]#
All strategy names (built-ins plus registered instances), installed or not.
- tauopt.engine.strategies.registry.accepted_params(name: str) frozenset[str] | None#
The params keys
namereads: a registered instance’s ownaccepted_paramswhen it declares one, the local mirror for a built-in (no math imports, pin P3), and None when nothing is declared – an unknown name, or a custom strategy whose keys are its own – so the ask boundary checks nothing for it.
- tauopt.engine.strategies.registry.reader(name: str)#
The
read_paramsthe ask boundary runs forname’s VALUES, or None when nothing checks (an unknown name, or a strategy withoutread_params): a registered instance’s own method; for a built-in, the method of an UNCACHED instance – no_instanceswrite, sois_availablestays truthful and the ladder still skips a rung whose extra is missing. The built-in GP modules import no math at import time (their torch/botorch imports are lazy, pin P3), so the boundary’s check runs on every install, the featherweight one included (the round-1 fold F2 of the params-values lane: the install carve-out skipped a check the reader could run).
- tauopt.engine.strategies.registry.extra_installed(extra: str) bool#
True when every probe module for the install extra (“local”, “botorch”) is importable; False for unknown extras. Checks via find_spec, so nothing actually imports (pin P3).