socialchoicekit.elicitation_allocation module
- class socialchoicekit.elicitation_allocation.LambdaTSF(lambda_: int = 1, zero_indexed: bool = False)[source]
Bases:
object
Lambda-Threshold Step Function [ABFV2022] is a generalization of K-Acceptable Range Voting (Amanatidis et a. 2021) for allocation. (K-ARV is available in elicitation_voting) The algorithm partitions alternatives into lambda + 1 sets for evey agent to create a simulated value function using binary search.
Parameters
- lambda_int
The number of positions to query.
- zero_indexedbool
If True, the output of the social choice function will be zero-indexed. If False, the output will be one-indexed. One-indexed by default.
- get_simulated_cardinal_profile(profile: ~socialchoicekit.profile_utils.Profile, elicitor: ~socialchoicekit.elicitation_utils.Elicitor = <socialchoicekit.elicitation_utils.SynchronousStdInElicitor object>) → ndarray[source]
Obtain the simulated cardinal profile.
Parameters
- profile: Profile
A (N, M) array, where N is the number of agents and M is the number of items. The element at (i, j) indicates the voter’s preference for item j, where 1 is the most preferred item. If the agent finds an item unacceptable, the element would be np.nan.
- elicitor: Elicitor
The elicitor that will be used to query the agents. By default, SynchronousStdInElicitor is used.
Returns
- IncompleteValuationProfile
A (N, M) array where the element at (i, j) indicates the simulated welfare of alternative j for agent i.
- scf(profile: ~socialchoicekit.profile_utils.Profile, elicitor: ~socialchoicekit.elicitation_utils.Elicitor = <socialchoicekit.elicitation_utils.SynchronousStdInElicitor object>) → ndarray[source]
The social choice function for this voting rule. Returns one item allocated for each agent.
Parameters
- profile: Profile
A (N, M) array, where N is the number of agents and M is the number of items. The element at (i, j) indicates the voter’s preference for item j, where 1 is the most preferred item. If the agent finds an item unacceptable, the element would be np.nan.
- elicitor: Elicitor
The elicitor that will be used to query the agents. By default, SynchronousStdInElicitor is used.
Returns
- np.ndarray
A numpy array containing the allocated item for each agent or np.nan if the agent is unallocated.
- class socialchoicekit.elicitation_allocation.MatchTwoQueries(zero_indexed: bool = False)[source]
Bases:
object
Match-TwoQueries [ABFV2022a] achieves a distortion of O(root n) with two queries asked per agent. The first query is the agent’s favorite item. The second query is the agent’s cardinal value of the item they are assigned to in a ‘sufficiently representative assignment’ generated by the root n serial dictatorship routine.
Parameters
- zero_indexedbool
If True, the output of the social choice function will be zero-indexed. If False, the output will be one-indexed. One-indexed by default.
- get_simulated_cardinal_profile(profile: ~socialchoicekit.profile_utils.Profile, elicitor: ~socialchoicekit.elicitation_utils.Elicitor = <socialchoicekit.elicitation_utils.SynchronousStdInElicitor object>) → IncompleteValuationProfile[source]
Obtain the simulated cardinal profile.
Parameters
- profile: StrictProfile
A (N, M) array, where N is the number of agents and M is the number of items. The element at (i, j) indicates the voter’s preference for item j, where 1 is the most preferred item. If the agent finds an item unacceptable, the element would be np.nan.
- elicitor: Elicitor
The elicitor that will be used to query the agents.
Returns
- IncompleteValuationProfile
A (N, M) array where the element at (i, j) indicates the simulated welfare of item j for agent i.
- scf(profile: ~socialchoicekit.profile_utils.Profile, elicitor: ~socialchoicekit.elicitation_utils.Elicitor = <socialchoicekit.elicitation_utils.SynchronousStdInElicitor object>) → ndarray[source]
The social choice function for this voting rule. Returns one item allocated for each agent.
Parameters
- profile: StrictProfile
A (N, M) array, where N is the number of agents and M is the number of items. The element at (i, j) indicates the voter’s preference for item j, where 1 is the most preferred item. If the agent finds an item unacceptable, the element would be np.nan.
- elicitor: Elicitor
The elicitor that will be used to query the agents.
Returns
- np.ndarray
A numpy array containing the allocated item for each agent or np.nan if the agent is unallocated.