Skip to main content

StudyConfig

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

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>,

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

Sets the study seed — the root of every derived seed.

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

Declares what intermediate step values count.

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>
where I: IntoIterator<Item = S>, S: Into<String>,

Names the objectives, for reports and dashboards.

§Errors

Error::InvalidSpace if the number of names does not match the number of directions.

pub fn name(&self) -> &str

The study’s name.

pub fn directions(&self) -> &[Direction]

The objective directions; at least one.

pub const fn seed(&self) -> u64

The study seed.

pub const fn space(&self) -> Option<&SpaceSchema>

The statically declared search space, if there is one.

pub const fn resource_unit(&self) -> &ResourceUnit

What intermediate step values count.

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>

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]>

The objective names, if they were declared.

pub fn is_multi_objective(&self) -> bool

true if the study has more than one objective.

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

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

§

fn clone(&self) -> StudyConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for StudyConfig

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl<'de> Deserialize<'de> for StudyConfig

§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl PartialEq for StudyConfig

§

fn eq(&self, other: &StudyConfig) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
§

impl Serialize for StudyConfig

§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl StructuralPartialEq for StudyConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more