Skip to main content

IncrementalConstraint

Trait IncrementalConstraint 

Source
pub trait IncrementalConstraint<S, Sc: Score>:
    IncrementalConstraintSealed
    + Send
    + Sync {
    // Required methods
    fn evaluate(&self, solution: &S) -> Sc;
    fn match_count(&self, solution: &S) -> usize;
    fn initialize(&mut self, solution: &S) -> Sc;
    fn on_insert(
        &mut self,
        solution: &S,
        entity_index: usize,
        descriptor_index: usize,
    ) -> Sc;
    fn on_retract(
        &mut self,
        solution: &S,
        entity_index: usize,
        descriptor_index: usize,
    ) -> Sc;
    fn reset(&mut self);
    fn constraint_ref(&self) -> &ConstraintRef;

    // Provided methods
    fn name(&self) -> &str { ... }
    fn is_hard(&self) -> bool { ... }
    fn get_matches<'a>(
        &'a self,
        _solution: &S,
    ) -> Vec<DetailedConstraintMatch<'a, Sc>> { ... }
    fn weight(&self) -> Sc { ... }
}

Required Methods§

Source

fn evaluate(&self, solution: &S) -> Sc

Source

fn match_count(&self, solution: &S) -> usize

Source

fn initialize(&mut self, solution: &S) -> Sc

Source

fn on_insert( &mut self, solution: &S, entity_index: usize, descriptor_index: usize, ) -> Sc

Source

fn on_retract( &mut self, solution: &S, entity_index: usize, descriptor_index: usize, ) -> Sc

Source

fn reset(&mut self)

Source

fn constraint_ref(&self) -> &ConstraintRef

Provided Methods§

Source

fn name(&self) -> &str

Source

fn is_hard(&self) -> bool

Source

fn get_matches<'a>( &'a self, _solution: &S, ) -> Vec<DetailedConstraintMatch<'a, Sc>>

Source

fn weight(&self) -> Sc

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<S, A, B, C, K, CK, EA, EB, KA, KB, Flatten, CKeyFn, ALookup, F, W, Sc> IncrementalConstraint<S, Sc> for FlattenedBiConstraint<S, A, B, C, K, CK, EA, EB, KA, KB, Flatten, CKeyFn, ALookup, F, W, Sc>
where S: Send + Sync + 'static, A: Clone + Send + Sync + 'static, B: Clone + Send + Sync + 'static, C: Clone + Send + Sync + 'static, K: Eq + Hash + Clone + Send + Sync, CK: Eq + Hash + Clone + Send + Sync, EA: CollectionExtract<S, Item = A>, EB: CollectionExtract<S, Item = B>, KA: Fn(&A) -> K + Send + Sync, KB: Fn(&B) -> K + Send + Sync, Flatten: Fn(&B) -> &[C] + Send + Sync, CKeyFn: Fn(&C) -> CK + Send + Sync, ALookup: Fn(&A) -> CK + Send + Sync, F: Fn(&S, &A, &C, usize, usize) -> bool + Send + Sync, W: Fn(&A, &C) -> Sc + Send + Sync, Sc: Score,

Source§

impl<S, A, B, JK, GK, EA, EB, KA, KB, F, GF, C, V, R, Acc, W, Sc> IncrementalConstraint<S, Sc> for CrossGroupedConstraint<S, A, B, JK, GK, EA, EB, KA, KB, F, GF, C, V, R, Acc, W, Sc>
where S: Send + Sync + 'static, A: Send + Sync + 'static, B: Send + Sync + 'static, JK: Eq + Hash + Send + Sync + 'static, GK: Eq + Hash + Send + Sync + 'static, EA: CollectionExtract<S, Item = A> + Send + Sync, EB: CollectionExtract<S, Item = B> + Send + Sync, KA: Fn(&A) -> JK + Send + Sync, KB: Fn(&B) -> JK + Send + Sync, F: Fn(&S, &A, &B, usize, usize) -> bool + Send + Sync, GF: Fn(&A, &B) -> GK + Send + Sync, C: for<'i> Collector<(&'i A, &'i B), Value = V, Result = R, Accumulator = Acc> + Send + Sync, V: Send + Sync + 'static, R: Send + Sync + 'static, Acc: Accumulator<V, R> + Send + Sync + 'static, W: Fn(&GK, &R) -> Sc + Send + Sync, Sc: Score + 'static,

