skcriteria.tiebreaker module

Tie breaker estrategies for eliminating ties in rankings.

exception skcriteria.tiebreaker.TieUnresolvedWarning[source]

Bases: UserWarning

Warning for when ties remain unresolved after a tie-breaker is applied.

class skcriteria.tiebreaker.FallbackTieBreaker(dmaker, untier, *, force=True)[source]

Bases: SKCMethodABC

Decision maker that breaks ties in rankings using a fallback decision maker.

This class takes a primary decision maker that may produce tied rankings and uses a fallback decision maker to break those ties. If the fallback decision maker also produces ties and force=True, it uses the untied_rank_ property to ensure a complete ranking without ties.

Parameters:
  • dmaker (decision maker) – Primary decision maker that implements the evaluate() method. This decision maker may produce rankings with ties.

  • untier (decision maker) – Fallback decision maker used to break ties. It will be applied only to the tied alternatives from the primary decision maker.

  • force (bool, default True) – If True, when the fallback decision maker also produces ties, uses the untied_rank_ property to force a complete ranking without ties. If False, allows the final ranking to have ties if the fallback fails to break them completely.

Examples

>>> from skcriteria import mkdm
>>> from skcriteria.agg import simple
>>>
>>> # Create a decision matrix
>>> dm = mkdm([[1, 2], [3, 4]], [1, 1], ["max", "max"])
>>>
>>> # Primary decision maker
>>> primary = simple.WeightedSum()
>>>
>>> # Fallback decision maker for tie breaking
>>> fallback = simple.WeightedProduct()
>>>
>>> # Create fallback tie breaker
>>> tie_breaker = FallbackTieBreaker(primary, fallback)
>>>
>>> # Evaluate
>>> result = tie_breaker.evaluate(dm)
property dmaker

Primary decision maker.

Returns:

The primary decision maker instance used for initial ranking.

Return type:

decision maker

property untier

Fallback decision maker for breaking ties.

Returns:

The fallback decision maker instance used to break ties from the primary decision maker.

Return type:

decision maker

property force

Whether to force complete untying using untied_rank_.

Returns:

True if forced untying is enabled, False otherwise.

Return type:

bool

evaluate(dm)[source]

Evaluate the decision matrix using the fallback tie-breaking approach.

This method first applies the primary decision maker to get an initial ranking. If ties exist, it systematically applies the fallback decision maker to each group of tied alternatives to break the ties.

Parameters:

dm (DecisionMatrix) – Decision matrix to evaluate containing alternatives and criteria.

Returns:

result – Ranking result with ties broken using the fallback decision maker. If force=True and ties still remain, uses untied_rank_ to ensure a complete ranking without any ties.

Return type:

skcriteria.agg.RankResult

class skcriteria.agg.RankResult