martinlackner / abcvoting

Python implementations of approval-based committee (multi-winner) voting rules
https://abcvoting.readthedocs.io/
MIT License
31 stars 15 forks source link

Weighted versions of properties #67

Closed DominikPeters closed 1 year ago

DominikPeters commented 1 year ago

The current versions of the properties are not right in cases where voters have weights (where for priceability, a voter's initial budget should be proportional to her weight, and for EJR and the like, the coalition needs to have total weight at least ell * total_weight/k). The algorithms should be generalized.

For writing tests, it would be useful to give the Profile class a method named something like convert_to_weighted(), which would combine several voters with the same approval set into a single voter with an appropriate weight. Then in tests, we can test for various instances that check_property(profile, committee) == check_property(profile.convert_to_weighted(), committee). (Alternatively one could keep things immutable and have a function that returns a copy of the profile with voters collapsed.)

martinlackner commented 1 year ago

Temporary fix: all relevant methods check whether the profile has unit weights (and throw a NotImplementedError otherwise)

martinlackner commented 1 year ago

I have added convert_to_weighted and convert_to_unit_weights methods for Profile.

martinlackner commented 1 year ago

Implemented by PR #68