Source§

impl<S, A, B, K, EA, EB, KA, KB, C, V, R, Acc, D, W, Sc> IncrementalConstraint<S, Sc> for ComplementedGroupConstraint<S, A, B, K, EA, EB, KA, KB, C, V, R, Acc, D, W, Sc>
where S: Send + Sync + 'static, A: Clone + Send + Sync + 'static, B: Clone + Send + Sync + 'static, K: Clone + Eq + Hash + Send + Sync, EA: CollectionExtract<S, Item = A>, EB: CollectionExtract<S, Item = B>, KA: Fn(&A) -> Option<K> + Send + Sync, KB: Fn(&B) -> K + Send + Sync, C: for<'i> Collector<&'i A, Value = V, Result = R, Accumulator = Acc> + Send + Sync, V: Send + Sync, R: Send + Sync, Acc: Accumulator<V, R> + Send + Sync, D: Fn(&B) -> R + Send + Sync, W: Fn(&K, &R) -> Sc + Send + Sync, Sc: Score,

Source§

impl<S, A, B, K, EA, EB, KA, KB, F, W, Sc> IncrementalConstraint<S, Sc> for IncrementalCrossBiConstraint<S, A, B, K, EA, EB, KA, KB, F, W, Sc>
where S: Send + Sync + 'static, A: Clone + Debug + Send + Sync + 'static, B: Clone + Debug + Send + Sync + 'static, K: Eq + Hash + Clone + Send + Sync, EA: CollectionExtract<S, Item = A> + Send + Sync, EB: CollectionExtract<S, Item = B> + Send + Sync, KA: Fn(&A) -> K + Send + Sync, KB: Fn(&B) -> K + Send + Sync, F: Fn(&S, &A, &B, usize, usize) -> bool + Send + Sync, W: CrossBiWeight<S, A, B, Sc>, Sc: Score,

Source§

impl<S, A, B, T, JK, GK, EA, EB, ET, KA, KB, F, GF, KT, C, V, R, Acc, D, W, Sc> IncrementalConstraint<S, Sc> for CrossComplementedGroupedConstraint<S, A, B, T, JK, GK, EA, EB, ET, KA, KB, F, GF, KT, C, V, R, Acc, D, W, Sc>
where S: Send + Sync + 'static, A: Send + Sync + 'static, B: Send + Sync + 'static, T: Send + Sync + 'static, JK: Eq + Hash + Send + Sync + 'static, GK: Eq + Hash + Send + Sync + 'static, EA: CollectionExtract<S, Item = A> + Send + Sync, EB: CollectionExtract<S, Item = B> + Send + Sync, ET: CollectionExtract<S, Item = T> + Send + Sync, KA: Fn(&A) -> JK + Send + Sync, KB: Fn(&B) -> JK + Send + Sync, F: Fn(&S, &A, &B, usize, usize) -> bool + Send + Sync, GF: Fn(&A, &B) -> GK + Send + Sync, KT: Fn(&T) -> GK + Send + Sync, C: for<'i> Collector<(&'i A, &'i B), Value = V, Result = R, Accumulator = Acc> + Send + Sync, V: Send + Sync + 'static, R: Send + Sync + 'static, Acc: Accumulator<V, R> + Send + Sync + 'static, D: Fn(&T) -> R + Send + Sync, W: Fn(&GK, &R) -> Sc + Send + Sync, Sc: Score + 'static,

Source§

impl<S, A, E, F, W, Sc> IncrementalConstraint<S, Sc> for IncrementalUniConstraint<S, A, E, F, W, Sc>
where S: Send + Sync + 'static, A: Clone + Debug + Send + Sync + 'static, E: CollectionExtract<S, Item = A>, F: Fn(&S, &A) -> bool + Send + Sync, W: Fn(&A) -> Sc + Send + Sync, Sc: Score,

