Skip to main content

CompetitiveSelectionHardExclusive

Struct CompetitiveSelectionHardExclusive 

Source
pub struct CompetitiveSelectionHardExclusive {
    pub num_seats: usize,
    pub num_candidates: usize,
    pub max_score: u64,
    pub allocation: Vec<Option<u64>>,
    pub scores: Vec<Vec<u64>>,
}
Expand description

CompetitiveSelectionHardExclusive carrier. Candidate indices are the executable WEnum order, so numeric order is exactly Pos order for deterministic ties. The carrier applies the cross-seat availability filter during argmax selection and globally invalidates the coupled assignment on a score update.

Fields§

§num_seats: usize

Number of independently allocated seats.

§num_candidates: usize

Number of candidates shared by every seat.

§max_score: u64

Inclusive score ceiling.

§allocation: Vec<Option<u64>>

Selected candidate by seat, encoded as u64.

§scores: Vec<Vec<u64>>

Candidate scores indexed by seat and candidate.

Implementations§

Source§

impl CompetitiveSelectionHardExclusive

Source

pub fn new( num_seats: usize, num_candidates: usize, max_score: u64, ) -> CompetitiveSelectionHardExclusive

Construct empty allocations and zero scores for every seat.

Source

pub fn score_at(&self, s: usize, c: usize) -> u64

Read one in-range seat-candidate score.

Source

pub fn candidate_available(&self, s: usize, c: usize) -> bool

Executable Available(s) membership check.

Source

pub fn has_available(&self, s: usize) -> bool

Executable guard for Available(s) /= {}.

Source

pub fn evaluate(&mut self, s: usize)

TLA+ Evaluate(s): atomically select the lowest-index argmax from the candidates not held by another seat.

Source

pub fn update_score(&mut self, s: usize, c: usize, v: u64)

TLA+ UpdateScore(s,c,v): update one score and invalidate every seat in the same commit because availability couples their optimality.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.