Class ApportionmentMethods

java.lang.Object
org.episteme.social.politics.ApportionmentMethods

public final class ApportionmentMethods extends Object
Provides mathematical methods for electoral seat apportionment. Includes implementations of D'Hondt, Sainte-Laguë, Hamilton, and Huntington-Hill methods.
Since:
1.0
Version:
1.1
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Method Details

    • dHondt

      public static ApportionmentMethods.ApportionmentResult dHondt(List<ApportionmentMethods.Party> parties, int totalSeats)
      D'Hondt method - tends to favor larger parties.
      Parameters:
      parties - list of parties and their vote counts
      totalSeats - number of seats to allocate
      Returns:
      the apportionment result
    • sainteLague

      public static ApportionmentMethods.ApportionmentResult sainteLague(List<ApportionmentMethods.Party> parties, int totalSeats)
      Sainte-Laguë method - generally considered more proportional than D'Hondt.
      Parameters:
      parties - list of parties and their vote counts
      totalSeats - number of seats to allocate
      Returns:
      the apportionment result
    • hamilton

      public static ApportionmentMethods.ApportionmentResult hamilton(List<ApportionmentMethods.Party> parties, int totalSeats)
      Hamilton (Largest Remainder) method with Hare quota.
      Parameters:
      parties - list of parties and their vote counts
      totalSeats - number of seats to allocate
      Returns:
      the apportionment result
    • huntingtonHill

      public static ApportionmentMethods.ApportionmentResult huntingtonHill(List<ApportionmentMethods.Party> parties, int totalSeats, int minimumPerParty)
      Huntington-Hill method, used for the US House of Representatives.
      Parameters:
      parties - list of parties and their vote counts
      totalSeats - number of seats to allocate
      minimumPerParty - minimum seats guaranteed per party
      Returns:
      the apportionment result
    • compareAllMethods

      public static Map<String, ApportionmentMethods.ApportionmentResult> compareAllMethods(List<ApportionmentMethods.Party> parties, int totalSeats)
      Compares all implemented methods for a given set of data.
      Parameters:
      parties - list of parties and their vote counts
      totalSeats - number of seats to allocate
      Returns:
      map of method names to results
    • calculateGallagher

      public static double calculateGallagher(List<ApportionmentMethods.Party> parties, Map<String,Integer> seats, int totalSeats)
      Calculates the Gallagher index of disproportionality. Lower values indicate more proportional representation.
      Parameters:
      parties - parties involved
      seats - allocated seats
      totalSeats - total pool of seats
      Returns:
      the calculated index
    • effectiveThreshold

      public static Real effectiveThreshold(int totalSeats)
      Calculates the effective electoral threshold.
      Parameters:
      totalSeats - total seats in the district/election
      Returns:
      the threshold percentage as a Real number