Skip to main content

solverforge_solver/manager/
mod.rs

1//! High-level solver management with zero-erasure API.
2//!
3//! # Zero-Erasure Design
4//!
5//! All types flow through generics - no Box, Arc, or dyn anywhere.
6//! Runtime configuration from TOML/YAML is handled by the macro layer
7//! which generates concrete types at compile time.
8
9mod builder;
10mod config;
11mod phase_factory;
12mod solution_manager;
13mod solver_factory;
14mod solver_manager;
15
16#[cfg(test)]
17mod builder_tests;
18#[cfg(test)]
19mod mod_tests;
20#[cfg(test)]
21mod mod_tests_integration;
22
23pub use builder::{SolverBuildError, SolverFactoryBuilder};
24pub use config::{ConstructionType, LocalSearchType, PhaseConfig};
25pub use phase_factory::{
26    ConstructionPhaseFactory, KOptPhase, KOptPhaseBuilder, ListCheapestInsertionPhase,
27    ListConstructionPhase, ListConstructionPhaseBuilder, ListRegretInsertionPhase,
28    LocalSearchPhaseFactory,
29};
30pub use solution_manager::{Analyzable, ConstraintAnalysis, ScoreAnalysis, SolutionManager};
31pub use solver_factory::{solver_factory_builder, SolverFactory};
32pub use solver_manager::{Solvable, SolverManager, SolverStatus};
33
34use solverforge_core::domain::PlanningSolution;
35use solverforge_scoring::ScoreDirector;
36
37use crate::phase::Phase;
38
39/// Factory trait for creating phases with zero type erasure.
40///
41/// Returns a concrete phase type via associated type, preserving
42/// full type information through the pipeline.
43///
44/// # Type Parameters
45///
46/// * `S` - The solution type
47/// * `D` - The score director type
48pub trait PhaseFactory<S, D>: Send + Sync
49where
50    S: PlanningSolution,
51    D: ScoreDirector<S>,
52{
53    /// The concrete phase type produced by this factory.
54    type Phase: Phase<S, D>;
55
56    /// Creates a new phase instance with concrete type.
57    fn create(&self) -> Self::Phase;
58}