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