5fe0a75f78
Add Serialize/Deserialize derives to all public data types (ParamValue, Distribution, Direction, TrialState, ParamId, AttrValue, CompletedTrial) gated behind a `serde` feature flag. Introduce StudySnapshot struct and Study::save()/Study::load() for persisting and restoring study state as human-readable JSON.
26 lines
736 B
Rust
26 lines
736 B
Rust
//! Core types for the optimizer library.
|
|
|
|
/// The direction of optimization.
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
|
pub enum Direction {
|
|
/// Minimize the objective value.
|
|
Minimize,
|
|
/// Maximize the objective value.
|
|
Maximize,
|
|
}
|
|
|
|
/// The state of a trial in its lifecycle.
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
|
pub enum TrialState {
|
|
/// The trial is currently running.
|
|
Running,
|
|
/// The trial completed successfully.
|
|
Complete,
|
|
/// The trial failed with an error.
|
|
Failed,
|
|
/// The trial was pruned (stopped early).
|
|
Pruned,
|
|
}
|