Class VotingEngine
java.lang.Object
org.episteme.social.politics.VotingEngine
An engine for calculating election winners using various social choice algorithms.
Acts as a bridge between the data models (Ballot, Election) and
the algorithmic implementations in ElectoralSimulations.
Refactored to use the extensible
VotingMethod registry.- Since:
- 1.0
- Version:
- 2.1
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Method Summary
Modifier and TypeMethodDescriptioncalculatePluralityWinner(List<Ballot> ballots, String electionId) Calculates the winner using Plurality (First-Past-The-Post).resolve(List<Ballot> ballots, String electionId, VotingMethod method, int seats) Resolves an election using the specified method and list of cast ballots.
-
Method Details
-
resolve
public static List<String> resolve(List<Ballot> ballots, String electionId, VotingMethod method, int seats) Resolves an election using the specified method and list of cast ballots.- Parameters:
ballots- the cast ballotselectionId- the ID of the choice/election to processmethod- the voting algorithmseats- number of seats to fill- Returns:
- list of winners
-
calculatePluralityWinner
-