Source§

impl<S, A, K, E, F, KF, Sc> IncrementalConstraint<S, Sc> for BalanceConstraint<S, A, K, E, F, KF, Sc>
where S: Send + Sync + 'static, A: Clone + Send + Sync + 'static, K: Clone + Eq + Hash + Send + Sync + 'static, E: CollectionExtract<S, Item = A>, F: UniFilter<S, A>, KF: Fn(&A) -> Option<K> + Send + Sync, Sc: Score + 'static,

Source§

impl<S, A, K, E, Fi, KF, C, V, R, Acc, W, Sc> IncrementalConstraint<S, Sc> for GroupedUniConstraint<S, A, K, E, Fi, KF, C, V, R, Acc, W, Sc>
where S: Send + Sync + 'static, A: Send + Sync + 'static, K: Eq + Hash + Send + Sync + 'static, E: CollectionExtract<S, Item = A>, Fi: UniFilter<S, A>, KF: Fn(&A) -> K + Send + Sync, C: for<'i> Collector<&'i A, Value = V, Result = R, Accumulator = Acc> + Send + Sync + 'static, V: Send + Sync + 'static, R: Send + Sync + 'static, Acc: Accumulator<V, R> + Send + Sync + 'static, W: Fn(&K, &R) -> Sc + Send + Sync, Sc: Score + 'static,

Source§

impl<S, A, K, E, KE, F, W, Sc> IncrementalConstraint<S, Sc> for IncrementalBiConstraint<S, A, K, E, KE, F, W, Sc>
where S: Send + Sync + 'static, A: Clone + Debug + Send + Sync + 'static, K: Eq + Hash + Clone + Send + Sync, E: CollectionExtract<S, Item = A>, KE: KeyExtract<S, A, K>, F: Fn(&S, &A, &A, usize, usize) -> bool + Send + Sync, W: Fn(&S, &[A], usize, usize) -> Sc + Send + Sync, Sc: Score,

Source§

impl<S, A, K, E, KE, F, W, Sc> IncrementalConstraint<S, Sc> for IncrementalPentaConstraint<S, A, K, E, KE, F, W, Sc>
where S: Send + Sync + 'static, A: Clone + Debug + Send + Sync + 'static, K: Eq + Hash + Clone + Send + Sync, E: CollectionExtract<S, Item = A>, KE: KeyExtract<S, A, K>, F: Fn(&S, &A, &A, &A, &A, &A, usize, usize, usize, usize, usize) -> bool + Send + Sync, W: Fn(&S, &[A], usize, usize, usize, usize, usize) -> Sc + Send + Sync, Sc: Score,

Source§

impl<S, A, K, E, KE, F, W, Sc> IncrementalConstraint<S, Sc> for IncrementalQuadConstraint<S, A, K, E, KE, F, W, Sc>
where S: Send + Sync + 'static, A: Clone + Debug + Send + Sync + 'static, K: Eq + Hash + Clone + Send + Sync, E: CollectionExtract<S, Item = A>, KE: KeyExtract<S, A, K>, F: Fn(&S, &A, &A, &A, &A, usize, usize, usize, usize) -> bool + Send + Sync, W: Fn(&S, &[A], usize, usize, usize, usize) -> Sc + Send + Sync, Sc: Score,

Source§

impl<S, A, K, E, KE, F, W, Sc> IncrementalConstraint<S, Sc> for IncrementalTriConstraint<S, A, K, E, KE, F, W, Sc>
where S: Send + Sync + 'static, A: Clone + Debug + Send + Sync + 'static, K: Eq + Hash + Clone + Send + Sync, E: CollectionExtract<S, Item = A>, KE: KeyExtract<S, A, K>, F: Fn(&S, &A, &A, &A, usize, usize, usize) -> bool + Send + Sync, W: Fn(&S, &[A], usize, usize, usize) -> Sc + Send + Sync, Sc: Score,

