Skip to main content

FidelityObjective

Struct FidelityObjective 

pub struct FidelityObjective { /* private fields */ }
Expand description

Runs one oniro trial at a per-trial fidelity chosen by a FidelitySource.

A plain Objective, so it rides the ordinary study loop. Per trial it suggests the configuration, asks the source for this trial’s run.steps budget, runs one cold oniro run at that budget (through the same evaluate_child path the M3.3 spike uses — materialize, run, greedy eval), and reports the value at that fidelity, which charges the study’s fidelity-unit budget.

Pair a FidelitySource::Dehb objective with the same Dehb as the study’s sampler and a Budget::with_fidelity_units; a FidelitySource::Fixed objective with a Random sampler and the same unit budget is the matched full-fidelity baseline.

§Single evaluation per trial

This objective reports once per evaluation. It draws its seed from replicate_seed and works inside a fan; Study aligns the reports and charges all k replicates to the fidelity budget. The matched DEHB-vs-random demonstrations remain fan-free so their unit budget compares configuration screening rather than replicate count.

Implementations§

§

impl FidelityObjective

pub fn new( schema: SpaceSchema, oniro_cli: impl Into<PathBuf>, base_config: impl Into<String>, run_root: impl Into<PathBuf>, fidelity: FidelitySource, full_fidelity: u64, ) -> Result<Self>

Builds a multi-fidelity objective over schema, driving oniro_cli.

full_fidelity is the budget a trial runs at when fidelity returns None (an empty space) and is the value a FidelitySource::Fixed baseline is usually built with. Defaults: greedy Eval over 10 episodes and DEFAULT_FIDELITY_KEY.

§The study must declare the same space

Each trial resolves its parameters through TrialCtx::suggest_declared, which reads the range from the study’s ask-time space, not from schema — schema here only lists which names to ask for. Running this objective against a Study whose own declared space (StudyConfig::with_space) does not carry schema’s parameters is not a construction-time error: every trial instead fails with Error::UnknownParam, and since a failed trial does not fail the study, Study::optimize_with still returns Ok(()) while Study::best_trial stays None and no trial ever completes. Build the study with .with_space(schema.clone()) to avoid this.

§Errors

Returns SpikeError::Oniro for an empty executable path, SpikeError::Materialize for an oversized or malformed base config, SpikeError::Segment for zero full fidelity, SpikeError::Io when the invocation child or its base artifact cannot be created, or SpikeError::ResourceCap when unique allocation is exhausted.

pub fn eval_episodes(self, episodes: usize) -> Result<Self>

Averages episodes greedy episodes per trial (eval source only).

An invalid count rolls back this constructor’s empty invocation child, so configuration errors cannot leave an apparently usable artifact.

§Errors

Returns SpikeError::ResourceCap when episodes is zero or exceeds crate::runtime::MAX_EVAL_EPISODES.

pub fn timeout(self, timeout: Duration) -> Result<Self>

Sets one wall-clock budget shared by training and metric collection.

An invalid duration rolls back this constructor’s empty invocation child before returning the error.

§Errors

Returns SpikeError::ResourceCap when timeout is zero or exceeds MAX_TRIAL_DURATION.

Trait Implementations§

§

impl Debug for FidelityObjective

§

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

Formats the value using the given formatter. Read more
§

impl Objective for FidelityObjective

§

fn evaluate(&self, ctx: &mut TrialCtx<'_>) -> Result<Outcome>

Samples the configuration, resolves this trial’s fidelity, runs one cold oniro run at it, and reports the value at that fidelity.

§Errors

Error::Objective wrapping a SpikeError if a value cannot be rendered or the oniro run/eval fails, which fails that trial and leaves the study running (docs/design/04-rl-and-oniro.md §A.4); or whatever report returns.

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<T> ByRef<T> for T

§

fn by_ref(&self) -> &T

§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

§

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