use std::fmt::Debug;
use solverforge_core::domain::PlanningSolution;
use solverforge_scoring::Director;
use crate::scope::ProgressCallback;
use crate::scope::SolverScope;
use crate::stats::CandidateTracePhasePlan;
pub trait Phase<S: PlanningSolution, D: Director<S>, BestCb: ProgressCallback<S> = ()>:
Send + Debug
{
fn solve(&mut self, solver_scope: &mut SolverScope<'_, S, D, BestCb>);
fn phase_type_name(&self) -> &'static str;
fn on_solver_terminal(&mut self, _solver_scope: &mut SolverScope<'_, S, D, BestCb>) {}
fn candidate_trace_plan(&self) -> CandidateTracePhasePlan {
CandidateTracePhasePlan::opaque(self.phase_type_name())
}
}
impl<S: PlanningSolution, D: Director<S>, BestCb: ProgressCallback<S>> Phase<S, D, BestCb> for () {
fn solve(&mut self, _solver_scope: &mut SolverScope<'_, S, D, BestCb>) {
}
fn phase_type_name(&self) -> &'static str {
"NoOp"
}
fn candidate_trace_plan(&self) -> CandidateTracePhasePlan {
CandidateTracePhasePlan::known(
"solverforge.phase.no_op",
std::iter::empty::<(String, String)>(),
Vec::new(),
)
}
}