Tutorial 2: Adding electoral thresholds and other restrictions¶
In this tutorial we will learn how to aplly certain rules to exclude or include candidates.
Spain - Local elections¶
In the Spanish local elections, seats are allocated by the highest averages method with d'Hondt divisors, the same way we did in Spain - European Parliament. But a restriction is added to the system:
Candidates with a tallied vote that does not reach the 5% of all the valid vote are excluded from the apportionment.
In 2011, 27 seats were allocated to the city of Algeciras.
1name: Elecciones Municipales - Algeciras 2011
2method: highest_averages
3method_params:
4 divisor_f: dhondt
5exclude: valid_votes < 5%
6seats: 27
7candidates:
8- name: "? en blanco"
9 votes: 1444
10- name: "! nulo"
11 votes: 744
12- name: "PP"
13 votes: 22463
14- name: "PSOE de Andalucía"
15 votes: 8104
16- name: "IULV-CA"
17 votes: 5282
18- name: "PA - EP-And"
19 votes: 3356
20- name: "UPyD"
21 votes: 1339
22- name: "JAU"
23 votes: 620
24- name: "CDL"
25 votes: 362
26- name: "PDMA"
27 votes: 258
28- name: "AuN"
29 votes: 129
In line 5 we implemented the required threshold using an exclusion restriction. Let’s see it with more details:
5exclude: valid_votes < 5%
Two fields can be used to define restrictions:
exclude: candidates that comply with the restriction will be added to the exclusion list, so the allocator will not give seats to them.include: candidates that comply with the restriction will be added to the inclusion list, so the allocator will take them into account even if the are in the exclusion list too.
We used the attribute valid_votes because it is specified that the blank vote should be taken into account in addition to the vote to candidates.
Denmark - Folketing elections (first step)¶
It can happen that the list that a party presents is shorter (a small party or an independent candidate) than the total number of seats allocated to the district.
Danish electoral system is complex, so for now we will only look at how a single district works:
Candidates are elected using the highest averages method with d'Hondt divisors. Both parties and independent candidates can contend to the election. Independent candidates can only win 1 seat each.
Let’s design the schema for the Copenhaguen district in 2011 (15 seats):
1name: København
2seats: 15
3candidates:
4- name: "? blank"
5 votes: 2588
6- name: "! void"
7 votes: 1870
8# parties
9- {name: Socialdemokratiet, votes: 80705}
10- {name: Radikale Venstre, votes: 71264}
11- {name: Konservative Folkeparti, votes: 23262}
12- {name: SF - Socialistisk Folkeparti, votes: 52870}
13- {name: Liberal Alliance, votes: 24882}
14- {name: Kristendemokraterne, votes: 1185}
15- {name: Dansk Folkeparti, votes: 35887}
16- {name: Venstre, votes: 64914}
17- {name: Enhedslisten, votes: 70831}
18# independent candidates
19- {max_seats: 1, name: Tom Gillesberg, votes: 123}
20- {max_seats: 1, name: Klaus Trier Tuxen, votes: 161}
21- {max_seats: 1, name: Morten Versner, votes: 10}
22- {max_seats: 1, name: Mads Vestergaard, votes: 54}
23- {max_seats: 1, name: John Erik Wagner, votes: 43}
24- {max_seats: 1, name: Per Zimmermann, votes: 14}
When a candidate wins the quantity in max_seats, the allocator will ignore that candidate from that moment when assigning the remaining seats.
Life of Brian - Limiting the number of seats an alliance can win¶
Seats to alliances can also be limited. Let’s imagine a situation:
1st Century, Judea. The region is occupied by the Roman Empire, and prophet Brian starts his teachings. The independentist movement is vibrant, but most of the independentist fighters disagree in the way they should fight. In order to reach some common ground, 10 of them are elected for the creation of a basic statute. In order to avoid concentration of power, only half of the members of a faction can be elected.
The People’s Front of Judea is composed by only 4 members, therefore only 2 members can join the committee.
1name: Statue for Judea Liberation Fronts
2seats: 10
3method: limited_voting
4alliances:
5- { name: "The People's Front of Judea", max_seats: 2 }
6- { name: "Judea People's Front", max_seats: 8 }
7- { name: "Judean People's Front", max_seats: 6 }
8candidates:
9- { name: "Reg", alliance: "The People's Front of Judea" }
10- { name: "Francis", alliance: "The People's Front of Judea" }
11- { name: "Loretta", alliance: "The People's Front of Judea" }
12- { name: "Judith Iscariot", alliance: "The People's Front of Judea" }
13...
The alliances field allows to define max_seats to alliances.
The line 5 limits the number of seats that the alliance The People’s Front of Judea can win to 2. If 2 of their members are elected, the allocation system will add the non-elected members to the exclusion list.
5- { name: "The People's Front of Judea", max_seats: 2 }