promethee
This module implements Promethee algorithms in a heavily modular way.
Todo
Implement commented-out classes
- class GeneralizedCriteria(generalized_criterions)
Bases:
object
This class defines generalized criteria.
- Parameters
generalized_criterions (Mapping[Any, GeneralizedCriterion]) –
- __call__(x: Series, y: Series, /, *, preference_directions: Optional[Mapping[Any, Optional[PreferenceDirection]]] = None) Series
- __call__(x: DataFrame, /, *, preference_directions: Optional[Mapping[Any, Optional[PreferenceDirection]]] = None) DataFrame
- __call__(x: Values[QuantitativeScale], y: Values[QuantitativeScale], /) Values[QuantitativeScale]
- __call__(x: PerformanceTable[QuantitativeScale], /) PartialValueMatrix[QuantitativeScale]
Apply generalized criteria to inputs.
- Parameters
x – first input
y – second input (only if comparing one pair of alternative values)
preference_directions –
- Raises
TypeError – if arguments don’t match one of the implemented apply_ method
- Returns
result
- within_in_scales(data)
Check potential input is inside input scales.
- Parameters
data (Union[Series, Values[QuantitativeScale], DataFrame, PerformanceTable[QuantitativeScale]]) –
- Returns
True
if data is withinscales
- Return type
bool
- class GeneralizedCriterion(preference_function, scale=None)
Bases:
object
This class defines a generalized criterion which is used to compare alternatives according to a criterion.
Implementations naming conventions are taken from [FGE05].
- Parameters
preference_function (NumericFunction) – function applied on alternative values difference
scale (Union[QuantitativeScale, None]) – input scale (inferred from input if not provided)
Note
Alternatives values comparisons are transformed so that a positive difference implies the first alternative is preferred.
preference_function
is then applied on this difference.Warning
scale
is only declarative, and not use for checking/transforming data.- __call__(x: float, y: float, /, *, preference_direction: Optional[PreferenceDirection] = None) float
- __call__(x: Series, /, *, preference_direction: Optional[PreferenceDirection] = None) DataFrame
- __call__(x: CommensurableValues[QuantitativeScale], /) AdjacencyValueMatrix[QuantitativeScale]
Apply generalized criterion to inputs.
- Parameters
x – first input
y – second input (only if comparing two criterion values)
preference_direction –
- Raises
TypeError – if arguments don’t match one of the implemented apply_ method
- Returns
result
- within_scale(data)
Check potential input is inside input scale.
- Parameters
data (Union[float, Series, CommensurableValues[QuantitativeScale]]) –
- Returns
True
if data is withinscale
- Return type
bool
- class Promethee(performance_table, preference_functions, generalized_criteria_aggregator)
Bases:
ABC
This class describes the common interface for all Promethee algorithms.
- Parameters
performance_table (PerformanceTable[QuantitativeScale]) –
preference_functions (Mapping[Any, NumericFunction]) –
generalized_criteria_aggregator (Aggregator[QuantitativeScale, QuantitativeScale]) –
- Raises
TypeError – if performance_table is not ordinal
- abstract flows(preferences, **kwargs)
Compute flows.
- Parameters
preferences (AdjacencyValueMatrix[QuantitativeScale]) –
- Returns
flows
- Return type
Series
- partial_preferences()
Compute partial preferences for each alternatives’ pair.
- Parameters
performance_table –
- Returns
partial preferences
- Return type
- preferences(partial_preferences)
Compute preferences for each alternatives’ pair from partial preferences.
- Parameters
partial_preferences (PartialValueMatrix[QuantitativeScale]) –
- Returns
preferences
- Return type
- criteria_flows(partial_preferences)
Returns the criteria flows.
- Parameters
partial_preferences (PartialValueMatrix[QuantitativeScale]) –
- Returns
- Return type
DataFrame
- negative_flows(preferences, profiles=None)
Compute negative flows.
- Parameters
preferences (AdjacencyValueMatrix[QuantitativeScale]) –
profiles (Optional[List]) –
- Returns
computed negative flows
- Return type
Series
Note
if profiles is not
None
, it will returns profiles vs alternatives negative flows
- net_outranking_flows(preferences)
Compute net outranking flows.
- Parameters
preferences (AdjacencyValueMatrix[QuantitativeScale]) –
- Returns
net outranking flows
- Return type
Series
- positive_flows(preferences, profiles=None)
Compute positive flows.
- Parameters
preferences (AdjacencyValueMatrix[QuantitativeScale]) –
profiles (Optional[List]) –
- Returns
computed positive flows
- Return type
Series
Note
if profiles is not
None
, it will returns alternatives vs profiles positive flows