pub struct SharedOperatorTerminal<S, O, A, Scorers, Sc> { /* private fields */ }Expand description
Scoring terminal that owns one operator tree and scores it for several named constraints.
#[solverforge_constraints] appends terminals to one grouped node through
penalize/reward and
SharedOperatorBuilder::named. Every entity notification advances the
operator once, then each scorer in Scorers re-scores the changed rows, so
terminals share accumulator state but keep their own identity, weight and
weight slot. A adapts each terminal’s weight to the operator’s rows.
Implementations§
Sourcepub fn penalize<W>(
self,
weight: W,
) -> SharedOperatorBuilder<S, O, A, Scorers, W, Sc>
pub fn penalize<W>( self, weight: W, ) -> SharedOperatorBuilder<S, O, A, Scorers, W, Sc>
Starts another penalizing terminal over the same operator.
Sourcepub fn reward<W>(
self,
weight: W,
) -> SharedOperatorBuilder<S, O, A, Scorers, W, Sc>
pub fn reward<W>( self, weight: W, ) -> SharedOperatorBuilder<S, O, A, Scorers, W, Sc>
Starts another rewarding terminal over the same operator.
Sourcepub fn evaluate(&self, solution: &S) -> Scwhere
Scorers: OperatorScorerSet<S, O, Sc>,
pub fn evaluate(&self, solution: &S) -> Scwhere
Scorers: OperatorScorerSet<S, O, Sc>,
Sums every scorer over the operator’s current rows, without retained state.
Sourcepub fn initialize(&mut self, solution: &S) -> Scwhere
Scorers: OperatorScorerSet<S, O, Sc>,
pub fn initialize(&mut self, solution: &S) -> Scwhere
Scorers: OperatorScorerSet<S, O, Sc>,
Initializes the operator from solution and returns the summed score of
every scorer.
Sourcepub fn on_retract(
&mut self,
solution: &S,
index: usize,
descriptor: usize,
) -> Scwhere
Scorers: OperatorScorerSet<S, O, Sc>,
pub fn on_retract(
&mut self,
solution: &S,
index: usize,
descriptor: usize,
) -> Scwhere
Scorers: OperatorScorerSet<S, O, Sc>,
Retracts an entity from the operator and returns the summed score delta.
§Panics
Panics if the delta overflows.
Sourcepub fn on_insert(&mut self, solution: &S, index: usize, descriptor: usize) -> Scwhere
Scorers: OperatorScorerSet<S, O, Sc>,
pub fn on_insert(&mut self, solution: &S, index: usize, descriptor: usize) -> Scwhere
Scorers: OperatorScorerSet<S, O, Sc>,
Inserts an entity into the operator and returns the summed score delta.
§Panics
Panics if the delta overflows.
Sourcepub fn update_count(&self) -> usize
pub fn update_count(&self) -> usize
Number of notifications that changed at least one operator row.
Sourcepub fn changed_key_count(&self) -> usize
pub fn changed_key_count(&self) -> usize
Count of row-changing notifications; currently incremented together with
update_count.
Auto Trait Implementations§
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
Source§impl<S, Sc, C> ConstraintSet<S, Sc> for C
impl<S, Sc, C> ConstraintSet<S, Sc> for C
Source§fn evaluate_all(&self, solution: &S) -> Sc
fn evaluate_all(&self, solution: &S) -> Sc
Source§fn constraint_count(&self) -> usize
fn constraint_count(&self) -> usize
fn constraint_metadata_entries(&self) -> Vec<ConstraintMetadata<'_>>
Source§fn evaluate_each<'a>(&'a self, solution: &S) -> Vec<ConstraintResult<'a, Sc>>
fn evaluate_each<'a>(&'a self, solution: &S) -> Vec<ConstraintResult<'a, Sc>>
Source§fn evaluate_detailed<'a>(
&'a self,
solution: &S,
) -> Vec<ConstraintAnalysis<'a, Sc>>
fn evaluate_detailed<'a>( &'a self, solution: &S, ) -> Vec<ConstraintAnalysis<'a, Sc>>
Source§fn initialize_all(&mut self, solution: &S) -> Sc
fn initialize_all(&mut self, solution: &S) -> Sc
Source§fn on_insert_all(
&mut self,
solution: &S,
entity_index: usize,
descriptor_index: usize,
) -> Sc
fn on_insert_all( &mut self, solution: &S, entity_index: usize, descriptor_index: usize, ) -> Sc
Source§fn on_retract_all(
&mut self,
solution: &S,
entity_index: usize,
descriptor_index: usize,
) -> Sc
fn on_retract_all( &mut self, solution: &S, entity_index: usize, descriptor_index: usize, ) -> Sc
fn on_insert_all_overflowing( &mut self, solution: &S, entity_index: usize, descriptor_index: usize, ) -> (Sc, bool)
fn on_retract_all_overflowing( &mut self, solution: &S, entity_index: usize, descriptor_index: usize, ) -> (Sc, bool)
Source§fn constraint_weight_refs<'a>(&'a self, refs: &mut Vec<&'a ConstraintRef>)
fn constraint_weight_refs<'a>(&'a self, refs: &mut Vec<&'a ConstraintRef>)
Source§fn evaluate_all_weighted(&self, solution: &S, multipliers: &[u32]) -> Sc
fn evaluate_all_weighted(&self, solution: &S, multipliers: &[u32]) -> Sc
evaluate_all: multipliers holds one
multiplier per weight slot.Source§fn evaluate_each_weighted<'a>(
&'a self,
solution: &S,
multipliers: &[u32],
) -> Vec<ConstraintResult<'a, Sc>>
fn evaluate_each_weighted<'a>( &'a self, solution: &S, multipliers: &[u32], ) -> Vec<ConstraintResult<'a, Sc>>
evaluate_each: weighted scores, with each
result’s weight_multiplier set from its slot.Source§fn evaluate_detailed_weighted<'a>(
&'a self,
solution: &S,
multipliers: &[u32],
) -> Vec<ConstraintAnalysis<'a, Sc>>
fn evaluate_detailed_weighted<'a>( &'a self, solution: &S, multipliers: &[u32], ) -> Vec<ConstraintAnalysis<'a, Sc>>
evaluate_detailed: weighted totals and
match scores, with each analysis’s weight_multiplier set from its slot.Source§fn initialize_all_weighted(&mut self, solution: &S, multipliers: &[u32]) -> Sc
fn initialize_all_weighted(&mut self, solution: &S, multipliers: &[u32]) -> Sc
initialize_all.Source§fn on_insert_all_weighted(
&mut self,
solution: &S,
entity_index: usize,
descriptor_index: usize,
multipliers: &[u32],
) -> Sc
fn on_insert_all_weighted( &mut self, solution: &S, entity_index: usize, descriptor_index: usize, multipliers: &[u32], ) -> Sc
on_insert_all.Source§fn on_retract_all_weighted(
&mut self,
solution: &S,
entity_index: usize,
descriptor_index: usize,
multipliers: &[u32],
) -> Sc
fn on_retract_all_weighted( &mut self, solution: &S, entity_index: usize, descriptor_index: usize, multipliers: &[u32], ) -> Sc
on_retract_all.