- class svvamp.GeneratorProfileUnanimous(n_v, n_c=None, ranking=None, sort_voters=False)[source]#
Profile generator with identical voters.
- Parameters:
n_v (int) – Number of voters.
n_c (int, optional) – Number of candidates.
ranking (List, optional) – This will be the ranking of all the voters. If not specified, it is drawn at random each time a profile is generated.
sort_voters (bool) – This argument is passed to
Profile
(but since voters are identical, there is no advantage in using True).
Notes
All the voters have the given ranking.
Examples
>>> generator = GeneratorProfileUnanimous(n_v=10, n_c=3) >>> profile = generator() >>> profile.preferences_rk.shape (10, 3)
>>> generator = GeneratorProfileUnanimous(n_v=3, ranking=[0, 1, 2]) >>> profile = generator() >>> profile.preferences_rk array([[0, 1, 2], [0, 1, 2], [0, 1, 2]])
>>> generator = GeneratorProfileUnanimous(n_v=3) Traceback (most recent call last): ValueError: GeneratorProfileUnanimous: You should specify `n_c` or `ranking`.