Skip to content

Add Quadratic voting#346

Open
spoole626 wants to merge 3 commits intomggg:feat/quadratic_votingfrom
spoole626:feat/quadratic_voting
Open

Add Quadratic voting#346
spoole626 wants to merge 3 commits intomggg:feat/quadratic_votingfrom
spoole626:feat/quadratic_voting

Conversation

@spoole626
Copy link
Copy Markdown

Implemented Quadratic voting (I'll add more descriptions later).

Copy link
Copy Markdown
Collaborator

@peterrrock2 peterrrock2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General comments

  • Prefer snake_case to camelCase for variables
  • Add tests (mimic test_rating.py)

MVP

  • Add tests for this election method and update the doc strings

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make the strong assumption that by the time a ScoreProfile is passed to this election method, the profile only contains scores and not credits.

  • Provide meaningful errors when a profile has a value over budget
  • Provide a cleaning function that converts a ScoreProfile that has credits to one that only has vote counts.
  • Provide a cleaning function to remove illegal ballots (ballots over budget)

converts those credits into votes.
"""
profile_copy = copy.deepcopy(profile)
for b in profile_copy.ballots:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change this to loop over the dataframe

@peterrrock2
Copy link
Copy Markdown
Collaborator

@spoole626 are you looking to get this merged in now or do you still want to work on this branch on your fork?

I did the necessary changes for quadratic.py (changed variable name to snake case, added appropriate description for helper function, made sure it satisfied typecheck).

For test_quadratic.py, it tests that Quadratic can run with credits and votes as scores (with single and multi-winner cases), it can do tiebreaks, and appropriate ValueErrors rise when needed.
@peterrrock2 peterrrock2 force-pushed the feat/quadratic_voting branch from fc71585 to 77da3f1 Compare March 14, 2026 05:54
@peterrrock2
Copy link
Copy Markdown
Collaborator

Note: I did a little cleanup on this PR to make sure it lined up with the target branch

@peterrrock2
Copy link
Copy Markdown
Collaborator

@spoole626 just checking in on the status of this. Let me know!

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.

3 participants