Module: Apportion::Algorithm::EqualProportions
- Defined in:
- lib/apportion/algorithm/equal_proportions.rb
Overview
Selects the next recipient
Constant Summary collapse
- BIG_FIXNUM =
2 ** 30
Class Method Summary collapse
-
.next_recipient(weights, portions) ⇒ Symbol
Selects the next recipient by sorting the equal proportions rank-index of the recipients.
Class Method Details
.next_recipient(weights, portions) ⇒ Symbol
Selects the next recipient by sorting the equal proportions rank-index of the recipients
see Balinski, M. and H. Young, The Quota Method of Apportionment, Amer. Math. Monthly 82 (1975) 701-730.
21 22 23 |
# File 'lib/apportion/algorithm/equal_proportions.rb', line 21 def next_recipient(weights, portions) weights.max_by { |k, v| recipient_rank(v, portions[k]) }[0] end |