RandStrategyThresholdGridUniform

class poisson_approval.RandStrategyThresholdGridUniform(denominator_threshold, denominator_ratio_optimistic=None, profile=None, voting_rule=None, d_ranking_fixed_strategy=None)[source]

A random factory of threshold strategies (StrategyThreshold), uniform on a grid.

Parameters
  • denominator_threshold (int) – The grain of the grid for the utility thresholds.

  • denominator_ratio_optimistic (int, optional) – The grain of the grid for the ratios of optimistic voters.

  • profile (Profile, optional) – The attached profile.

  • voting_rule (str, optional) – The voting rule. Possible values are APPROVAL, PLURALITY and ANTI_PLURALITY. Default: the same voting rule as profile if a profile is specified, APPROVAL otherwise.

  • d_ranking_fixed_strategy (dict) – Key: ranking. Value: fixed strategy. Cf. examples below.

Examples

Basic usage:

>>> initialize_random_seeds()
>>> rand_strategy = RandStrategyThresholdGridUniform(denominator_threshold=7)
>>> strategy = rand_strategy()
>>> print(strategy)
<abc: utility-dependent (4/7), acb: a, bac: utility-dependent (5/7), bca: bc, cab: utility-dependent (3/7), cba: utility-dependent (3/7)>

Specify a profile:

>>> from poisson_approval import ProfileHistogram
>>> profile = ProfileHistogram({'abc': 0.75, 'bac': 0.25}, {'abc': [1], 'bac': [1]})
>>> rand_strategy = RandStrategyThresholdGridUniform(denominator_threshold=7, profile=profile)
>>> strategy = rand_strategy()
>>> print(strategy)
<abc: utility-dependent (3/7), bac: b> ==> a

Specify some fixed strategies:

>>> from fractions import Fraction
>>> rand_strategy = RandStrategyThresholdGridUniform(
...     denominator_threshold=7, denominator_ratio_optimistic=17,
...     d_ranking_fixed_strategy={'abc': 1, 'acb': 1, 'bac': 1, 'bca': (Fraction(1, 2), Fraction(1, 2))})
>>> print(rand_strategy())
<abc: a, acb: a, bac: b, bca: utility-dependent (1/2, 1/2), cab: utility-dependent (1/7, 4/17), cba: c>