Skip to content

Incorrect Surplus Transfer Method Violates Scottish STV Rules #18

@ohcedar

Description

@ohcedar

Issue Description:
The current implementation does not follow the legally mandated procedure for transferring surplus votes according to the
Scottish STV rules. The algorithm uses a "whole ballot weighting" method, which is incorrect.

Current Behavior:
When a candidate is elected with a surplus, the writeInVoteWeight function calculates a transfer value and multiplies the
entire weight of every ballot that voted for that candidate by this value. This incorrectly diminishes the value of the
vote that was used to elect the winner.

Expected Behavior:
According to Rule 48 of the Scottish Local Government Elections Order 2007, the surplus transfer must be handled using a
parcel-based system. The process should be:

  1. Calculate the surplus value for the elected candidate.
  2. Calculate a transfer value: (Surplus / Total Votes for Candidate), truncated to 5 decimal places.
  3. For each ballot paper voting for the winner, a new fractional vote (a "parcel") is created for the next available
    preference. The value of this new parcel is (Original Ballot Weight * Transfer Value), again truncated to 5 decimal
    places.
  4. The portion of the vote that was used to elect the candidate remains with that candidate and is not transferred.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions