votesim.models.pstrategic

Simulate strategic voters for point voter model

Class Summary

StrategicElection(election, etype[, seed])

Function Summary

all_ranks(cnum)

Construct all possible permutations of rank ballosts, including zeroing out candidates

all_score_minmax(cnum, scoremax)

all_scores(cnum, maxscore)

all_votes(cnum)

Generate every possible combination of ballots for single-mark ballot

random_ranks(cnum[, num, rs, allow_zeros])

Generate random ranked ballots

random_scores(cnum, scoremax[, num, rs])

Generate random scored ballots

Module Classes

StrategicElection

class votesim.models.pstrategic.StrategicElection(election: votesim.models.spatial.base.Election, etype, seed=None)

Method/Attribute Summary

StrategicElection.election_honest

StrategicElection.init(seed, etype)

Initialize some election properties

StrategicElection.voters_unique

Retrieve unique voter coordinates

StrategicElection.group_indices

list of int arrays shaped (a,) Index locations of each group

StrategicElection.voters_unique_num

Retrieve number of voters per unique voter group

StrategicElection.ballot_combos

Generate combinations of potential ballots

StrategicElection.ballot_combos_num

Number of random ballot combinations generated for this election

StrategicElection.honest_ballots

Save honest ballots from the election here

StrategicElection.honest_regrets

Save honest voter regrets for each voter group

StrategicElection.get_regrets()

Retrieve voter regrets for each voter group

StrategicElection.group_indices_strat(group)

Retrieve ballot indexes for a voter group

StrategicElection.run_rand([strat_ratios, …])

Run random ballots.

StrategicElection.run(ballots)

re-run election with new ballots

StrategicElection.run_iter(voter_groups, …)

Run strategic iteration of a single voter group.

StrategicElection.election_honest()
StrategicElection.init(seed, etype)

Initialize some election properties

StrategicElection.voters_unique()

Retrieve unique voter coordinates

StrategicElection.group_indices()
list of int arrays shaped (a,)

Index locations of each group

StrategicElection.voters_unique_num()

Retrieve number of voters per unique voter group

StrategicElection.ballot_combos()

Generate combinations of potential ballots

StrategicElection.ballot_combos_num()

Number of random ballot combinations generated for this election

StrategicElection.honest_ballots()

Save honest ballots from the election here

StrategicElection.honest_regrets()

Save honest voter regrets for each voter group

StrategicElection.get_regrets()

Retrieve voter regrets for each voter group

StrategicElection.group_indices_strat(group, strat_ratio=1)

Retrieve ballot indexes for a voter group

StrategicElection.run_rand(strat_ratios=1, num_elections=5000)

Run random ballots.

Find ballots that manage to result in a superior regret than an honest ballot.

StrategicElection.run(ballots)

re-run election with new ballots

StrategicElection.run_iter(voter_groups, strat_ratio)

Run strategic iteration of a single voter group.

Parameters
  • voter_group (int) – Index location of point voter group to strategize

  • strat_ratio (float) – Ratio of strategic voters in voter group from [0.0 to 1.0]

Module Functions

all_ranks

votesim.models.pstrategic.all_ranks(cnum)

Construct all possible permutations of rank ballosts, including zeroing out candidates

all_score_minmax

votesim.models.pstrategic.all_score_minmax(cnum, scoremax)

all_scores

votesim.models.pstrategic.all_scores(cnum, maxscore)

all_votes

votesim.models.pstrategic.all_votes(cnum)

Generate every possible combination of ballots for single-mark ballot

random_ranks

votesim.models.pstrategic.random_ranks(cnum, num=1000, rs=None, allow_zeros=True)

Generate random ranked ballots

random_scores

votesim.models.pstrategic.random_scores(cnum, scoremax, num=1000, rs=None)

Generate random scored ballots