Rework and expand quorum calculations #4
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With this PR quorum calculations in
biproportional()
andpukelsheim()
are reworked. Instead of the parametersquorum_districts
andquorum_total
there's a new parameterquorum
which is best used with the newquorum_all()
/quorum_any()
functions. This closes #3.Instead of
You'd write:
That way the previously implicit assumption that both quorums must be reached to be elegible for seats must be explicitly stated with
quorum_all
. If it's enough to reach at least one quorum (e.g. either by district or total),quorum_any
should be used. If you don't want any quorum calculations to be done, the parameter can be ignored. In general, you can no longer set a quorum threshold of 0.With this approach it should also be easier to add new quorum calculations without modifying biproportional too much. It might be a bit convoluted (a function creating a list of functions as a function argument) but quorums can be applied in a number of combinations which are difficult to cover just by parameters alone.
Other changes:
biprop_quorum()
was removedreached_quorum_any_district()
andreached_quorum_total()
were addedreached_quorums()
allows a "lower-level" access to quorum calculationsquorum
parameter is now in third position inpukelsheim()
(instead of afternew_seats_col
), likebiproportional()