RandStrategyTwelveUniform
- class poisson_approval.RandStrategyTwelveUniform(profile=None, voting_rule=None, d_ranking_fixed_strategy=None)[source]
A random factory of twelve-type strategies (
StrategyTwelve
) following the uniform distribution.- Parameters
profile (Profile, optional) – The attached profile.
voting_rule (str, optional) – The voting rule. Possible values are
APPROVAL
,PLURALITY
andANTI_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 = RandStrategyTwelveUniform() >>> strategy = rand_strategy() >>> print(strategy) <abc: ab, acb: ac, bac: b, bca: bc, cab: utility-dependent, cba: bc>
Specify a profile:
>>> from poisson_approval import ProfileTwelve >>> profile = ProfileTwelve({'ab_c': 0.5, 'a_bc': 0.25, 'b_ac': 0.25}) >>> rand_strategy = RandStrategyTwelveUniform(profile=profile) >>> strategy = rand_strategy() >>> print(strategy) <abc: ab, bac: ab> ==> a, b
Specify some fixed strategies:
>>> rand_strategy = RandStrategyTwelveUniform( ... d_ranking_fixed_strategy={'abc': 'a', 'acb': 'a', 'bac': 'b', 'bca': UTILITY_DEPENDENT}) >>> print(rand_strategy()) <abc: a, acb: a, bac: b, bca: utility-dependent, cab: utility-dependent, cba: utility-dependent> >>> print(rand_strategy()) <abc: a, acb: a, bac: b, bca: utility-dependent, cab: utility-dependent, cba: bc> >>> print(rand_strategy()) <abc: a, acb: a, bac: b, bca: utility-dependent, cab: ac, cba: utility-dependent>