[−][src]Struct wybr::methods::minimax::Minimax
A builder for the setup of Minimax method
See the module level documentation for more.
Default configuration can be generated with Minimax::new(&tally)
, where tally
is a VoteMatrix
object.
Count is triggered by the run()
method, which returns a solitary winner, or an error.
Methods
impl<'a> Minimax<'a>
[src]
pub fn new(tally: &'a VoteMatrix) -> Self
[src]
Acquire reference to a vote matrix tally and initiate default configuration, which can be altered with other builder methods. The default configuration involves using Winning pair scoring and random seed of 21.
pub fn pair_score(&mut self, pair_score: PairScore) -> &mut Self
[src]
Alters the random seed potentially used by the election algorithm to break ties.
pub fn seed(&mut self, seed: u32) -> &mut Self
[src]
Alters the random seed potentially used by the election algorithm to break ties.
pub fn run(&self) -> Result<GenericOutcome<'a>, ElectionError>
[src]
Performs MiniMax election, return winner ID or an ElectionError
.
The method considers candidates worse defeats, that is the maximal score of their opponent in one-to-one comparisons, established using given scoring mode. The winner is the candidate with smallest such worse defeat; in case of a tie, it is broken at random based on seed.
Errors
NotEnoughCandidates
, in case there is no candidates.ArithmeticOverflow
, when u64 count in tally is larger than i64 max.
Notes
This is not a good method, yet very simple.
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,