Struct StudyConfig
pub struct StudyConfig { /* private fields */ }Expand description
Everything a study is created from.
The seed is part of the configuration, not of the runtime: reproducing a study means reading this back from storage and running again.
use atune_core::study::{Direction, StudyConfig};
let cfg = StudyConfig::new("ppo-cartpole")
.with_seed(42)
.with_directions([Direction::Maximize])
.unwrap();
assert_eq!(cfg.seed(), 42);
assert!(!cfg.is_multi_objective());Implementations§
§impl StudyConfig
impl StudyConfig
pub fn new(name: impl Into<String>) -> Self
pub fn new(name: impl Into<String>) -> Self
A single-objective, minimizing study with seed 0 and no declared
space.
pub fn with_directions<I>(self, directions: I) -> Result<Self>where
I: IntoIterator<Item = Direction>,
pub fn with_directions<I>(self, directions: I) -> Result<Self>where
I: IntoIterator<Item = Direction>,
Sets the objective directions.
§Errors
Error::InvalidSpace if the list is empty — a study without a
direction cannot rank anything.
pub const fn with_seed(self, seed: u64) -> Self
pub const fn with_seed(self, seed: u64) -> Self
Sets the study seed — the root of every derived seed.
pub fn with_space(self, space: SpaceSchema) -> Self
pub fn with_space(self, space: SpaceSchema) -> Self
Attaches a statically declared search space.
When a space is attached, the relative (joint) space is exact rather than inferred from history (two ways to write a space).
pub fn with_resource_unit(self, unit: ResourceUnit) -> Self
pub fn with_resource_unit(self, unit: ResourceUnit) -> Self
Declares what intermediate step values count.
pub const fn with_seed_protocol(self, protocol: SeedProtocol) -> Self
pub const fn with_seed_protocol(self, protocol: SeedProtocol) -> Self
Attaches the multi-seed SeedProtocol.
The protocol is a persisted property of the study, exactly like the
seed and the directions: a study created with a fan (or a tune/test seed
split) records it here, so a later resume — even a plain one that passes
no seed flags — evaluates its trials under the same protocol rather than
silently reverting to single-seed draws and mixing two objective
semantics in one study (multi-seed
protocol). The default
is SeedProtocol::new (single-seed, no fan), which serializes to
nothing and leaves a non-RL study’s on-disk form unchanged.
pub fn with_metric_names<I, S>(self, names: I) -> Result<Self>
pub fn with_metric_names<I, S>(self, names: I) -> Result<Self>
Names the objectives, for reports and dashboards.
§Errors
Error::InvalidSpace if the number of names does not match the
number of directions.
pub fn directions(&self) -> &[Direction]
pub fn directions(&self) -> &[Direction]
The objective directions; at least one.
pub const fn space(&self) -> Option<&SpaceSchema>
pub const fn space(&self) -> Option<&SpaceSchema>
The statically declared search space, if there is one.
pub const fn resource_unit(&self) -> &ResourceUnit
pub const fn resource_unit(&self) -> &ResourceUnit
What intermediate step values count.
pub const fn seed_protocol(&self) -> SeedProtocol
pub const fn seed_protocol(&self) -> SeedProtocol
The multi-seed protocol the study evaluates its trials under.
The single source of truth for the protocol: a study built with
StudyBuilder::seed_protocol
carries it here, storage persists it verbatim as part of this config, and
a resumed study reads it back from here rather than from the resuming
caller. The default is SeedProtocol::new (single-seed, no fan).
pub const fn scheduler_capability(&self) -> Option<ScriptedSchedulerCapability>
pub const fn scheduler_capability(&self) -> Option<ScriptedSchedulerCapability>
The exact scheduler capability recorded at study creation, if any.
None means the study predates this marker or was written directly to
storage without a StudyBuilder. It is
intentionally not interpreted as the no-op scheduler by consumers.
pub fn metric_names(&self) -> Option<&[String]>
pub fn metric_names(&self) -> Option<&[String]>
The objective names, if they were declared.
pub fn is_multi_objective(&self) -> bool
pub fn is_multi_objective(&self) -> bool
true if the study has more than one objective.
pub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Checks the configuration’s invariants.
§Errors
Error::InvalidSpace if there is no direction, if the metric names do
not match the directions one for one, or if the seed protocol’s
MeanMinusStd risk-aversion λ is not finite
(with_aggregate is an unvalidated const fn, so a NaN/±inf λ can
reach here — it is never meaningful data and, left unchecked, serializes
to JSON null, breaking the remote round-trip; every backend rejects it
identically).
pub const fn with_scheduler_capability(
self,
capability: ScriptedSchedulerCapability,
) -> Self
pub const fn with_scheduler_capability( self, capability: ScriptedSchedulerCapability, ) -> Self
Records the capability reported by the scheduler that will run this study.
StudyBuilder::create applies this automatically. Callers that first
persist a configuration through StudyCatalog
must apply the result of Scheduler::scripted_capability
before the atomic catalog insertion, so later scripted clients can fail
closed instead of guessing which scheduler created the study.
Trait Implementations§
§impl Clone for StudyConfig
impl Clone for StudyConfig
§fn clone(&self) -> StudyConfig
fn clone(&self) -> StudyConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more