Skip to main content

FreezeThaw

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

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

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

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

Sets the acquisition exploration coefficient κ (clamped to be non-negative).

pub const fn with_objective(self, obj: usize) -> Self

Selects which objective dimension FreezeThaw models (default 0).

pub const fn interval(&self) -> u64

The cadence at which a pause may be decided.

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

The reduction factor η of the extrapolated-asymptote promotion rule.

pub const fn kappa(&self) -> f64

The acquisition exploration coefficient κ.

Trait Implementations§

§

impl Debug for FreezeThaw

§

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

Formats the value using the given formatter. Read more
§

impl Scheduler for FreezeThaw

§

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

Evicts the finished trial’s accumulated curve and thaws the best paused trial, if one is worth a freed slot; see the type docs.

§Errors

Never — the decision is total.

§

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

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<()>

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.

§

fn fan_report_mode(&self) -> FanReportMode

Declares whether this scheduler accepts aligned aggregate fan reports. Read more
§

fn scripted_capability(&self) -> ScriptedSchedulerCapability

Declares whether scripted ask/tell can recreate this scheduler. Read more

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