Skip to content

Add approval+runoff and blanket primary variants (issue #17)#44

Draft
endolith wants to merge 8 commits into
masterfrom
cursor/issue-17-blanket-primary-cf84
Draft

Add approval+runoff and blanket primary variants (issue #17)#44
endolith wants to merge 8 commits into
masterfrom
cursor/issue-17-blanket-primary-cf84

Conversation

@endolith
Copy link
Copy Markdown
Owner

@endolith endolith commented May 11, 2026

Latest: irv(..., n_winners=...) (renamed from n_survivors); docstrings use Unified Primary, Top Four vs Final Five, and spell out “general election using the contingent vote” where relevant; top_n_runoff cites contingent vote instead of supplementary vote; removed top_four_* / top_five_* one-line wrappers in favor of top_n_* with n=4 or 5.

Open in Web Open in Cursor 

@what-the-diff
Copy link
Copy Markdown

what-the-diff Bot commented May 11, 2026

PR Summary

  • Enhanced Election Methods
    We've added new capabilities related to election systems and blanket primaries. New functions include candidate elimination, tiebreaking, and others to provide advanced functionalities, which you can access in the newly developed blanket_primary.py file.
  • New File Creation
    The blanket_primary.py file is a fresh addition to our suite. It's equipped with implementations for two-round election systems and provides options for tiebreakers and determining the winner.
  • Updated Imports
    To make the election methods from blanket_primary.py readily useful in other parts of our application, we updated the __init__.py file to include these methods.
  • Testing for New Functionality
    We've ensured the correctness of the new election systems by creating the test_blanket_primary.py file. This file houses several test cases, aiding in validating the functionality of the new methods.
  • Test Method Adjustments
    The existing test_methods.py file has been refined. We've incorporated the new blanket primary methods to ensure that it covers them, thus validating correct error handling for tied elections and mismatched dimensions in approval ballots.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.15%. Comparing base (8a7213f) to head (c1023db).

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #44      +/-   ##
==========================================
+ Coverage   96.31%   97.15%   +0.83%     
==========================================
  Files          19       20       +1     
  Lines         489      632     +143     
==========================================
+ Hits          471      614     +143     
  Misses         18       18              
Flag Coverage Δ
no-numba 96.51% <100.00%> (+1.01%) ⬆️
numba 91.61% <100.00%> (+2.45%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

cursoragent and others added 8 commits May 15, 2026 00:37
Implement top-n plurality primaries with IRV, contingent runoff, or
Condorcet generals (Final Four/Five and table variants), IRV-to-slate
primaries with IRV or runoff generals, and approval primary with ranked
pairwise general (unified primary). Export from elsim.methods and extend
tests.

Co-authored-by: endolith <endolith@gmail.com>
Add unit tests for primary ties, Condorcet cycles, runoff/IRV None paths,
approval runoff edges, and IRV-to-slate primaries. Drop unreachable
approval validation and IRV primary inner break; duplicate checks lived
only in approval_runoff.

Co-authored-by: endolith <endolith@gmail.com>
Use Find-the-winner openings, borda-style ballot descriptions, full
tiebreaker and Returns wording, and explicit Wikipedia hyperlinks in RST
(including section fragments) instead of :wikipedia: roles where anchors
apply. Add Examples to irv_primary_top_n_* wrappers; expand module docstring.

Co-authored-by: endolith <endolith@gmail.com>
Cite IJCAI approval-with-runoff (DOI), Alaska Division of Elections RCV page,
FairVote Top Four PDF, St. Louis sample ballot PDF, Gehl & Porter HBS report,
Condorcet 1785 (BnF Gallica), Hare 1859 (Internet Archive), and Electoral
Reform Society supplementary vote page. Expand module docstring and wrapper
references to match.

Co-authored-by: endolith <endolith@gmail.com>
Remove prose about how references are organized; tighten Condorcet and
Final Five narrative lines.

Co-authored-by: endolith <endolith@gmail.com>
Fold sequential IRV slate selection into irv as a keyword-only parameter.
Remove irv_eliminate_to_n and irv_primary_top_n_irv (same outcome as irv).
Clarify top_n_runoff versus runoff on the full field; fix doc references and
remove St. Louis / mismatched Alaska prose.

Co-authored-by: endolith <endolith@gmail.com>
…ases

Rename irv(..., n_survivors=) to n_winners. Capitalize reform names in docs,
spell out contingent vote, add Unified Primary synonym to approval_runoff.
Remove top_four_* and top_five_* wrappers; use top_n_* with n=4 or 5.
Replace supplementary-vote ref with contingent vote for top_n_runoff.

Co-authored-by: endolith <endolith@gmail.com>
@endolith endolith force-pushed the cursor/issue-17-blanket-primary-cf84 branch from c1023db to 094a181 Compare May 15, 2026 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants