Feature: Add Fair Lotteries algorithms and GCR baseline#67
Feature: Add Fair Lotteries algorithms and GCR baseline#67dotandanino wants to merge 31 commits into
Conversation
Simon-Rey
left a comment
There was a problem hiding this comment.
Thank you very much for your submission. I have quickly looked at the formatting/writing up of the code. There are few comments of the things I would like you to fix before merging ;)
I have not checked the code itself, I assume that you have included sufficient tests to trust that the functions behave as expected.
There was a problem hiding this comment.
Please don't add your personal gitignore to the repositoruy
| """ | ||
| # Normalize numpy scalars (and similar) to plain Python ints/floats so that | ||
| # gmpy2.mpq and arithmetic operators accept them without errors. | ||
| normalized = [] |
There was a problem hiding this comment.
This is a sensitive function because it is used everywhere so we need to keep efficient. I'm not a huge fan of instantiating a list for that reason. Maybe do the a.item() directly in the ifs, without using a list.
| yield ApprovalProfile([ApprovalBallot(b) for b in p], instance=instance) | ||
|
|
||
|
|
||
| def approval_profile_from_matrix( |
There was a problem hiding this comment.
This could be generalised into a more useful function: By default instantiate a Cardinal ballot from a matrix with any weights. Add a 'to_approval' is true, then it returns an Approval Ballot for each weight that is above a parametrised threshold (default to 0).
That would make the function more useful overall.
| return True | ||
|
|
||
|
|
||
| def check_strong_UFS(self, N: list, C: list, cost: dict, B: float, ui: dict, p_vec: list) -> bool: |
There was a problem hiding this comment.
Could you add doc string to these functions.
Simon-Rey
left a comment
There was a problem hiding this comment.
Thanks for the improvements. I've made some new comments, we're almost there ;)
Description
This PR introduces the randomized algorithms from the AAAI-24 paper "Fair Lotteries for Participatory Budgeting," alongside a baseline implementation of the Greedy Cohesive Rule (GCR).
Files Added
Fair_Lotteries_for_Participatory_Budgeting.pypabutools/rules/gcr/(module files)pabutools/rules/lottery/(module files)tests/test_bw_algorithms.pyTesting