pub struct ScoreCalculationCountTermination<S: PlanningSolution> { /* private fields */ }Expand description
Terminates when a maximum number of score calculations is reached.
This termination condition requires a StatisticsCollector to be attached
to the SolverScope. If no collector is attached, it will never terminate.
§Example
use solverforge_solver::termination::ScoreCalculationCountTermination;
use solverforge_core::score::SimpleScore;
use solverforge_core::domain::PlanningSolution;
#[derive(Clone)]
struct MySolution;
impl PlanningSolution for MySolution {
type Score = SimpleScore;
fn score(&self) -> Option<Self::Score> { None }
fn set_score(&mut self, _: Option<Self::Score>) {}
}
// Terminate after 10,000 score calculations
let termination = ScoreCalculationCountTermination::<MySolution>::new(10_000);Implementations§
Trait Implementations§
Source§impl<S: Clone + PlanningSolution> Clone for ScoreCalculationCountTermination<S>
impl<S: Clone + PlanningSolution> Clone for ScoreCalculationCountTermination<S>
Source§fn clone(&self) -> ScoreCalculationCountTermination<S>
fn clone(&self) -> ScoreCalculationCountTermination<S>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<S: PlanningSolution> Debug for ScoreCalculationCountTermination<S>
impl<S: PlanningSolution> Debug for ScoreCalculationCountTermination<S>
Source§impl<S: PlanningSolution> Termination<S> for ScoreCalculationCountTermination<S>
impl<S: PlanningSolution> Termination<S> for ScoreCalculationCountTermination<S>
Source§fn is_terminated(&self, solver_scope: &SolverScope<S>) -> bool
fn is_terminated(&self, solver_scope: &SolverScope<S>) -> bool
Returns true if solving should terminate.
Auto Trait Implementations§
impl<S> Freeze for ScoreCalculationCountTermination<S>
impl<S> RefUnwindSafe for ScoreCalculationCountTermination<S>
impl<S> Send for ScoreCalculationCountTermination<S>
impl<S> Sync for ScoreCalculationCountTermination<S>
impl<S> Unpin for ScoreCalculationCountTermination<S>
impl<S> UnwindSafe for ScoreCalculationCountTermination<S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more