Generate Utility Profiles¶
Generate Utility Profile - Uniform¶
- pref_voting.generate_utility_profiles.generate_utility_profile_uniform(num_candidates, num_voters, num_profiles=1)[source]¶
Generate a utility profile where each voter assigns a random number between 0 and 1 to each candidate.
- Parameters:
num_candidates (int) – The number of candidates.
num_voters (int) – The number of voters.
- Returns:
A utility profile.
- Return type:
Generate Utility Profile - Normal¶
- pref_voting.generate_utility_profiles.generate_utility_profile_normal(num_candidates, num_voters, std=0.1, normalize=None, num_profiles=1)[source]¶
Generate a utility profile where each voter assigns a random number drawn from a normal distribution with a randomly chosen mean (between 0 and 1) with standard deviation
std
to each candidate.- Parameters:
num_candidates (int) – The number of candidates.
num_voters (int) – The number of voters.
std (float) – The standard deviation of the normal distribution. The default is 0.1.
normalize (str) – The normalization method to use. The default is None.
- Returns:
A utility profile.
- Return type:
Generate Spatial Utility Profile¶
- pref_voting.generate_utility_profiles.generate_spatial_utility_profile(num_cands, num_voters, num_dims=2, utility_function='Quadratic', utility_function_param=None)[source]¶
Create a spatial utility profile using specified utility functions.
- Parameters:
num_cands (int) – The number of candidates.
num_voters (int) – The number of voters.
num_dims (int) – The number of dimensions. The default is 2.
utility_function (str) – The utility function to use. The default is “Linear”.
utility_function_param (float) – The parameter of the utility function. The default is None.
- Returns:
A spatial utility profile.
- Return type: