GeneratorProfileUniformFewRankings#

class svvamp.GeneratorProfileUniformFewRankings(n_v, n_c, n_max_rankings, sort_voters=False)[source]#

Profile generator drawing rankings uniformly in a random subset of all possible rankings.

Parameters:
  • n_v (int) – Number of voters.

  • n_c (int) – Number of candidates.

  • n_max_rankings (int) – Maximum number of rankings to draw. If n_max_rankings is greater than the total number of rankings, then all rankings are used.

  • sort_voters (bool) – This argument is passed to Profile.

Notes

First, a subset of n_max_rankings rankings is drawn uniformly at random from the set of all possible rankings. Then the ranking of each voter is drawn uniformly from this subset. The whole process is performed at each generation of a profile.

This class is especially useful to find examples and counter-examples that are simple to write, visualize and understand.

Examples

>>> generator = GeneratorProfileUniformFewRankings(n_v=10, n_c=3, n_max_rankings=4)
>>> profile = generator()
>>> profile.preferences_rk.shape
(10, 3)

Note: if n_max_rankings is at least as large as the total number of rankings, then this generator is equivalent to GeneratorProfileIc.

>>> generator = GeneratorProfileUniformFewRankings(n_v=10, n_c=3, n_max_rankings=6)
>>> profile = generator()
>>> profile.preferences_rk.shape
(10, 3)