compsoc.voting_rules package

Submodules

compsoc.voting_rules.borda module

Computes the Borda score for a candidate.

compsoc.voting_rules.borda.borda_rule(profile: Profile, candidate: int) int[source]

Calculates the Borda score for a candidate based on a profile.

Parameters:
  • profile (VotingProfile) – The voting profile.

  • candidate (int) – The base candidate for scoring.

Returns:

The Borda score for the candidate.

Return type:

int

compsoc.voting_rules.borda_gamma module

Variation on Borda, with a decay (gamma). Author: Shunsuke O.

compsoc.voting_rules.borda_gamma.get_borda_gamma(gamma: float = 0.5) Callable[[int], float][source]

Returns a callable function for the Borda gamma method with the specified gamma.

Parameters:

gamma (float, optional) – The decay factor for Borda gamma, defaults to 0.5.

Returns:

A callable function for the Borda gamma method.

Return type:

Callable[[int], float]

compsoc.voting_rules.borda_random module

Borda random

compsoc.voting_rules.borda_random.borda_random_gamma(profile: Profile, candidate: int) float[source]

Calculates the Borda random decay (gamma) score for a candidate based on a profile. Author: Shunsuke O.

Parameters:
  • profile (VotingProfile) – The voting profile.

  • candidate (int) – The base candidate for scoring.

Returns:

The Borda random gamma score for the candidate.

Return type:

float

compsoc.voting_rules.copeland module

Computes the Copeland score for a candidate.

compsoc.voting_rules.copeland.copeland_rule(profile: Profile, candidate: int) int[source]

Calculates the Copeland score for a candidate based on a profile.

Parameters:
  • profile (VotingProfile) – The voting profile.

  • candidate (int) – The base candidate for scoring.

Returns:

The Copeland score for the candidate.

Return type:

int

compsoc.voting_rules.dowdall module

Computes the Dowdall score for a candidate.

compsoc.voting_rules.dowdall.dowdall_rule(profile: Profile, candidate: int) int[source]

Calculates the Dowdall score for a candidate based on a profile.

Parameters:
  • profile (VotingProfile) – The voting profile.

  • candidate (int) – The base candidate for scoring.

Returns:

The Dowdall score for the candidate.

Return type:

int

compsoc.voting_rules.simpson module

Computes the Simpson score for a candidate.

compsoc.voting_rules.simpson.simpson_rule(profile: Profile, candidate: int) int[source]

Calculates the minimum pairwise score of a candidate using the Simpson rule.

Parameters:
  • profile (VotingProfile) – The voting profile.

  • candidate (int) – The base candidate for scoring.

Returns:

The minimum pairwise score of the candidate among all other candidates.

Return type:

int

Module contents

init