[][src]Struct wybr::methods::schulze::Schulze

pub struct Schulze<'a> { /* fields omitted */ }

Methods

impl<'a> Schulze<'a>[src]

A builder for the setup of Schulze method

See the module level documentation for more.

Default configuration can be generated with Schulze::new(&tally), where tally is a VoteMatrix object. Count is triggered by the run() method, which returns a solitary winner, or an error.

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.

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 run(&self) -> Result<GenericOutcome<'a>, ElectionError>[src]

Performs a Schulze (beat-path) election

Errors

  • NotEnoughCandidates, in case there is no candidates.
  • DegeneratedElectionGraph, in case when there is no winner in the final graph. Anyhow, such situation happens extremely rarely in practice, especially when indifferent votes are disallowed (this is what wybr does).

Notes

This is a basic version of the Schulze method, with no tie-breaking at all; there is also a more sophisticated version with forbidden links which fends off some ties, and even more complex one that uses a random ballot to break ties. Hence, it does not use pseudo-random generator at all.

Auto Trait Implementations

impl<'a> Send for Schulze<'a>

impl<'a> Sync for Schulze<'a>

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.