feat: add Pruner trait and NopPruner default implementation

Introduce the pruning extension point for the trial pruning system.
The Pruner trait allows deciding whether to stop a trial early based
on intermediate values. NopPruner (never prunes) is the default.
This commit is contained in:
Manuel Raimann
2026-02-11 15:46:56 +01:00
parent d88280c152
commit 2651e61b2c
4 changed files with 138 additions and 0 deletions
+3
View File
@@ -188,6 +188,7 @@ mod error;
mod kde;
mod param;
pub mod parameter;
pub mod pruner;
pub mod sampler;
mod study;
mod trial;
@@ -200,6 +201,7 @@ pub use param::ParamValue;
pub use parameter::{
BoolParam, Categorical, CategoricalParam, EnumParam, FloatParam, IntParam, ParamId, Parameter,
};
pub use pruner::{NopPruner, Pruner};
pub use sampler::CompletedTrial;
pub use sampler::grid::GridSearchSampler;
pub use sampler::random::RandomSampler;
@@ -222,6 +224,7 @@ pub mod prelude {
pub use crate::parameter::{
BoolParam, Categorical, CategoricalParam, EnumParam, FloatParam, IntParam, Parameter,
};
pub use crate::pruner::{NopPruner, Pruner};
pub use crate::sampler::CompletedTrial;
pub use crate::sampler::grid::GridSearchSampler;
pub use crate::sampler::random::RandomSampler;