Understanding Preferential Voting in Elections

Slide Note
Embed
Share

This content delves into the process of preferential voting in the Australian House of Representatives, outlining the steps involved in counting votes, redistributing preferences, and declaring a winner. It discusses the entities involved in the voting process, such as votes, candidates, and elections. Additionally, it explores the implementation of software development methodologies in solving election-related challenges.


Uploaded on Oct 06, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. ELECTION NIGHT CITS1001

  2. 2 Software development Understand the problem Understand the solution Structure the solution Implement the solution Test the solution And then go around again

  3. 3 Preferential voting in the Australian House of Reps An election has M candidates (we will use five candidates ABCDE in examples) N formal votes One winner, who needs N/2+1 votes to triumph Each voter returns a list of preferences for all candidates e.g. CAEDB But not CAE or CAEDA or CAXEDBor http://www.aec.gov.au/Voting/counting/hor_count.htm

  4. 4 The count Discard informal votes Allocate each formal vote to its first preference candidate Then in each round of the count If the leading candidate has enough votes, Declare them the winner Otherwise, Identify the candidate X with the fewest votes Redistribute each of X s votes to its highest-ranked surviving candidate Eliminate X

  5. 5 An example 100 votes: 12 informal, and 88 formal 88/2+1 votes = 45 required to win After the initial distribution A 11, B 14, C 29, D 25, E 9 No winner yet, so E is eliminated in Round 1 e.g. vote EABDC would be transferred to A A 17, B 16, C 29, D 26 No winner yet, so B is eliminated in Round 2 e.g. BEDAC goes to D and EBADC goes to A A 22, C 31, D 35 No winner yet, so A is eliminated in Round 3 C 47, D 41 C has enough votes to be declared the winner

  6. 6 What types of entities do we have? Votes Each vote is an expression of a voter s preferences Candidates Each candidate collects votes until they either win or are eliminated Elections Each election represents one constituency

  7. 7 The Vote class What is the state of a Vote? The list of preferences for surviving candidates What inputs does the constructor need? The voter s original list of preferences What accessor methods does Vote provide? Who the Vote is currently for: public char getFirstPreference(String losers) What other methods does Vote provide? A test for whether the Vote is formal: public boolean isFormal(String candidates)

  8. 8 The Candidate class What is the state of a Candidate? Their name, and their current pile of Votes What inputs does the constructor need? Their name What accessor methods does Candidate provide? getName(), getVotes(), getCount() What other methods does Candidate provide? A way of adding votes to the pile: public void addVotes(ArrayList<Vote> vs, String losers) A test for whether the candidate has won: public boolean isWinner(int noOfVotes)

  9. 9 The Election class What is the state of an Election? A pile of Votes for each surviving Candidate What inputs does the constructor need? Where to get the voting papers and the candidates names from What accessor methods does Election provide? None top-level class Although there could be a higher class with a collection of Elections What other methods does Election provide? The constructor could do the initial distribution A method to perform one round of the count Probably several private methods to structure the code

  10. 10 Implementation Class Diagram

  11. 11 Implementation questions Vote What type should the list of preferences be? If the candidates names are just one char each, a simple String will do Otherwise a String[] or an ArrayList<String>, depending on Should we delete the names of eliminated candidates, or just ignore them? We could ignore them when looking for the next preference We could delete them as needed We could delete all mentions of c at the time they are eliminated

  12. 12 Implementation questions Candidate What type should the pile of Votes be? For most candidates, the pile will grow during the count So an ArrayList<Vote> is best

  13. 13 Implementation questions Election What type should the pile of Candidates be? Again, an ArrayList<Candidate> is best Should we delete eliminated Candidates, or just ignore them? We can use multiple constructors for testing: public Election(String candidates, String votes) { } public Election(String votes) {this( candidates.txt , votes);} public Election() {this( votes.txt );}

  14. 14 Take a look at one solution Available on the lectures page Along with four sample elections [small, no contest, medium, large] [candidates, votes, results] SC.txt, SV.txt, SR.txt NC.txt, NV.txt, NR.txt MC.txt, MV.txt, MR.txt LC.txt, LV.txt, LR.txt

Related


More Related Content