Source§

impl<S, A, P, B, K, EA, EP, KA, KB, FA, FP, Flatten, W, Sc> IncrementalConstraint<S, Sc> for IncrementalExistsConstraint<S, A, P, B, K, EA, EP, KA, KB, FA, FP, Flatten, W, Sc>
where S: Send + Sync + 'static, A: Clone + Send + Sync + 'static, P: Clone + Send + Sync + 'static, B: Clone + Send + Sync + 'static, K: Eq + Hash + Clone + Send + Sync + 'static, EA: CollectionExtract<S, Item = A> + Send + Sync, EP: CollectionExtract<S, Item = P> + Send + Sync, KA: Fn(&A) -> K + Send + Sync, KB: Fn(&B) -> K + Send + Sync, FA: UniFilter<S, A> + Send + Sync, FP: UniFilter<S, P> + Send + Sync, Flatten: FlattenExtract<P, Item = B> + Send + Sync, W: Fn(&A) -> Sc + Send + Sync, Sc: Score,

Source§

impl<S, Out, B, K, Src, EB, F, KA, KB, C, V, R, Acc, D, W, Sc> IncrementalConstraint<S, Sc> for ProjectedComplementedGroupedConstraint<S, Out, B, K, Src, EB, F, KA, KB, C, V, R, Acc, D, W, Sc>
where S: Send + Sync + 'static, Out: Send + Sync + 'static, B: Send + Sync + 'static, K: Eq + Hash + Send + Sync + 'static, Src: ProjectedSource<S, Out>, EB: CollectionExtract<S, Item = B>, F: UniFilter<S, Out>, KA: Fn(&Out) -> Option<K> + Send + Sync, KB: Fn(&B) -> K + Send + Sync, C: for<'i> Collector<&'i Out, Value = V, Result = R, Accumulator = Acc> + Send + Sync, V: Send + Sync + 'static, R: Send + Sync + 'static, Acc: Accumulator<V, R> + Send + Sync + 'static, D: Fn(&B) -> R + Send + Sync, W: Fn(&K, &R) -> Sc + Send + Sync, Sc: Score + 'static,

Source§

impl<S, Out, K, Src, F, KF, C, V, R, Acc, W, Sc> IncrementalConstraint<S, Sc> for ProjectedGroupedConstraint<S, Out, K, Src, F, KF, C, V, R, Acc, W, Sc>
where S: Send + Sync + 'static, Out: Send + Sync + 'static, K: Eq + Hash + Send + Sync + 'static, Src: ProjectedSource<S, Out>, F: UniFilter<S, Out>, KF: Fn(&Out) -> K + Send + Sync, C: for<'i> Collector<&'i Out, Value = V, Result = R, Accumulator = Acc> + Send + Sync + 'static, V: Send + Sync, R: Send + Sync, Acc: Accumulator<V, R> + Send + Sync, W: Fn(&K, &R) -> Sc + Send + Sync, Sc: Score + 'static,

Source§

impl<S, Out, K, Src, F, KF, PF, W, Sc> IncrementalConstraint<S, Sc> for ProjectedBiConstraint<S, Out, K, Src, F, KF, PF, W, Sc>
where S: Send + Sync + 'static, Out: Send + Sync + 'static, K: Eq + Hash + Send + Sync + 'static, Src: ProjectedSource<S, Out>, F: UniFilter<S, Out>, KF: Fn(&Out) -> K + Send + Sync, PF: BiFilter<S, Out, Out>, W: Fn(&Out, &Out) -> Sc + Send + Sync, Sc: Score + 'static,

Source§

impl<S, Out, Src, F, W, Sc> IncrementalConstraint<S, Sc> for ProjectedUniConstraint<S, Out, Src, F, W, Sc>
where S: Send + Sync + 'static, Out: Send + Sync + 'static, Src: ProjectedSource<S, Out>, F: UniFilter<S, Out>, W: Fn(&Out) -> Sc + Send + Sync, Sc: Score + 'static,