Struct Patient
pub struct Patient { /* private fields */ }Expand description
A decorator that delays an inner scheduler’s prune until a trial has stopped improving.
It forwards every call to the wrapped Scheduler, with one change: an inner
Decision::Prune is suppressed (turned into Decision::Continue)
until the trial has gone patience consecutive reports without improving its
own best objective value. Pause, Fork and Continue pass through
untouched, as does everything from on_trial_end
and state (Patient adds no persistent state of its own).
This dampens the failure mode the design warns about — a noisy RL curve that
dips for one report and is pruned by an over-eager inner rule even though it
was about to recover (prune and
schedule). Compose it over any
pruner: Patient::new(3, Arc::new(AshaPruner::new(1, 27, 3)?)).
§Why it tracks per-trial state
“Improving its own best” needs the trial’s own report history, which the
ask-time StudyView does not contain (the reporting trial is not in it) and
which no storage handle is offered for. Patient therefore keeps a tiny
{best, stale} record per live trial behind a mutex, cleared on
on_trial_end — transient bookkeeping, not study
state.
§Determinism
The improvement count is a deterministic function of the trial’s own reports (which arrive in order on one worker); the inner decision carries whatever determinism the inner scheduler has. Replayable, not pre-determined, under parallelism.
Implementations§
Trait Implementations§
§impl Scheduler for Patient
impl Scheduler for Patient
§fn on_trial_end(
&self,
study: &StudyView,
trial: &FrozenTrial,
) -> Result<Vec<Command>>
fn on_trial_end( &self, study: &StudyView, trial: &FrozenTrial, ) -> Result<Vec<Command>>
Forwards to the inner scheduler and clears the finished trial’s tracker.
§fn state(&self) -> Result<Option<SchedulerState>>
fn state(&self) -> Result<Option<SchedulerState>>
The inner scheduler’s state — Patient adds none of its own.
§fn resume_candidates(&self, study: &StudyView) -> Result<Vec<Command>>
fn resume_candidates(&self, study: &StudyView) -> Result<Vec<Command>>
Forwards slot-driven wakeups without changing the inner scheduler’s command semantics.
§fn restore_state(&self, blob: &SchedulerState) -> Result<()>
fn restore_state(&self, blob: &SchedulerState) -> Result<()>
Restores the wrapped scheduler’s state; Patient has no state of its own.