solverforge_solver/phase/mod.rs
1//! Solver phases for different solving strategies
2//!
3//! Phases are the main building blocks of solving:
4//! - ConstructionHeuristicPhase: Builds an initial solution
5//! - LocalSearchPhase: Improves an existing solution
6//! - ExhaustiveSearchPhase: Explores entire solution space
7//! - PartitionedSearchPhase: Parallel solving via partitioning
8//! - VndPhase: Variable Neighborhood Descent
9
10pub mod construction;
11pub mod exhaustive;
12pub mod localsearch;
13pub mod partitioned;
14pub mod vnd;
15
16use std::fmt::Debug;
17
18use solverforge_core::domain::PlanningSolution;
19
20use crate::scope::SolverScope;
21
22/// A phase of the solving process.
23///
24/// Phases are executed in sequence by the solver. Each phase has its own
25/// strategy for exploring or constructing solutions.
26pub trait Phase<S: PlanningSolution>: Send + Debug {
27 /// Executes this phase.
28 ///
29 /// The phase should modify the working solution in the solver scope
30 /// and update the best solution when improvements are found.
31 fn solve(&mut self, solver_scope: &mut SolverScope<S>);
32
33 /// Returns the name of this phase type.
34 fn phase_type_name(&self) -> &'static str;
35}