basic
This module describes several procedures to check for basic procedures of PrefLib instances.
- is_approval(instance)
Checks whether the instance describes an approval profile. A profile is considered to represent approval ballots in two cases: All the orders are complete and consist of only two indifference classes; The orders are incomplete and consists of a single indifference class.
- Parameters:
instance (preflibtools.instances.preflibinstance.PreflibInstance) – The instance.
- Returns:
A boolean indicating whether the instance describes an approval profile.
- Return type:
bool
- is_complete(instance)
Checks whether the instance describes a profile of complete preferences.
- Parameters:
instance (preflibtools.instances.preflibinstance.PreflibInstance) – The instance.
- Returns:
A boolean indicating whether the instance describes a profile of complete preferences.
- Return type:
bool
- is_strict(instance)
Checks whether the instance describes a profile of strict preferences.
- Parameters:
instance (preflibtools.instances.preflibinstance.PreflibInstance) – The instance.
- Returns:
A boolean indicating whether the instance describes a profile of strict preferences.
- Return type:
bool
- largest_ballot(instance)
Returns the size of the largest ballot of the instance, i.e., the maximum number of alternatives appearing in an order.
- Parameters:
instance (preflibtools.instances.preflibinstance.PreflibInstance) – The instance.
- Returns:
The size of the largest ballot of the instance.
- Return type:
int
- largest_indif(instance)
Returns the size of the largest indifference class of any voter of the instance.
- Parameters:
instance (preflibtools.instances.preflibinstance.PreflibInstance) – The instance.
- Returns:
The size of the largest indifference class of the instance.
- Return type:
int
- max_num_indif(instance)
Returns the maximum number of indifference classes over the orders of the instance.
- Parameters:
instance (preflibtools.instances.preflibinstance.PreflibInstance) – The instance.
- Returns:
The maximum number of indifference classes of the instance.
- Return type:
int
- min_num_indif(instance)
Returns the minimum number of indifference classes over the orders of the instance.
- Parameters:
instance (preflibtools.instances.preflibinstance.PreflibInstance) – The instance.
- Returns:
The minimum number of indifference classes of the instance.
- Return type:
int
- num_alternatives(instance)
Returns the number of alternatives of the instance.
- Parameters:
instance (preflibtools.instances.preflibinstance.PreflibInstance) – The instance.
- Returns:
The number of alternatives of the instance.
- Return type:
int
- num_different_preferences(instance)
Returns the number of different orders of the instance.
- Parameters:
instance (preflibtools.instances.preflibinstance.PreflibInstance) – The instance.
- Returns:
The number of different orders of the instance.
- Return type:
int
- num_voters(instance)
Returns the number of voters .
- Parameters:
instance (preflibtools.instances.preflibinstance.PreflibInstance) – The instance.
- Returns:
The number of voters of the instance.
- Return type:
int
- smallest_ballot(instance)
Returns the size of the smallest ballot of the instance, i.e., the smallest number of alternatives appearing in an order.
- Parameters:
instance (preflibtools.instances.preflibinstance.PreflibInstance) – The instance.
- Returns:
The size of the smallest ballot of the instance.
- Return type:
int
- smallest_indif(instance)
Returns the size of the smallest indifference class of any voter of the instance.
- Parameters:
instance (preflibtools.instances.preflibinstance.PreflibInstance) – The instance.
- Returns:
The size of the smallest indifference class of the instance.
- Return type:
int