solverforge_solver/termination/
step_count.rs1use solverforge_core::domain::PlanningSolution;
4use solverforge_scoring::ScoreDirector;
5
6use super::Termination;
7use crate::scope::SolverScope;
8
9#[derive(Debug, Clone)]
19pub struct StepCountTermination {
20 limit: u64,
21}
22
23impl StepCountTermination {
24 pub fn new(limit: u64) -> Self {
25 Self { limit }
26 }
27}
28
29impl<S: PlanningSolution, D: ScoreDirector<S>> Termination<S, D> for StepCountTermination {
30 fn is_terminated(&self, solver_scope: &SolverScope<S, D>) -> bool {
31 solver_scope.total_step_count() >= self.limit
32 }
33}