srmp

This module implements the SRMP algorithm, as well as the preference elicitation algorithm and plot functions.

Implementation and naming conventions are taken from [OBM+22].

class ProfileWiseOutranking(performance_table, criteria_weights, profile)

Bases: Ranker

This class infers outranking relations related to a single profile.

The relation compares each criterion of each alternative values with the category profile (1 if better or equal, 0 otherwise), apply the criteria_weights as a weighted sum for each alternative and compare those scores.

Parameters
rank(**kwargs)

Construct an outranking matrix.

Returns

Return type

AdjacencyValueMatrix[DiscreteQuantitativeScale]

class SRMP(performance_table, criteria_weights, profiles, lexicographic_order)

Bases: Ranker

This class implements the SRMP algorithm.

Parameters
  • performance_table (PerformanceTable) –

  • criteria_weights (Dict[Any, float]) –

  • profiles (PerformanceTable) –

  • lexicographic_order (List[int]) – profile indices used sequentially to rank

construct()

Construct one outranking matrix per category profile.

Returns

Return type

List[AdjacencyValueMatrix[DiscreteQuantitativeScale]]

exploit(outranking_matrices, lexicographic_order=None)

Merge outranking matrices built by profiles in lexicographic order using SRMP exploitation method.

Parameters
Returns

the outranking total order as a ranking

Return type

CommensurableValues[DiscreteQuantitativeScale]

classmethod learn(performance_table, relations, max_profiles_number=None, profiles_number=None, lexicographic_order=None, inconsistencies=True, gamma=0.001, non_dictator=False, solver_args=None)

Learn a SRMP instance

Parameters
  • performance_table (PerformanceTable) –

  • relations (PreferenceStructure) –

  • max_profiles_number (Optional[int]) – highest number of reference profiles

  • profiles_number (Optional[int]) – number of reference profiles

  • lexicographic_order (Optional[List[int]]) – profile indices used sequentially to rank

  • inconsistencies (bool) – if True inconsistent comparisons will be taken into account

  • gamma (float) – value used for modeling strict inequalities

  • non_dictator (bool) – if True prevent dictator weights (> 0.5)

  • solver_args (Optional[Dict]) – extra arguments supplied to the solver

Returns

the inferred SRMP object

Raises

TypeError

  • if max_profiles_number, profiles_number and lexicographic_order are not specified

  • if two or more of max_profiles_number, profiles_number and lexicographic_order are specified at the same time

Return type

Optional[SRMP]

Note

One and only one of max_profiles_number, profiles_number and lexicographic_order must be specified

plot_concordance_index(performance_table, figsize=None, ncols=0, nrows=0, xlabels_tilted=False, **kwargs)

Visualize concordance index between alternatives and profiles

Parameters
  • performance_table (PerformanceTable) –

  • figsize (Optional[Tuple[float, float]]) – figure size in inches as a tuple (width, height)

  • xlabels_tilted (bool) – if True xlabels are tilted to better fit

  • ncols (int) –

  • nrows (int) –

classmethod plot_input_data(performance_table, srmp=None, criteria_weights=None, profiles=None, lexicographic_order=None, annotations=False, annotations_alpha=0.5, scales_boundaries=False, figsize=None, xticklabels_tilted=False, **kwargs)

Visualize input data.

For each criterion, the arrow indicates the preference direction. The criteria weights are displayed as a bar plot, and their values are written in parentheses

Parameters
  • performance_table (PerformanceTable) –

  • srmp (Optional[SRMP]) – a SRMP object (if given, overrides SRMP parameters)

  • criteria_weights (Optional[Dict[Any, float]]) –

  • profiles (Optional[PerformanceTable]) –

  • lexicographic_order (Optional[List[int]]) – profile indices used sequentially to rank

  • annotations (bool) – if True every point is annotated with its value

  • annotations_alpha (float) – annotations white box transparency

  • scales_boundaries (bool) – if True the criteria boundaries are the scales boundaries, else they are computed from the data

  • figsize (Optional[Tuple[float, float]]) – figure size in inches as a tuple (width, height)

  • xticklabels_tilted (bool) – if True xticklabels are tilted to better fit

plot_progressive_ranking(performance_table, figsize=None, **kwargs)

Visualize ranking progressively according to the lexicographic order

Parameters
  • performance_table (PerformanceTable) –

  • figsize (Optional[Tuple[float, float]]) – figure size in inches as a tuple (width, height)

rank(**kwargs)

Compute the SRMP algorithm

Returns

the outranking total order as a ranking

Return type

CommensurableValues[DiscreteQuantitativeScale]

property sub_srmp: List[ProfileWiseOutranking]

Return list of sub SRMP problems (one per category profile).

Returns

class SRMPLearner(performance_table, relations, max_profiles_number=None, profiles_number=None, lexicographic_order=None, inconsistencies=True, gamma=0.001, non_dictator=False, solver_args=None)

Bases: Learner[Optional[SRMP]]

This class gathers functions used to learn a SRMP model.

Parameters
  • performance_table (PerformanceTable) –

  • relations (PreferenceStructure) –

  • max_profiles_number (Union[int, None]) – highest number of reference profiles

  • profiles_number (Union[int, None]) – number of reference profiles

  • lexicographic_order (Union[List[int], None]) – profile indices used sequentially to rank

  • inconsistencies (bool) – if True inconsistent comparisons will be taken into account

  • gamma (float) – value used for modeling strict inequalities

  • non_dictator (bool) – if True prevent dictator weights (> 0.5)

  • solver_args (Union[Dict, None]) – extra arguments supplied to the solver

Raises

TypeError – if max_profiles_number, profiles_number and lexicographic_order are not specified

Note

If multiple arguments are supplied, only one will be used in the following priority: lexicographic_order, profiles_number then max_profiles_number

static compute_fitness(problem, nb_relations, inconsistencies=True)

Compute fitness of a SRMP solution.

Parameters
  • problem (LpProblem) – LP problem (solved)

  • nb_relations (int) – number of relations supplied for learning

  • inconsistencies (bool) – if True inconsistent comparisons will be taken into account

Return type

float

property fitness: float

Return fitness of last learned solution.

Returns

learn()

Learn and return SRMP solution (if existing).

Returns

Return type

Optional[SRMP]