Liking cljdoc? Tell your friends :D

suffragium.pairwise


condorcetcljmultimethod

Returns the condorcet winner if one exists from either a seq of ballots or the result of a pairwise election. In the former case a pairwise election is performed. Returns nil if there is no condorcet winner.

Returns the condorcet winner if one exists from either a seq of ballots or
the result of a pairwise election. In the former case a pairwise election
is performed. Returns nil if there is no condorcet winner.
sourceraw docstring

copelandcljmultimethod

Perform a Copeland method election. Returns an array map of candidate keys and score values ordered from greatest to smallest score. The score of a candidate is its number of pairwise victories minus its number of pairwise defeats.

Perform a Copeland method election. Returns an array map of candidate keys
and score values ordered from greatest to smallest score. The score of a
candidate is its number of pairwise victories minus its number of pairwise
defeats.
sourceraw docstring

invertclj

(invert pg)

Takes the result of a pairwise election and reverses the direction of every edge. Useful if you want to find e.g. the condorcet loser.

Takes the result of a pairwise election and reverses the direction of every
edge. Useful if you want to find e.g. the condorcet loser.
sourceraw docstring

llull-copelandcljmultimethod

Perform a Copeland method election as originally proposed by Llull. Returns an array map of candidate keys and score values ordered from greatest to smallest score. The score of a candidate is its number of pairwise victories.

Perform a Copeland method election as originally proposed by Llull. Returns
an array map of candidate keys and score values ordered from greatest to
smallest score. The score of a candidate is its number of pairwise victories.
sourceraw docstring

pairwiseclj

(pairwise ballots)

Perform a pairwise election. Returns a loom weighted digraph. A pairwise election between two candidates is represented as a directed edge from the winner to the loser with a weight of the margin of victory. In the case of an edge to and from both candidates is created with a weight of 0.

Each ballot should contain a key for each candidate with an integer, lower value = more preferred. Candidates may be ranked as equally preferable.

Perform a pairwise election. Returns a loom weighted digraph. A pairwise
election between two candidates is represented as a directed edge from the
winner to the loser with a weight of the margin of victory. In the case of
an edge to and from both candidates is created with a weight of 0.

Each ballot should contain a key for each candidate with an integer, lower
value = more preferred. Candidates may be ranked as equally preferable.
sourceraw docstring

ranked-pairscljmultimethod

Perform an election using Tideman's ranked pairs method. Returns an array map of candidate keys and score values, ordered from greatest to smallest score. The score of a candidate is its Copeland score on the graph of locked-in candidate pairs.

Accepts two optional arguments:

:tbrc is a tie-breaking order of the candidates, used to construct a tie-breaking ranking of the pairs. Used when pairs have the same margin. Must be a vector containing all candidates from most-preferred to least preferred. The default order should be considered an implementation detail.

:tbrp specifies the method used to construct a TBRP from the TBRC. Should be one of :zavist, :cretney, :legrand, :schulze-i, or :schulze-ii. Alternatively can be a vector containing all pairs of candidates as sub-vectors (in which case :tbrc is ignored). Defaults to :schulze-ii.

Perform an election using Tideman's ranked pairs method. Returns an array
map of candidate keys and score values, ordered from greatest to smallest
score. The score of a candidate is its Copeland score on the graph of
locked-in candidate pairs.

Accepts two optional arguments:

:tbrc is a tie-breaking order of the candidates, used to construct a
tie-breaking ranking of the pairs. Used when pairs have the same margin.
Must be a vector containing all candidates from most-preferred to least
preferred. The default order should be considered an implementation detail.

:tbrp specifies the method used to construct a TBRP from the TBRC. Should be
one of :zavist, :cretney, :legrand, :schulze-i, or :schulze-ii. Alternatively
can be a vector containing all pairs of candidates as sub-vectors (in which
case :tbrc is ignored). Defaults to :schulze-ii.
sourceraw docstring

schulzecljmultimethod

Perform an election using the Schulze method method. Returns a sequence of candidates from highest to lowest ranking. Uses margins to measure the strength of links.

Accepts two optional arguments:

:tbrc is a tie-breaking order of the candidates, used to construct a tie-breaking ranking of the pairs. Used when pairs have the same strength beatpath. Must be a vector containing all candidates from most-preferred to least preferred. If not specified the TBRC is the order of candidates returned by sort.

:tbrp specifies the method used to construct a TBRP from the TBRC. Should be one of :zavist, :cretney, :legrand, :schulze-i, or :schulze-ii. Alternatively can be a vector containing all pairs of candidates as sub-vectors (in which case :tbrc is ignored). Defaults to :schulze-ii.

Perform an election using the Schulze method method. Returns a sequence of
candidates from highest to lowest ranking. Uses margins to measure the
strength of links.

Accepts two optional arguments:

:tbrc is a tie-breaking order of the candidates, used to construct a
tie-breaking ranking of the pairs. Used when pairs have the same strength
beatpath. Must be a vector containing all candidates from most-preferred to
least preferred. If not specified the TBRC is the order of candidates
returned by sort.

:tbrp specifies the method used to construct a TBRP from the TBRC. Should be
one of :zavist, :cretney, :legrand, :schulze-i, or :schulze-ii. Alternatively
can be a vector containing all pairs of candidates as sub-vectors (in which
case :tbrc is ignored). Defaults to :schulze-ii.
sourceraw docstring

schwartz-componentsclj

(schwartz-components pg)

Takes the results of a pairwise election and returns the Schwartz set components in no particular order.

Takes the results of a pairwise election and returns the Schwartz set
components in no particular order.
sourceraw docstring

schwartz-setclj

(schwartz-set pg)

Takes the results of a pairwise election and returns the Schwartz set.

Takes the results of a pairwise election and returns the Schwartz set.
sourceraw docstring

smith-setclj

(smith-set pg)

Takes the results of a pairwise election and returns the Smith set.

Takes the results of a pairwise election and returns the Smith set.
sourceraw docstring

weak-condorcetcljmultimethod

Returns the weak condorcet winners if any exist from either a seq of ballots or the result of a pairwise election. In the former case a pairwise election is performed. Returns #{} if there are no weak condorcet winners.

Returns the weak condorcet winners if any exist from either a seq of ballots
or the result of a pairwise election. In the former case a pairwise election
is performed. Returns #{} if there are no weak condorcet winners.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close