Skip to main content

AshaPruner

Struct AshaPruner 

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

The asynchronous successive-halving pruner.

§The promotion rule, precisely

On a report at step:

  1. If step is not exactly a rung resource level, the trial has not just reached a rung — Decision::Continue. (Deciding only at exact rung steps is what lets the value being judged, and every competitor’s value, be the value at that resource; a trial whose cadence never lands on a rung is never gated there, a safe omission — it is never wrongly pruned.)
  2. Otherwise gather the values of every trial that reached this rung — from the typed StudyView, not a side-table — and apply is_promotable: promoted iff in the top 1/η, with the first η − 1 arrivals promoted optimistically so a rung baseline can form. Promote → Decision::Continue; otherwise Decision::Prune.

A trial pruned at a rung keeps its value there as its objective value (the pruned-adopts-last-intermediate rule — why a pruning example’s curve falls), which is exactly what makes the rung comparison for later trials sound.

§Multi-objective

Successive halving ranks a single objective, so a multi-objective study is never pruned (returns Decision::Continue) rather than gate on one dimension and risk pruning a Pareto-optimal trial.

§Determinism

The decision is a pure function of the ask-time StudyView, so it depends on which trials had filled the rung when this one was asked — completion-order dependent under parallelism. An ASHA-scheduled study is therefore replayable, not pre-determined (where determinism stops); under a single worker with a fixed seed the pruning is fully reproducible.

§Where the rung table lives

Nowhere persistent. Optuna records rung membership as system_attrs strings; atune derives it from the StudyView’s typed intermediate reports on each call. The typed shape it takes when a caller wants to store or inspect it is RungTable, available through rung_table and round-trippable through a StateBlob on Scope::Scheduler — typed state, never attr-string hacks. Because the decision needs no persisted state, state returns None.

use atune_core::scheduler::AshaPruner;

// Rungs at 1, 3, 9 env-steps (η = 3), finishing at 27.
let asha = AshaPruner::new(1, 27, 3)?;
assert_eq!(asha.ladder().rungs(), [1, 3, 9]);

Implementations§

§

impl AshaPruner

pub fn new( min_resource: u64, max_resource: u64, reduction_factor: u32, ) -> Result<Self>

Builds an ASHA pruner over the ladder (min_resource, max_resource, reduction_factor).

§Errors

Error::InvalidSpace for a nonsense ladder — see RungLadder::new.

pub fn with_default_eta(min_resource: u64, max_resource: u64) -> Result<Self>

Builds an ASHA pruner with the default reduction factor.

§Errors

As new.

pub const fn from_ladder(ladder: RungLadder) -> Self

Builds an ASHA pruner from an already-constructed ladder.

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

Selects which objective dimension to gate on (default 0).

pub const fn ladder(&self) -> &RungLadder

The resource ladder this pruner gates on.

pub fn rung_table(&self, view: &StudyView) -> RungTable

The typed rung table derived from view — the occupants of every rung.

The Scope::Scheduler state shape the design mandates, built on demand rather than persisted: it round-trips through a StateBlob and is handy for a dashboard, a test, or M4’s DEHB.

Trait Implementations§

§

impl Clone for AshaPruner

§

fn clone(&self) -> AshaPruner

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 AshaPruner

§

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

Formats the value using the given formatter. Read more
§

impl Scheduler for AshaPruner

§

fn on_report( &self, study: &StudyView, _trial: &TrialMeta, step: u64, values: &[f64], ) -> Result<Decision>

Promotes or prunes at each rung; see the type docs.

§Errors

Never — the decision is total.

§

fn state(&self) -> Result<Option<SchedulerState>>

None: the rung table is derived from the StudyView, not persisted (see the type docs).

§

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
§

fn on_trial_end( &self, study: &StudyView, trial: &FrozenTrial, ) -> Result<Vec<Command>>

Called once a trial reaches a terminal state. Read more
§

fn resume_candidates(&self, study: &StudyView) -> Result<Vec<Command>>

Paused trials worth waking on a freed work slot, in priority order. Read more
§

fn restore_state(&self, blob: &SchedulerState) -> Result<()>

Restores a scheduler from a previously persisted blob. 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> 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> 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