pub struct CompetitiveSelectionHard {
pub scores: Vec<u64>,
pub allocation: Option<usize>,
}Expand description
Hard competitive selection over one seat’s candidate scores.
Fields§
§scores: Vec<u64>Candidate scores by candidate index.
allocation: Option<usize>The winner’s index, or None for NULL (no allocation).
Implementations§
Source§impl CompetitiveSelectionHard
impl CompetitiveSelectionHard
Sourcepub fn new(num_candidates: usize) -> CompetitiveSelectionHard
pub fn new(num_candidates: usize) -> CompetitiveSelectionHard
Empty allocation, all scores 0 (TLA+ Init).
Sourcepub fn evaluate(&mut self)
pub fn evaluate(&mut self)
Evaluate: allocate the seat to the highest-scoring candidate (argmax). Realises the TLA+ Evaluate action; re-establishes WinnerOptimality.
Sourcepub fn update_score(&mut self, c: usize, v: u64)
pub fn update_score(&mut self, c: usize, v: u64)
Update one candidate’s score; invalidate the allocation (TLA+ UpdateScore).
Auto Trait Implementations§
impl Freeze for CompetitiveSelectionHard
impl RefUnwindSafe for CompetitiveSelectionHard
impl Send for CompetitiveSelectionHard
impl Sync for CompetitiveSelectionHard
impl Unpin for CompetitiveSelectionHard
impl UnsafeUnpin for CompetitiveSelectionHard
impl UnwindSafe for CompetitiveSelectionHard
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