socialchoicekit.preflib_utils module
- socialchoicekit.preflib_utils.preflib_categorical_to_profile(instance: CategoricalInstance, tie_breaker: str = 'random') → IncompleteProfileWithTies[source]
Convert a Preflib categorical instance to the profile (Numpy matrix) format.
For details on Preflib categorical, see https://www.preflib.org/format
Parameters
- instance: CategoricalInstance
The Preflib categorical instance to convert. This is included in the preflibtools.instances module.
- tie_breaker{“random”, “first”, “accept”}
“random”: shuffle the tied items into a random order
“first”: sort the tied items in ascending order
“accept”: do not break ties
Returns
- IncompleteProfileWithTies
The profile (Numpy matrix) format of the Preflib categorical instance.
- socialchoicekit.preflib_utils.preflib_soc_to_profile(instance: OrdinalInstance) → StrictCompleteProfile[source]
Convert a Preflib SoC (Strict Orders - Complete List) to the profile (Numpy matrix) format.
For details on Preflib SoC, see https://www.preflib.org/format
Parameters
- soc: OrdinalInstance
The Preflib SoC to convert. This is included in the preflibtools.instances module. The data_type for this must be soc.
Returns
- StrictCompleteProfile
The profile (Numpy matrix) format of the Preflib SoC.
- socialchoicekit.preflib_utils.preflib_soi_to_profile(instance: OrdinalInstance) → StrictIncompleteProfile[source]
Convert a Preflib SoI (Strict Orders - Incomplete List) to the profile (Numpy matrix) format.
For details on Preflib SoC, see https://www.preflib.org/format
Parameters
- soi: OrdinalInstance
The Preflib SoI to convert. This is included in the preflibtools.instances module. The data_type for this must be soi.
Returns
- StrictIncompleteProfile
The profile (Numpy matrix) format of the Preflib SoC.
- socialchoicekit.preflib_utils.preflib_toc_to_profile(instance: OrdinalInstance, tie_breaker: str = 'random') → CompleteProfileWithTies[source]
Convert a Preflib ToC (Orders with Ties - Complete List) to the profile (Numpy matrix) format.
For details on Preflib ToC, see https://www.preflib.org/format
Parameters
- toc: OrdinalInstance
The Preflib ToC to convert. This is included in the preflibtools.instances module. The data_type for this must be toc.
- tie_breaker{“random”, “first”, “accept”}
“random”: shuffle the tied items into a random order
“first”: sort the tied items in ascending order
“accept”: do not break ties
Returns
- CompleteProfileWithTies
The profile (Numpy matrix) format of the Preflib ToC.
- socialchoicekit.preflib_utils.preflib_toi_to_profile(instance: OrdinalInstance, tie_breaker: str = 'random') → IncompleteProfileWithTies[source]
Convert a Preflib ToI (Orders with Ties - Incomplete List) to the profile (Numpy matrix) format.
For details on Preflib ToI, see https://www.preflib.org/format
Parameters
- toi: OrdinalInstance
The Preflib ToI to convert. This is included in the preflibtools.instances module. The data_type for this must be toi.
- tie_breaker{“random”, “first”, “accept”}
“random”: shuffle the tied items into a random order
“first”: sort the tied items in ascending order
“accept”: do not break ties
Returns
- IncompleteProfileWithTies
The profile (Numpy matrix) format of the Preflib ToI.