Skip to content

Validator

bluefoxicy edited this page May 1, 2019 · 1 revision

This software requires a human-readable ballot and test format.

The Ballot format will be something like so:

Readable Ballot Format [Version] [Ballot Type UUID]
CANDIDATES
[Id]|[Candidate UUID]|[Candidate Name]
[...]
END
LOCATIONS
[Id]|[Location UUID]|[Location Description]
END
BALLOTS [Location id]
[Count]: [Candidate ID][>|=][Candidate ID][...]
END

For example:

Readable Ballot Format 1 0000ffff-aaaa-bbbb-cccc-111122223333
CANDIDATES
Alex|23d951eb-0337-432a-b634-7029688c72f3|Alex Johnson
Billy|57645df8-73dc-4eb3-b0d5-a39cdb6e3bf5|Billy Schmidt
Chris|0ab2a697-6b7d-4179-9855-91d33d772800|Chris Hernandes
END
LOCATIONS
LakefrontHS|922f9c5f-5c85-4235-999d-b6756f3529a9|Lakefront High School, Center 1103
END
BALLOTS LakefrontHS
100: Alex>Chris>Billy
75: Chris>Alex>Billy
79: Billy>Chris>Alex
113: Billy>Alex>Chris
END

Assuming the GUID at the top indicates Ranked Ballots, this reads Ranked.

The Ballots format is actually processed by code supplied by the Ballot class, so the format there may vary for different ballot types.

The Test format will be JSON as such:

{
  "data": "Ballots.readableballots",
  "tabulator": 
  [
    {
      "class": "Meek-STV",
      "precision": [10,9,8,7,6,5,4]
    }
  ]
  "results":
  [
    {
      "round": 1,
      "quota": (float),
      "statistics":
      [
        {
          "candidate": "[Candidate Id]",
          "votes": (int),
          "excluded": (bool),
          "elected": (bool)
        }
      ]
    }
  ]
}

For example, above, any tabulator implementing Meek-STV with 4- to 10-decimal-place fixed precision should produce the given results. The results for Meek-STV will be an elimination order, with tie-break events occurring where multiple candidates are excluded in a single round. Each tabulator will need to implement a validation function which, given these expected results, returns false if the tabulator's results conflict.

Testing will involve implementing validation using test data such as the Tideman Data.

Tests may include resistance to freerider effects, such as to test Schulze STV against vanilla Meek-STV.

Clone this wiki locally