Skip to content

Fix timeout of irresolute sequential rules with many ties #72

Description

@martinlackner

The following program runs for a (very) long time:

from abcvoting.preferences import Profile
from abcvoting import abcrules

profile = Profile(num_cand=10)
profile.add_voter({0, 1, 2,3,4,5,6,7,8,9})
committeesize = 10
abcrules.compute_seqpav(profile, committeesize, resolute=False)

The problem is that with resolute=False all possible permutations of candidates are considered, to see if another committee can be found. This problem occurs in the implementation of all sequential rules.

The solution is to recognize that all candidates are equivalent and can be replaced with each other.
That is, all candidates are replaced by a placeholder (say A) and we store that the ballot consists of 10 copies of A. Only when outputting committees, we resolve the placeholders and replace them with all possible combinations of candidates (in case of the example, there is only one possibility).

Challenge: correctly use multi-sets instead of sets in all sequential algorithms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions