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
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>
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>
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>
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
impl Debug for FidelityObjective
§impl Objective for FidelityObjective
impl Objective for FidelityObjective
§fn evaluate(&self, ctx: &mut TrialCtx<'_>) -> Result<Outcome>
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.