RandTauVectorUniform

class poisson_approval.RandTauVectorUniform(ballots=None, d_ballot_fixed_share=None, **kwargs)[source]

A random factory of tau-vectors (TauVector) following the uniform distribution.

Parameters:
  • ballots (iterable, optional) – These ballots (e.g. 'a', 'ab') will have a variable share. Default: all allowed ballots.
  • d_ballot_fixed_share (dict, optional) – A dictionary. For each entry ballot: fixed_share, this ballot will have at least this fixed share. The total must be lower or equal to 1.
  • kwargs (keyword arguments) – These additional arguments will be passed directly to TauVector.

Examples

Basic usage:

>>> initialize_random_seeds()
>>> rand_tau = RandTauVectorUniform()
>>> tau = rand_tau()
>>> print(tau)
<a: 0.4236547993389047, ab: 0.12122838365799216, ac: 0.0039303209304278885, b: 0.05394987214431912, bc: 0.1124259903007756, c: 0.2848106336275805> ==> a

If the voting rule is not approval, only the relevant ballots are used:

>>> initialize_random_seeds()
>>> rand_tau = RandTauVectorUniform(voting_rule=PLURALITY)
>>> tau = rand_tau()
>>> print(tau)
<a: 0.5488135039273248, b: 0.16637586244509472, c: 0.2848106336275805> ==> a (Plurality)

Using the optional parameters:

>>> rand_tau = RandTauVectorUniform(
...     ballots=['b', 'bc'], d_ballot_fixed_share={'a': 0.5},
...     symbolic=True)
>>> tau = rand_tau()
>>> print(tau)
<a: 0.5, b: 0.30138168803582194, bc: 0.19861831196417806> ==> a, b

For more examples, cf. RandSimplexUniform.