Axiomatic module#
Justified Representation#
- is_cohesive_for_l(profile: AbstractTrichotomousProfile, max_size_selection: int, l: int, group: AbstractTrichotomousProfile) bool [source]#
Tests whether the given set of voters is cohesive for level l as defined in Definition 1 of
Proportionality in Thumbs Up and Down Voting
(Kraiczy, Papasotiropoulos, Pierczyński and Skowron, 2025).- Parameters:
profile (AbstractTrichotomousProfile) – The trichotomous profile.
max_size_selection (int) – The maximum number of alternatives that can be selected.
l (int) – The required representation level.
group (AbstractTrichotomousProfile) – The subset of voters being tested for cohesion.
- Returns:
True if the group is l-cohesive, False otherwise.
- Return type:
bool
- all_cohesive_groups(profile: AbstractTrichotomousProfile, max_size_selection: int, min_l: int = 1, max_l: int = None, test_cohesive_func: Callable = None) Iterator[tuple[AbstractTrichotomousProfile, int]] [source]#
Yields all voter groups that are cohesive for some level l. Yields both the group and the level l.
- Parameters:
profile (AbstractTrichotomousProfile) – The trichotomous profile.
max_size_selection (int) – The maximum number of alternatives that can be selected.
min_l (int, optional) – The minimum level of cohesion to test for. Defaults to 1.
max_l (int, optional) – The maximum level of cohesion to test for. Defaults to the number of alternatives.
test_cohesive_func (Callable, optional) – The function used to test cohesion. Defaults to is_cohesive_for_l.
- Yields:
tuple of (AbstractTrichotomousProfile, int) – A cohesive group and the smallest level l for which it is cohesive.
- is_base_ejr_brute_force(profile: AbstractTrichotomousProfile, max_size_selection: int, selection: Selection) bool [source]#
Determines whether a selection satisfies Base Extended Justified Representation (Base EJR) as defined in Definition 1 of
Proportionality in Thumbs Up and Down Voting
(Kraiczy, Papasotiropoulos, Pierczyński and Skowron, 2025). Looks for every cohesive group and verifies that they are all satisfied.- Parameters:
profile (AbstractTrichotomousProfile) – The trichotomous profile.
max_size_selection (int) – The maximum number of alternatives that can be selected.
selection (Selection) – The selection of alternatives to test.
- Returns:
True if Base EJR is satisfied, False otherwise.
- Return type:
bool
- is_base_ejr(profile: AbstractTrichotomousProfile, max_size_selection: int, selection: Selection) bool [source]#
Determines whether a selection satisfies Base Extended Justified Representation (Base EJR) as defined in Definition 1 of
Proportionality in Thumbs Up and Down Voting
(Kraiczy, Papasotiropoulos, Pierczyński and Skowron, 2025). Makes used of the close formula provided in Lemma 1 of the same paper.- Parameters:
profile (AbstractTrichotomousProfile) – The trichotomous profile.
max_size_selection (int) – The maximum number of alternatives that can be selected.
selection (Selection) – The selection of alternatives to test.
- Returns:
True if Base EJR is satisfied, False otherwise.
- Return type:
bool
- is_base_pjr(profile: AbstractTrichotomousProfile, max_size_selection: int, selection: Selection) bool [source]#
Determines whether a selection satisfies Base Proportional Justified Representation (Base PJR) as defined in Definition 2 of
Proportionality in Thumbs Up and Down Voting
(Kraiczy, Papasotiropoulos, Pierczyński and Skowron, 2025).- Parameters:
profile (AbstractTrichotomousProfile) – The trichotomous profile.
max_size_selection (int) – The maximum number of alternatives that can be selected.
selection (Selection) – The selection of alternatives to test.
- Returns:
True if Base PJR is satisfied, False otherwise.
- Return type:
bool
- is_positively_cohesive_for_l(profile: AbstractTrichotomousProfile, max_size_selection: int, l: int, group: AbstractTrichotomousProfile) bool [source]#
Tests whether a group of voters is positively cohesive for level l.
- Parameters:
profile (AbstractTrichotomousProfile) – The trichotomous profile.
max_size_selection (int) – The maximum number of alternatives that can be selected.
l (int) – The required representation level.
group (AbstractTrichotomousProfile) – The subset of voters being tested.
- Returns:
True if the group is positively cohesive, False otherwise.
- Return type:
bool
- is_positive_ejr(profile: AbstractTrichotomousProfile, max_size_selection: int, selection: Selection) bool [source]#
Determines whether a selection satisfies Extended Justified Positive Representation (EJPR).
- Parameters:
profile (AbstractTrichotomousProfile) – The trichotomous profile.
max_size_selection (int) – The maximum number of alternatives that can be selected.
selection (Selection) – The selection of alternatives to test.
- Returns:
True if EJPR is satisfied, False otherwise.
- Return type:
bool
- is_negatively_cohesive_for_l_t(profile: AbstractTrichotomousProfile, max_size_selection: int, l: int, alt_set: Iterable[Alternative], group: AbstractTrichotomousProfile) bool [source]#
Tests whether a group of voters is l-T negatively cohesive for a given set of alternatives.
- Parameters:
profile (AbstractTrichotomousProfile) – The trichotomous profile.
max_size_selection (int) – The maximum number of alternatives that can be selected.
l (int) – The level of allowed violation.
alt_set (Iterable[Alternative]) – The set of alternatives in question.
group (AbstractTrichotomousProfile) – The subset of voters being tested.
- Returns:
True if the group is l-T negatively cohesive, False otherwise.
- Return type:
bool
- is_group_veto(profile: AbstractTrichotomousProfile, max_size_selection: int, selection: Selection) bool [source]#
Determines whether a selection satisfies the group veto property.
- Parameters:
profile (AbstractTrichotomousProfile) – The trichotomous profile.
max_size_selection (int) – The maximum number of alternatives that can be selected.
selection (Selection) – The selection of alternatives to test.
- Returns:
True if the group veto condition is satisfied, False otherwise.
- Return type:
bool