Struct FreezeThaw
pub struct FreezeThaw { /* private fields */ }Expand description
The freeze-thaw scheduler: pause many, extrapolate, resume the promising few.
See the module documentation for the model, the pause and resume rules, the state contract and the determinism statement.
use atune_core::scheduler::FreezeThaw;
// Decide every 1 resource unit, model from 4 points, keep the top half by
// extrapolated asymptote, thaw with one σ of optimism.
let ft = FreezeThaw::new(1)?;
assert_eq!(ft.interval(), 1);Implementations§
§impl FreezeThaw
impl FreezeThaw
pub fn new(interval: u64) -> Result<Self>
pub fn new(interval: u64) -> Result<Self>
Builds a freeze-thaw scheduler that decides every interval resource
units, with DEFAULT_MIN_POINTS, DEFAULT_FREEZE_FACTOR and
DEFAULT_KAPPA.
§Errors
Error::InvalidSpace if interval
is 0 — an interval of zero would try to decide before a trial has run,
exactly as a Pbt interval of zero does.
pub fn with_min_points(self, min_points: usize) -> Self
pub fn with_min_points(self, min_points: usize) -> Self
Sets the minimum number of curve points before a trial is modelled (clamped to at least three — the pow-3 fit needs three parameters).
pub fn with_reduction_factor(self, reduction_factor: u32) -> Self
pub fn with_reduction_factor(self, reduction_factor: u32) -> Self
Sets the reduction factor η of the extrapolated-asymptote promotion rule
(clamped to at least MIN_REDUCTION_FACTOR).
pub fn with_kappa(self, kappa: f64) -> Self
pub fn with_kappa(self, kappa: f64) -> Self
Sets the acquisition exploration coefficient κ (clamped to be
non-negative).
pub const fn with_objective(self, obj: usize) -> Self
pub const fn with_objective(self, obj: usize) -> Self
Selects which objective dimension FreezeThaw models (default 0).
pub const fn min_points(&self) -> usize
pub const fn min_points(&self) -> usize
The minimum number of curve points before a trial is modelled.
pub const fn reduction_factor(&self) -> u32
pub const fn reduction_factor(&self) -> u32
The reduction factor η of the extrapolated-asymptote promotion rule.
Trait Implementations§
§impl Debug for FreezeThaw
impl Debug for FreezeThaw
§impl Scheduler for FreezeThaw
impl Scheduler for FreezeThaw
§fn on_report(
&self,
study: &StudyView,
trial: &TrialMeta,
step: u64,
values: &[f64],
) -> Result<Decision>
fn on_report( &self, study: &StudyView, trial: &TrialMeta, step: u64, values: &[f64], ) -> Result<Decision>
Accumulates the reported point and pauses a trial whose extrapolated asymptote is not in the promotable set; see the type docs.
§Errors
Error::InvalidSpace if the selected
objective is not present in the study.
§fn on_trial_end(
&self,
study: &StudyView,
trial: &FrozenTrial,
) -> Result<Vec<Command>>
fn on_trial_end( &self, study: &StudyView, trial: &FrozenTrial, ) -> Result<Vec<Command>>
§fn resume_candidates(&self, study: &StudyView) -> Result<Vec<Command>>
fn resume_candidates(&self, study: &StudyView) -> Result<Vec<Command>>
The best paused trial to thaw on a freed work slot — the slot-driven
resume the study loop consults in ask before
starting fresh work.
Freeze-thaw pauses trials whose thaw no terminal completion may ever
trigger (on_trial_end fires only on a finish,
and a slot here was freed by a pause), so without this a genuinely
promising frozen trial is stranded and the budget is burned on fresh trials
that also freeze (FIX B). The decision is the identical decide_resume the
terminal on_trial_end path uses — the best
acquisition ĉ + κ·σ̂ among the paused trials, resumed only if it can still
beat the incumbent — so the two paths never disagree.
§Errors
Never — the decision is total.
§fn state(&self) -> Result<Option<SchedulerState>>
fn state(&self) -> Result<Option<SchedulerState>>
The accumulated curve store, serialized. FreezeThaw is stateful (the
reporting trial’s own curve is not in the StudyView
on_report is handed), so this is Some whenever
any trial has reported.
§Errors
Error::Storage if the store cannot be
serialized.
§fn restore_state(&self, blob: &SchedulerState) -> Result<()>
fn restore_state(&self, blob: &SchedulerState) -> Result<()>
Restores the accumulated curve store from a persisted blob, so a resumed study continues with the exact partial curves the previous handle had.
§Errors
Error::Storage if the blob cannot be
decoded.