votesim.models.pstrategic¶
Simulate strategic voters for point voter model
Class Summary¶
|
Function Summary¶
|
Construct all possible permutations of rank ballosts, including zeroing out candidates |
|
|
|
|
|
Generate every possible combination of ballots for single-mark ballot |
|
Generate random ranked ballots |
|
Generate random scored ballots |
Module Classes¶
StrategicElection¶
-
class
votesim.models.pstrategic.StrategicElection(election: votesim.models.spatial.base.Election, etype, seed=None)¶
Method/Attribute Summary¶
|
Initialize some election properties |
Retrieve unique voter coordinates |
|
list of int arrays shaped (a,) Index locations of each group |
|
Retrieve number of voters per unique voter group |
|
Generate combinations of potential ballots |
|
Number of random ballot combinations generated for this election |
|
Save honest ballots from the election here |
|
Save honest voter regrets for each voter group |
|
Retrieve voter regrets for each voter group |
|
Retrieve ballot indexes for a voter group |
|
|
Run random ballots. |
|
re-run election with new ballots |
|
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_votes¶
-
votesim.models.pstrategic.all_votes(cnum)¶ Generate every possible combination of ballots for single-mark ballot