Tutorial 5: Initial seats¶
In this tutorial we will learn how to specify initial seats a candidate can receive before the allocation starts.
United States - Congressional Apportionment¶
435 seats will be distributed among the 50 states according to the census. Each state gains 1 initial seat, and the remaining seats will be allocated using the Huntington-Hill method.
1name: United States Congressional Apportionment 2000
2method: highest_averages
3method_params:
4 divisor_f: huntington_hill
5# 435 - 50
6seats: 385
7initial_seats: 1
8resume_allocation: true
9candidates:
10- name: Alabama
11 votes: 4461130
12- name: Alaska
13 votes: 628933
14- name: Arizona
15 votes: 5140683
16...
17- name: West Virginia
18 votes: 1813077
19- name: Wisconsin
20 votes: 5371210
21- name: Wyoming
22 votes: 495304
In lines 7 and 8 we specifiy that each candidate will start with 1 seat (initial_seats), and that the allocation process will take into account the seats already allocated to candidates (resume_allocation). Since this is the default, the previous schema is equivalent to:
1name: United States Congressional Apportionment 2000
2method: highest_averages
3method_params:
4 divisor_f: huntington_hill
5# 435 - 50
6seats: 385
7initial_seats: 1
8candidates:
9- name: Alabama
10 votes: 4461130
11- name: Alaska
12 votes: 628933
13- name: Arizona
14 votes: 5140683
15...
16- name: West Virginia
17 votes: 1813077
18- name: Wisconsin
19 votes: 5371210
20- name: Wyoming
21 votes: 495304
Spain - National Parliament - Districts apportionment¶
350 seats will be distributed among the 50 provinces and the 2 autonomous cities according to the census. Each autonomous city will receive 1 final seat. Each province will receive 2 initial seats, and the remaining seats will be allocated using the largest remainder method with a Hare quota ignoring the already allocated seats, allocating again from scratch.
First, create the schema for the autonomous cities:
1name: Circunscripciones Congreso de los Diputados - 2015 2type: group 3divisions: 4- name: Ciudades autónomas 5 method: noop 6 initial_seats: 1 7 candidates: 8 - name: Ceuta 9 votes: 84963 10 - name: Melilla 11 votes: 84509
The
noopmethod does not allocate any new seat, just returns its input with any initial seats assigned to candidates.If a different number of seats were assigned to each city, the property
min_seats:1name: Circunscripciones Congreso de los Diputados - 2015 2type: group 3divisions: 4- name: Ciudades autónomas 5 method: noop 6 # default value 7 initial_seats: min_seats 8 candidates: 9 - name: Ceuta 10 votes: 84963 11 min_seats: 2 12 - name: Melilla 13 votes: 84509 14 min_seats: 1
Then, add the schema for provinces:
1name: Circunscripciones Congreso de los Diputados - 2015 2type: group 3divisions: 4 5- name: Ciudades autónomas 6 method: noop 7 initial_seats: 1 8 candidates: 9 - name: Ceuta 10 votes: 84963 11 - name: Melilla 12 votes: 84509 13 14- name: Provincias 15 # 348 - 2*50 16 seats: 248 17 method: largest_remainder 18 method_params: 19 quota_f: hare 20 initial_seats: 2 21 resume_allocation: no 22 candidates: 23 - name: Alicante/Alacant 24 votes: 1868438 25 - name: Almería 26 votes: 701688 27 ... 28 - name: Valladolid 29 votes: 529157 30 - name: Zaragoza 31 votes: 960111
Each province will get 2 free seats:
1- name: Provincias 2 # 348 - 2*50 3 seats: 248 4 method: largest_remainder 5 method_params: 6 quota_f: hare 7 initial_seats: 2 8 resume_allocation: no
The remaining seats will allocated by Hare, ignoring the initial free seats (
resume_allocationis set tofalse):1- name: Provincias 2 # 348 - 2*50 3 seats: 248 4 method: largest_remainder 5 method_params: 6 quota_f: hare 7 initial_seats: 2 8 resume_allocation: no