Skip to main content

Pruner

Trait Pruner 

Source
pub trait Pruner: Send + Sync {
    // Required method
    fn should_prune(&self, study_state: &StudyState, trial: &Trial) -> bool;
}
Expand description

A pluggable early-stopping policy.

Called from crate::TrialContext::should_prune inside the user’s objective, typically right after a report(step, value) call. The user’s loop is expected to break early when this returns true. Takes &self plus the StudyState so cross-trial policies can compare against other trials’ intermediate histories.

Required Methods§

Source

fn should_prune(&self, study_state: &StudyState, trial: &Trial) -> bool

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§