pub struct SearchSpace {
pub dimensions: Vec<SearchDimension>,
pub frozen: HashMap<String, Value>,
}Expand description
Aggregation of search dimensions from one or more filters.
Fields§
§dimensions: Vec<SearchDimension>The dimensions samplers draw from. SearchSpace::freeze
removes a dimension from this list, so everything here is
actively searched.
frozen: HashMap<String, Value>Parameters pinned to a fixed value by SearchSpace::freeze,
keyed by dimension name. The StudyRunner injects these into
every trial’s params so a frozen parameter still reaches the
filter (and its cache key).
Implementations§
Source§impl SearchSpace
impl SearchSpace
Sourcepub fn add(&mut self, dim: SearchDimension)
pub fn add(&mut self, dim: SearchDimension)
Append a dimension. No name-collision check happens here; use
SearchSpace::merge_with_prefix when combining spaces from
several filters.
Sourcepub fn merge_with_prefix(&mut self, prefix: &str, other: SearchSpace)
pub fn merge_with_prefix(&mut self, prefix: &str, other: SearchSpace)
Merge another search space with a prefix to avoid name collisions.
Every dimension name in other becomes "{prefix}.{name}"
(conditional dimensions get their parent prefixed too, so the
dependency still resolves). This is how a graph aggregates each
filter’s Searchable::search_space into one space keyed by
node label.
Sourcepub fn freeze(&mut self, name: &str, value: Value)
pub fn freeze(&mut self, name: &str, value: Value)
Freeze a parameter to a fixed value (exclude from search).
Removes the dimension named name from SearchSpace::dimensions
and records the value in SearchSpace::frozen; the value is
then injected into every trial’s params by the runner. Freezing
a name with no matching dimension just records the value.
Sourcepub fn active_dimensions(&self) -> &[SearchDimension]
pub fn active_dimensions(&self) -> &[SearchDimension]
The dimensions still being searched. Since SearchSpace::freeze
removes frozen dimensions from the list, this is every entry of
SearchSpace::dimensions — the method exists so callers state
their intent rather than reach into the field.
Sourcepub fn validate(&self) -> Result<(), Vec<String>>
pub fn validate(&self) -> Result<(), Vec<String>>
Validate all dimensions, collecting every failure rather than
stopping at the first — a study definition should surface all
its range errors in one pass. Ok(()) when every dimension
passes SearchDimension::validate.
Trait Implementations§
Source§impl Clone for SearchSpace
impl Clone for SearchSpace
Source§fn clone(&self) -> SearchSpace
fn clone(&self) -> SearchSpace
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more