pymcdm.methods package

pymcdm.methods.aras

class pymcdm.methods.aras.ARAS(normalization_function=<function sum_normalization>)

Bases: MCDA_method

Additive Ratio ASsessment (ARAS) method.

The ARAS method is based on a utility function value that determines the complex relative efficiency of a feasible alternative [1]. This relationship is directly proportional to the relative effect of the values and weights of the main criteria.

Read more in the User Guide.

Parameters

normalization_function (callable) – Function which should be used to normalize matrix columns. It should match signature foo(x, cost), where x is a vector which should be normalized and cost is a bool variable which says if x is a cost or profit criterion.

References

1

Zavadskas, E. K., & Turskis, Z. (2010). A new additive ratio assessment (ARAS) method in multicriteria decision‐making. Technological and economic development of economy, 16(2), 159-172.

Examples

>>> from pymcdm.methods import ARAS
>>> import numpy as np
>>> body = ARAS()
>>> matrix = np.array([[4.64, 3.00, 3.00, 3.00, 2.88, 3.63],
...                    [4.00, 4.00, 4.64, 3.56, 3.63, 5.00],
...                    [3.30, 4.31, 3.30, 4.00, 3.30, 4.00],
...                    [2.62, 5.00, 4.22, 4.31, 5.00, 5.00]])
>>> weights = np.array([0.28, 0.25, 0.19, 0.15, 0.08, 0.04])
>>> types = np.array([1, 1, 1, 1, 1, 1])
>>> [round(preference, 2) for preference in body(matrix, weights, types)]
[0.74, 0.86, 0.78, 0.86]
__call__(matrix, weights, types, *args, **kwargs)

Rank alternatives from decision matrix matrix, with criteria weights weights and criteria types types.

Parameters
  • matrix (ndarray) – Decision matrix / alternatives data. Alternatives are in rows and Criteria are in columns.

  • weights (ndarray) – Criteria weights. Sum of the weights should be 1. (e.g. sum(weights) == 1)

  • types (ndarray) – Array with definitions of criteria types: 1 if criteria is profit and -1 if criteria is cost for each criteria in matrix.

  • *args (is necessary for methods which reqiure some additional data.) –

  • **kwargs (is necessary for methods which reqiure some additional data.) –

Returns

Preference values for alternatives. Better alternatives have higher values.

Return type

ndarray

pymcdm.methods.cocoso

class pymcdm.methods.cocoso.COCOSO(normalization_function=<function minmax_normalization>)

Bases: MCDA_method

COmbined COmpromise SOlution (COCOSO) method.

The COCOSO method is based on an integrated model of simple additive weighting and exponentially weighted product [1].

Read more in the User Guide.

Parameters

normalization_function (callable) – Function which should be used to normalize matrix columns. It should match signature foo(x, cost), where x is a vector which should be normalized and cost is a bool variable which says if x is a cost or profit criterion.

References

1

Yazdani, M., Zarate, P., Zavadskas, E. K., & Turskis, Z. (2019). A Combined Compromise Solution (CoCoSo) method for multi-criteria decision-making problems. Management Decision.

Examples

>>> from pymcdm.methods import COCOSO
>>> import numpy as np
>>> body = COCOSO()
>>> matrix = np.array([[60, 0.4, 2540, 500, 990],
...                    [6.35, 0.15, 1016, 3000, 1041],
...                    [6.8, 0.1, 1727.2, 1500, 1676],
...                    [10, 0.2, 1000, 2000, 965],
...                    [2.5, 0.1, 560, 500, 915],
...                    [4.5, 0.08, 1016, 350, 508],
...                    [3, 0.1, 1778, 1000, 920]])
>>> weights = np.array([0.036, 0.192, 0.326, 0.326, 0.12])
>>> types = np.array([1, -1, 1, 1, 1])
>>> [round(preference, 3) for preference in body(matrix, weights, types)]
[2.041, 2.788, 2.882, 2.416, 1.299, 1.443, 2.519]
__call__(matrix, weights, types, l=0.5, *args, **kwargs)

Rank alternatives from decision matrix matrix, with criteria weights weights and criteria types types.

Parameters
  • matrix (ndarray) – Decision matrix / alternatives data. Alternatives are in rows and Criteria are in columns.

  • weights (ndarray) – Criteria weights. Sum of the weights should be 1. (e.g. sum(weights) == 1)

  • types (ndarray) – Array with definitions of criteria types: 1 if criteria is profit and -1 if criteria is cost for each criteria in matrix.

  • l (value) – The value of balanced compromise. It must be from the interval [0, 1].

  • *args (is necessary for methods which reqiure some additional data.) –

  • **kwargs (is necessary for methods which reqiure some additional data.) –

Returns

Preference values for alternatives. Better alternatives have higher values.

Return type

ndarray

pymcdm.methods.codas

class pymcdm.methods.codas.CODAS(normalization_function=<function linear_normalization>)

Bases: MCDA_method

COmbinative Distance-based ASsessment (CODAS) method.

The CODAS method is based on an approach based on Euclidean distance and Taxicab from the negative ideal solution [1].

Read more in the User Guide.

Parameters

normalization_function (callable) – Function which should be used to normalize matrix columns. It should match signature foo(x, cost), where x is a vector which should be normalized and cost is a bool variable which says if x is a cost or profit criterion.

References

1

Keshavarz Ghorabaee, M., Zavadskas, E. K., Turskis, Z., & Antucheviciene, J. (2016). A new combinative distance-based assessment (CODAS) method for multi-criteria decision-making. Economic Computation & Economic Cybernetics Studies & Research, 50(3).

Examples

>>> from pymcdm.methods import CODAS
>>> import numpy as np
>>> body = CODAS()
>>> matrix = np.array([[45, 3600, 45, 0.9],
...                    [25, 3800, 60, 0.8],
...                    [23, 3100, 35, 0.9],
...                    [14, 3400, 50, 0.7],
...                    [15, 3300, 40, 0.8],
...                    [28, 3000, 30, 0.6]])
>>> weights = np.array([0.2857, 0.3036, 0.2321, 0.1786])
>>> types = np.array([1, -1, 1, 1])
>>> [round(preference, 4) for preference in body(matrix, weights, types)]
[1.3914, 0.3411, -0.2170, -0.5381, -0.7292, -0.2481]
__call__(matrix, weights, types, *args, **kwargs)

Rank alternatives from decision matrix matrix, with criteria weights weights and criteria types types.

Parameters
  • matrix (ndarray) – Decision matrix / alternatives data. Alternatives are in rows and Criteria are in columns.

  • weights (ndarray) – Criteria weights. Sum of the weights should be 1. (e.g. sum(weights) == 1)

  • types (ndarray) – Array with definitions of criteria types: 1 if criteria is profit and -1 if criteria is cost for each criteria in matrix.

  • *args (is necessary for methods which reqiure some additional data.) –

  • **kwargs (is necessary for methods which reqiure some additional data.) –

Returns

Preference values for alternatives. Better alternatives have higher values.

Return type

ndarray

pymcdm.methods.comet

class pymcdm.methods.comet.COMET(cvalues, rate_function=None, expert_function=None)

Bases: MCDA_method

Characteristic Objects METhod (COMET).

COMET is a method based on characteristic objects on the basis of which preference of the deicision variants is calculated [1]. Due to this dependence the method is resistant to the phenomenon of ranking reversal paradox.

Read more in the User Guide.

Parameters
  • cvalues (ndarray or list of lists) – Each row represent characteristic values for each criteria.

  • rate_function (callable) –

    Function to rate CO without creating MEJ. Matrix with CO as rows is passed as an argument Vector with rates should be retrurn. Better CO should has higher values.

    Signature of the function should be as followed:

    rate_function(co: np.array) -> np.array

  • expert_function (callable) –

    Function which would be used to compare CO on MEJ creation. It should fulfill this requirments:

    CO to compare are passed as arguments (a, b) if a is better then b return 1, if b is better then a return 0, if this CO are equaly prefered return 0.5

  • provided (If both ranking_method and expert_function are) –

  • preffered. (expert_function is) –

References

1

Sałabun, W. (2015). The Characteristic Objects Method: A New Distance‐based Approach to Multicriteria Decision‐making Problems. Journal of Multi‐Criteria Decision Analysis, 22(1-2), 37-50.

Examples

>>> from pymcdm.methods import COMET
>>> import numpy as np
>>> matrix = np.array([[64, 128, 2.9, 4.3, 3.2, 280, 495, 24763, 3990],
...                    [28, 56, 3.1, 3.8, 3.8, 255, 417, 12975, 2999],
...                    [8, 16, 3.5, 5.3, 4.8, 125, 636, 5725, 539],
...                    [12, 24, 3.7, 4.8, 4.5, 105, 637, 8468, 549],
...                    [10, 20, 3.7, 5.3, 4.9, 125, 539, 6399, 499],
...                    [8, 16, 3.6, 4.4, 4.0, 65, 501, 4834, 329],
...                    [6, 12, 3.7, 4.6, 4.2, 65, 604, 4562, 299],
...                    [16, 32, 3.4, 4.9, 4.2, 105, 647, 10428, 799],
...                    [8, 16, 3.6, 5.0, 4.5, 125, 609, 5615, 399],
...                    [18, 36, 3.0, 4.8, 4.3, 165, 480, 8848, 979],
...                    [24, 48, 3.8, 4.5, 4.0, 280, 509, 13552, 1399],
...                    [28, 56, 2.5, 3.8, 2.8, 205, 376, 8585, 10000]])
>>> cvalues = np.vstack((
...     np.min(matrix, axis=0),
...     np.max(matrix, axis=0)
... )).T
>>> types = np.array([1, 1, 1, 1, 1, -1, 1, 1, -1])
>>> weights = np.array([1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9])
>>> body = COMET(cvalues, COMET.topsis_rate_function(weights, types))
>>> [round(preference, 4) for preference in body(matrix)]
[0.5433, 0.3447, 0.6115, 0.6168, 0.6060, 0.4842, 0.5516, 0.6100, 0.5719, 0.4711, 0.4979, 0.1452]
__call__(alts, *args, **kwargs)

Rank alternatives from decision matrix alts, with criteria weights weights and criteria types types.

Parameters
  • alts (ndarray) – Decision matrix / alternatives data. Alternatives are in rows and Criteria are in columns.

  • *args (is necessary for methods which reqiure some additional data.) –

  • **kwargs (is necessary for methods which reqiure some additional data.) –

Returns

Preference values for alternatives. Better alternatives have higher values.

Return type

ndarray

get_MEJ()

Return the Matrix Expert Judgment (MEJ) generated from the feature object comparisons.

static make_cvalues(matrix, numbers_of_cvalues=3)

Returns characteristic values matrix with nubmers_of_cvalues cvalues for each criterion. Characteristic values are generated equally from min to max.

Parameters
  • matrix (ndarray) – Decision matrix. Alternatives are in rows and Criteria are in columns.

  • numbers_of_cvalues (int, optional) – Number of characteristic value for each criterion. Default value is 3.

Returns

cvalues – Characteristic values for COMET method.

Return type

ndarray

Examples

>>> import numpy as np
>>> from pymcdm.methods import COMET
>>> matrix = np.array([[ 96, 145, 200],
                       [100, 145, 200],
                       [120, 170,  80],
                       [140, 180, 140],
                       [100, 110,  30]])
>>> types = np.ones(3)
>>> weights = np.ones(3)/3
>>> cvalues = COMET.make_cvalues(matrix)
>>> body = COMET(cvalues, COMET.topsis_rate_function(weights, types))
>>> preferences = body(matrix)
>>> np.round(preferences, 4)
array([0.5   , 0.5455, 0.5902, 0.9118, 0.0227])
static manual_expert(criteria_names)

Returns function for manual rating characteristic objects.

Parameters

criteria_names (list) – List of type names of criteria to be compared.

static topsis_rate_function(weights, types)

Returns function to rate characteristic objects with TOPSIS

Parameters
  • weights (ndarray) – Criteria weights. Sum of the weights should be 1. (e.g. sum(weights) == 1)

  • types (ndarray) – Array with definitions of criteria types: 1 if criteria is profit and -1 if criteria is cost for each criteria in matrix.

pymcdm.methods.copras

class pymcdm.methods.copras.COPRAS

Bases: MCDA_method

COmplex PRoportional ASsessment (COPRAS) method.

COPRAS is used to assess the maximizing and minimizing index values, and the effect of maximizing and minimizing indexes of attributes on the results assessment is considered separately [1].

Read more in the User Guide.

References

1

Zavadskas, E. K., Kaklauskas, A., & Sarka, V. (1994). The new method of multicriteria complex proportional assessment of projects. Technological and economic development of economy, 1(3), 131-139.

Examples

>>> from pymcdm.methods import COPRAS
>>> import numpy as np
>>> body = COPRAS()
>>> matrix = np.array([[1543, 2000, 39000, 15, 13.76, 3.86, 5, 3, 5000],
...                    [1496, 3600, 43000, 14, 14, 2.5, 4, 4, 4000],
...                    [1584, 3100, 24500, 10, 13.1, 3.7, 2, 2, 3500],
...                    [1560, 2700, 36000, 12, 13.2, 3.2, 3, 3, 3500],
...                    [1572, 2500, 31500, 13, 13.3, 3.4, 3, 2, 3500],
...                    [1580, 2400, 20000, 12, 12.8, 3.9, 2, 2, 3000]])
>>> weights = np.array([0.2027, 0.1757, 0.1622, 0.1351, 0.1081, 0.0946, 0.0676, 0.0405, 0.0135])
>>> types = np.array([-1, -1, -1, 1, 1, -1, 1, 1, 1])
>>> [round(preference, 4) for preference in body(matrix, weights, types)]
[1, 0.9167, 0.8675, 0.9084, 0.9315, 0.9486]
__call__(matrix, weights, types, *args, **kwargs)

Rank alternatives from decision matrix matrix, with criteria weights weights and criteria types types.

Parameters
  • matrix (ndarray) – Decision matrix / alternatives data. Alternatives are in rows and Criteria are in columns.

  • weights (ndarray) – Criteria weights. Sum of the weights should be 1. (e.g. sum(weights) == 1)

  • types (ndarray) – Array with definitions of criteria types: 1 if criteria is profit and -1 if criteria is cost for each criteria in matrix.

  • *args (is necessary for methods which reqiure some additional data.) –

  • **kwargs (is necessary for methods which reqiure some additional data.) –

Returns

Preference values for alternatives. Better alternatives have higher values.

Return type

ndarray

pymcdm.methods.edas

class pymcdm.methods.edas.EDAS

Bases: MCDA_method

Evaluation based on Distance from Average Solution (EDAS) method.

The EDAS method is based on an approach in which the decision alternatives are evaluated with respect to their distance from the mean solutions i.e. negative mean solution and positive mean solution [1].

Read more in the User Guide.

References

1

Keshavarz Ghorabaee, M., Zavadskas, E. K., Olfat, L., & Turskis, Z. (2015). Multi-criteria inventory classification using a new method of evaluation based on distance from average solution (EDAS). Informatica, 26(3), 435-451.

Examples

>>> from pymcdm.methods import EDAS
>>> import numpy as np
>>> body = EDAS()
>>> matrix = np.array([[3873, 39.55, 0.27, 0.87, 150, 0.07, 12, 2130],
...                    [5067, 67.26, 0.23, 0.23, 40, 0.02, 21, 2200],
...                    [2213, 24.69, 0.08, 0.17, 200, 0.04, 35, 570],
...                    [6243, 132, 0.07, 0.25, 100, 0.04, 16, 100],
...                    [8312, 460.47, 0.05, 0.21, 25, 0.1, 25, 200]])
>>> weights = np.array([0.131, 0.113, 0.126, 0.125, 0.126, 0.129, 0.132, 0.117])
>>> types = np.array([-1, -1, -1, 1, 1, -1, 1, 1])
>>> [round(preference, 3) for preference in body(matrix, weights, types)]
[0.841, 0.632, 0.883, 0.457, 0.104]
__call__(matrix, weights, types, *args, **kwargs)

Rank alternatives from decision matrix matrix, with criteria weights weights and criteria types types.

Parameters
  • matrix (ndarray) – Decision matrix / alternatives data. Alternatives are in rows and Criteria are in columns.

  • weights (ndarray) – Criteria weights. Sum of the weights should be 1. (e.g. sum(weights) == 1)

  • types (ndarray) – Array with definitions of criteria types: 1 if criteria is profit and -1 if criteria is cost for each criteria in matrix.

  • *args (is necessary for methods which reqiure some additional data.) –

  • **kwargs (is necessary for methods which reqiure some additional data.) –

Returns

Preference values for alternatives. Better alternatives have higher values.

Return type

ndarray

pymcdm.methods.mabac

class pymcdm.methods.mabac.MABAC(normalization_function=<function minmax_normalization>)

Bases: MCDA_method

Multi-Attributive Border Approximation Area Comparison (MABAC) method.

The MABAC method is based on determining the distance measure between each possible alternative and the Boundary Approximation Area (BAA).

Parameters

normalization_function (callable) – Function which should be used to normalize matrix columns. It should match signature foo(x, cost), where x is a vector which should be normalized and cost is a bool variable which says if x is a cost or profit criterion.

References

1

Pamučar, D., & Ćirović, G. (2015). The selection of transport and handling resources in logistics centers using Multi-Attributive Border Approximation area Comparison (MABAC). Expert systems with applications, 42(6), 3016-3028.

Examples

>>> from pymcdm.methods import MABAC
>>> import numpy as np
>>> body = MABAC()
>>> matrix = np.array([[22600, 3800, 2, 5, 1.06, 3.00, 3.5, 2.8, 24.5, 6.5],
...                    [19500, 4200, 3, 2, 0.95, 3.00, 3.4, 2.2, 24, 7.0],
...                    [21700, 4000, 1, 3, 1.25, 3.20, 3.3, 2.5, 24.5, 7.3],
...                    [20600, 3800, 2, 5, 1.05, 3.25, 3.2, 2.0, 22.5, 11.0],
...                    [22500, 3800, 4, 3, 1.35, 3.20, 3.7, 2.1, 23, 6.3],
...                    [23250, 4210, 3, 5, 1.45, 3.60, 3.5, 2.8, 23.5, 7.0],
...                    [20300, 3850, 2, 5, 0.90, 3.25, 3.0, 2.6, 21.5, 6.0]])
>>> weights = np.array([0.146, 0.144, 0.119, 0.121, 0.115, 0.101, 0.088, 0.068, 0.050, 0.048])
>>> types = np.array([-1, 1, 1, 1, -1, -1, 1, 1, 1, 1])
>>> [round(preference, 4) for preference in body(matrix, weights, types)]
[0.0826, 0.2183, -0.0488, 0.0246, -0.0704, 0.0465, 0.0464]
__call__(matrix, weights, types, *args, **kwargs)

Rank alternatives from decision matrix matrix, with criteria weights weights and criteria types types.

Parameters
  • matrix (ndarray) – Decision matrix / alternatives data. Alternatives are in rows and Criteria are in columns.

  • weights (ndarray) – Criteria weights. Sum of the weights should be 1. (e.g. sum(weights) == 1)

  • types (ndarray) – Array with definitions of criteria types: 1 if criteria is profit and -1 if criteria is cost for each criteria in matrix.

  • *args (is necessary for methods which reqiure some additional data.) –

  • **kwargs (is necessary for methods which reqiure some additional data.) –

Returns

Preference values for alternatives. Better alternatives have higher values.

Return type

ndarray

pymcdm.methods.mairca

class pymcdm.methods.mairca.MAIRCA(normalization_function=<function minmax_normalization>)

Bases: MCDA_method

Multi-Attributive RealIdeal Comparative Analysis (MARICA) method.

The MAIRCA method is based on an assumption in which it determines the gap between ideal and empirical rates. Read more in the User Guide.

Parameters

normalization_function (callable) – Function which should be used to normalize matrix columns. It should match signature foo(x, cost), where x is a vector which should be normalized and cost is a bool variable which says if x is a cost or profit criterion.

References

1

Pamučar, D., Vasin, L., & Lukovac, L. (2014, October). Selection of railway level crossings for investing in security equipment using hybrid DEMATEL-MARICA model. In XVI international scientific-expert conference on railway, railcon (pp. 89-92).

Examples

>>> from pymcdm.methods import MAIRCA
>>> import numpy as np
>>> body = MAIRCA()
>>> matrix = np.array([[70, 245, 16.4, 19],
...                    [52, 246, 7.3, 22],
...                    [53, 295, 10.3, 25],
...                    [63, 256, 12, 8],
...                    [64, 233, 5.3, 17]])
>>> weights = np.array([0.04744, 0.02464, 0.51357, 0.41435])
>>> types = np.array([1, 1, 1, 1])
>>> [round(preference, 4) for preference in body(matrix, weights, types)]
[0.0332, 0.1122, 0.0654, 0.1304, 0.1498]
__call__(matrix, weights, types, *args, **kwargs)

Rank alternatives from decision matrix matrix, with criteria weights weights and criteria types types.

Parameters
  • matrix (ndarray) – Decision matrix / alternatives data. Alternatives are in rows and Criteria are in columns.

  • weights (ndarray) – Criteria weights. Sum of the weights should be 1. (e.g. sum(weights) == 1)

  • types (ndarray) – Array with definitions of criteria types: 1 if criteria is profit and -1 if criteria is cost for each criteria in matrix.

  • *args (is necessary for methods which reqiure some additional data.) –

  • **kwargs (is necessary for methods which reqiure some additional data.) –

Returns

Preference values for alternatives. Better alternatives have higher values.

Return type

ndarray

pymcdm.methods.marcos

class pymcdm.methods.marcos.MARCOS(normalization_function=<function _marcos_normalization>)

Bases: MCDA_method

Measurement of Alternatives and Ranking according to COmpromise Solution (MARCOS) method.

The MARCOS method is based on the approach of evaluating alternatives according to reference values (ideal and anti-ideal) using a utility function [1].

Parameters

normalization_function (callable) – Function which should be used to normalize matrix columns. It should match signature foo(x, cost), where x is a vector which should be normalized and cost is a bool variable which says if x is a cost or profit criterion.

References

1

Stević, Ž., Pamučar, D., Puška, A., & Chatterjee, P. (2020). Sustainable supplier selection in healthcare industries using a new MCDM method: Measurement of alternatives and ranking according to COmpromise solution (MARCOS). Computers & Industrial Engineering, 140, 106231.

Examples

>>> from pymcdm.methods import MARCOS
>>> import numpy as np
>>> body = MARCOS()
>>> matrix = np.array([[660, 1000, 1600, 18, 1200],
...                    [800, 1000, 1600, 24, 900],
...                    [980, 1000, 2500, 24, 900],
...                    [920, 1500, 1600, 24, 900],
...                    [1380, 1500, 1500, 24, 1150],
...                    [1230, 1000, 1600, 24, 1150],
...                    [680, 1500, 1600, 18, 1100],
...                    [960, 2000, 1600, 12, 1150]])
>>> weights = np.array([0.1061, 0.3476, 0.3330, 0.1185, 0.0949])
>>> types = np.array([-1, 1, 1, 1, 1])
>>> [round(preference, 4) for preference in body(matrix, weights, types)]
[0.5649, 0.5543, 0.6410, 0.6174, 0.6016, 0.5453, 0.6282, 0.6543]
__call__(matrix, weights, types, *args, **kwargs)

Rank alternatives from decision matrix matrix, with criteria weights weights and criteria types types.

Parameters
  • matrix (ndarray) – Decision matrix / alternatives data. Alternatives are in rows and Criteria are in columns.

  • weights (ndarray) – Criteria weights. Sum of the weights should be 1. (e.g. sum(weights) == 1)

  • types (ndarray) – Array with definitions of criteria types: 1 if criteria is profit and -1 if criteria is cost for each criteria in matrix.

  • *args (is necessary for methods which reqiure some additional data.) –

  • **kwargs (is necessary for methods which reqiure some additional data.) –

Returns

Preference values for alternatives. Better alternatives have higher values.

Return type

ndarray

pymcdm.methods.mcda_method

class pymcdm.methods.mcda_method.MCDA_method

Bases: ABC

__call__(matrix, weights, types, *args, **kwargs)

Rank alternatives from decision matrix matrix, with criteria weights weights and criteria types types.

Parameters
  • matrix (ndarray) – Decision matrix / alternatives data. Alternatives are in rows and Criteria are in columns.

  • weights (ndarray) – Criteria weights. Sum of the weights should be 1. (e.g. sum(weights) == 1)

  • types (ndarray) – Array with definitions of criteria types: 1 if criteria is profit and -1 if criteria is cost for each criteria in matrix.

  • *args (is necessary for methods which reqiure some additional data.) –

  • **kwargs (is necessary for methods which reqiure some additional data.) –

rank(a)
reverse_ranking = True

pymcdm.methods.moora

class pymcdm.methods.moora.MOORA

Bases: MCDA_method

Multi-Objective Optimization on the basis of Ratio Analysis (MOORA) method.

The MOORA method is based on an approach using multi-objective optimization to evaluate alternatives.

References

1

Brauers, W. K., & Zavadskas, E. K. (2006). The MOORA method and its application to privatization in a transition economy. Control and cybernetics, 35(2), 445-469.

Examples

>>> from pymcdm.methods import MOORA
>>> import numpy as np
>>> body = MOORA()
>>> matrix = np.array([[1.5, 3, 5, 3.3],
...                    [2, 7, 5, 3.35],
...                    [3, 1, 5, 3.07],
...                    [2.2, 4, 5, 3.5],
...                    [2, 5, 3, 3.09],
...                    [3.2, 2, 3, 3.48],
...                    [2.775, 3, 5, 3.27]])
>>> weights = np.array([0.3, 0.2, 0.1, 0.4])
>>> types = np.array([-1, 1, 1, 1])
>>> [round(preference, 4) for preference in body(matrix, weights, types)]
[0.1801, 0.2345, 0.0625, 0.1757, 0.1683, 0.0742, 0.1197]
__call__(matrix, weights, types, *args, **kwargs)

Rank alternatives from decision matrix matrix, with criteria weights weights and criteria types types.

Parameters
  • matrix (ndarray) – Decision matrix / alternatives data. Alternatives are in rows and Criteria are in columns.

  • weights (ndarray) – Criteria weights. Sum of the weights should be 1. (e.g. sum(weights) == 1)

  • types (ndarray) – Array with definitions of criteria types: 1 if criteria is profit and -1 if criteria is cost for each criteria in matrix.

  • *args (is necessary for methods which reqiure some additional data.) –

  • **kwargs (is necessary for methods which reqiure some additional data.) –

Returns

Preference values for alternatives. Better alternatives have higher values.

Return type

ndarray

pymcdm.methods.ocra

class pymcdm.methods.ocra.OCRA(normalization_function=<function _ocra_normalization>)

Bases: MCDA_method

Operational Competitiveness Rating (OCRA) method.

The main idea of the OCRA method is toperform independent evaluation ofalternatives with respect to beneficial andnon beneficial criteria, and finally tocombine these two sets of ratings to obtainthe operational competitiveness ratings [1].

Parameters

normalization_function (callable) – Function which should be used to normalize matrix columns. It should match signature foo(x, cost), where x is a vector which should be normalized and cost is a bool variable which says if x is a cost or profit criterion.

References

1

Madić, M., Petković, D., & Radovanović, M. (2015). Selection of non-conventional machining processes using the OCRA method. Serbian Journal of Management, 10(1), 61-73.

Examples

>>> from pymcdm.methods import OCRA
>>> import numpy as np
>>> body = OCRA()
>>> matrix = np.array([[7.7, 256, 7.2, 7.3, 7.3],
...                    [8.1, 250, 7.9, 7.8, 7.7],
...                    [8.7, 352, 8.6, 7.9, 8.0],
...                    [8.1, 262, 7.0, 8.1, 7.2],
...                    [6.5, 271, 6.3, 6.4, 6.1],
...                    [6.8, 228, 7.1, 7.2, 6.5]])
>>> weights = np.array([0.239, 0.225, 0.197, 0.186, 0.153])
>>> types = np.array([1, -1, 1, 1, 1])
>>> [round(preference, 3) for preference in body(matrix, weights, types)]
[0.143, 0.210, 0.164, 0.167, 0, 0.112]
__call__(matrix, weights, types, *args, **kwargs)

Rank alternatives from decision matrix matrix, with criteria weights weights and criteria types types.

Parameters
  • matrix (ndarray) – Decision matrix / alternatives data. Alternatives are in rows and Criteria are in columns.

  • weights (ndarray) – Criteria weights. Sum of the weights should be 1. (e.g. sum(weights) == 1)

  • types (ndarray) – Array with definitions of criteria types: 1 if criteria is profit and -1 if criteria is cost for each criteria in matrix.

  • *args (is necessary for methods which reqiure some additional data.) –

  • **kwargs (is necessary for methods which reqiure some additional data.) –

Returns

Preference values for alternatives. Better alternatives have higher values.

Return type

ndarray

pymcdm.methods.promethee

class pymcdm.methods.promethee.PROMETHEE_II(preference_function)

Bases: MCDA_method

Preference Ranking Organization Method for Enrichment of Evaluations II (PROMETHEE II) method.

The PROMETHEE II method is based on a pairwise comparison of alternatives given a preference function [1].

Parameters

preference_function (str) – Name of the preference function (‘usual’, ‘ushape’, ‘vshape’, ‘level’, ‘vshape_2’)

References

1

Mareschal, B., De Smet, Y., & Nemery, P. (2008, December). Rank reversal in the PROMETHEE II method: some new results. In 2008 IEEE International Conference on Industrial Engineering and Engineering Management (pp. 959-963). IEEE.

Examples

>>> from pymcdm.methods import PROMETHEE_II
>>> import numpy as np
>>> body = PROMETHEE_II('usual')
>>> matrix =  np.array([[4, 3, 2],
...                     [3, 2, 4],
...                     [5, 1, 3]])
>>> weights = np.array([0.5, 0.3, 0.2])
>>> types = np.ones(3)
>>> [round(preference, 2) for preference in body(matrix, weights, types)]
[0.1, -0.3, 0.2]
__call__(matrix, weights, types, *args, p=None, q=None, promethee_I=False, **kwargs)

Rank alternatives from decision matrix matrix, with criteria weights weights and criteria types types.

Parameters
  • matrix (ndarray) – Decision matrix / alternatives data. Alternatives are in rows and Criteria are in columns.

  • weights (ndarray) – Criteria weights. Sum of the weights should be 1. (e.g. sum(weights) == 1)

  • types (ndarray) – Array with definitions of criteria types: 1 if criteria is profit and -1 if criteria is cost for each criteria in matrix.

  • p (ndarray) – p values for each criterion

  • q (ndarray) – q values for each criterion

  • promethee_I (bool) – If True then returns F+ and F- (like in promethee I).

  • *args (is necessary for methods which reqiure some additional data.) –

  • **kwargs (is necessary for methods which reqiure some additional data.) –

Returns

  • If promethee_I is True

  • ndarray – Positive flow

  • ndarray – Negative flow

  • If promethee_I is False

  • ndarray – Preference values of alternatives. Better alternatives have higher values.

pymcdm.methods.spotis

class pymcdm.methods.spotis.SPOTIS

Bases: MCDA_method

Stable Preference Ordering Towards Ideal Solution (SPOTIS) method.

The SPOTIS method is based on an approach in which it evaluates given decision alternatives using the distance from the best ideal solution. [1].

Read more in the User Guide.

References

1

Dezert, J., Tchamova, A., Han, D., & Tacnet, J. M. (2020, July). The SPOTIS rank reversal free method for multi-criteria decision-making support. In 2020 IEEE 23rd International Conference on Information Fusion (FUSION) (pp. 1-8). IEEE.

Examples

>>> from pymcdm.methods import SPOTIS
>>> import numpy as np
>>> body = SPOTIS()
>>> matrix = np.array([[10.5, -3.1, 1.7],
...                    [-4.7, 0, 3.4],
...                    [8.1, 0.3, 1.3],
...                    [3.2, 7.3, -5.3]])
>>> bounds = np.array([[-5, 12],
...                    [-6, 10],
...                    [-8, 5]], dtype=float)
>>> weights = np.array([0.2, 0.3, 0.5])
>>> types = np.array([1, -1, 1])
>>> [round(preference, 4) for preference in body(matrix, weights, types, bounds)]
[0.1989, 0.3705, 0.3063, 0.7491]
__call__(matrix, weights, types, bounds, *args, **kwargs)

Rank alternatives from decision matrix matrix, with criteria weights weights and criteria types types.

Parameters
  • matrix (ndarray) – Decision matrix / alternatives data. Alternatives are in rows and Criteria are in columns.

  • weights (ndarray) – Criteria weights. Sum of the weights should be 1. (e.g. sum(weights) == 1)

  • types (ndarray) – Array with definitions of criteria types: 1 if criteria is profit and -1 if criteria is cost for each criteria in matrix.

  • bounds (ndarray) – Each row should contain min and max values for each criterion. Min and max should be different values!

  • *args (is necessary for methods which reqiure some additional data.) –

  • **kwargs (is necessary for methods which reqiure some additional data.) –

Returns

Preference values for alternatives. Better alternatives have smaller values.

Return type

ndarray

static make_bounds(matrix)

Returns bounds matrix for each criterion, e.g. extract min and max for each criterion values.

Parameters

matrix (ndarray) – Decision matrix. Alternatives are in rows and Criteria are in columns.

Returns

bounds – Min and max values (bounds) for each criterion.

Return type

ndarray

Examples

>>> import numpy as np
>>> from pymcdm.methods import SPOTIS
>>> matrix = np.array([[ 96, 145, 200],
                       [100, 145, 200],
                       [120, 170,  80],
                       [140, 180, 140],
                       [100, 110,  30]])
>>> types = np.ones(3)
>>> weights = np.ones(3)/3
>>> body = SPOTIS()
>>> preferences = body(matrix, weights, types, bounds=bounds)
>>> np.round(preferences, 4)
array([0.5   , 0.4697, 0.4344, 0.1176, 0.9697])
reverse_ranking = False

pymcdm.methods.topsis

class pymcdm.methods.topsis.TOPSIS(normalization_function=<function minmax_normalization>)

Bases: MCDA_method

Technique for Order of Preference by Similarity to Ideal Solution (TOPSIS).

The TOPSIS method is based on an approach in which it evaluates alternatives to a positive ideal solution and a negative ideal solution [1].

Parameters

normalization_function (callable) – Function which should be used to normalize matrix columns. It should match signature foo(x, cost), where x is a vector which should be normalized and cost is a bool variable which says if x is a cost or profit criterion.

References

1

Hwang, C. L., & Yoon, K. (1981). Methods for multiple attribute decision making. In Multiple attribute decision making (pp. 58-191). Springer, Berlin, Heidelberg.

Examples

>>> from pymcdm.methods import TOPSIS
>>> import numpy as np
>>> body = TOPSIS()
>>> matrix = np.array([[1, 2, 5],
...                     3000, 3750, 4500]]).T
>>> weights = np.array([0.5, 0.5])
>>> types = np.array([-1, 1])
>>> [round(preference, 3) for preference in body(matrix, weights, types)]
[0.500, 0.617, 0.500]
__call__(matrix, weights, types, *args, **kwargs)

Rank alternatives from decision matrix matrix, with criteria weights weights and criteria types types.

Parameters
  • matrix (ndarray) – Decision matrix / alternatives data. Alternatives are in rows and Criteria are in columns.

  • weights (ndarray) – Criteria weights. Sum of the weights should be 1. (e.g. sum(weights) == 1)

  • types (ndarray) – Array with definitions of criteria types: 1 if criteria is profit and -1 if criteria is cost for each criteria in matrix.

  • *args (is necessary for methods which reqiure some additional data.) –

  • **kwargs (is necessary for methods which reqiure some additional data.) –

Returns

Preference values for alternatives. Better alternatives have higher values.

Return type

ndarray

pymcdm.methods.vikor

class pymcdm.methods.vikor.VIKOR(normalization_function=None)

Bases: MCDA_method

VIšekriterijumsko KOmpromisno Rangiranje (VIKOR) method.

The VIKOR method is based on an approach that uses a compromise mechanism to evaluate alternatives using distance from the ideal [1].

Parameters

normalization_function – Function which should be used to normalize matrix columns. It should match signature foo(x, cost), where x is a vector which should be normalized and cost is a bool variable which says if x is a cost or profit criterion.

1

Duckstein, L., & Opricovic, S. (1980). Multiobjective optimization in river basin development. Water resources research, 16(1), 14-20.

Examples

>>> from pymcdm.methods import VIKOR
>>> import numpy as np
>>> body = VIKOR()
>>> matrix = np.array([[78, 56, 34, 6],
...                    [4, 45, 3, 97],
...                    [18, 2, 50, 63],
...                    [9, 14, 11, 92],
...                    [85, 9, 100, 29]])
>>> weights = np.array([0.25, 0.25, 0.25, 0.25])
>>> types = np.array([1, 1, 1, 1])
>>> [round(preference, 4) for preference in body(matrix, weights, types)]
[0.5679, 0.7667, 1, 0.7493, 0]
__call__(matrix, weights, types, *args, v=0.5, return_all=False, **kwargs)

Rank alternatives from decision matrix matrix, with criteria weights weights and criteria types types.

Parameters
  • matrix (ndarray) – Decision matrix / alternatives data. Alternatives are in rows and Criteria are in columns.

  • weights (ndarray) – Criteria weights. Sum of the weights should be 1. (e.g. sum(weights) == 1)

  • types (ndarray) – Array with definitions of criteria types: 1 if criteria is profit and -1 if criteria is cost for each criteria in matrix.

  • v (float) – Weight of the strategy (see VIKOR algorithm explanation).

  • return_all (bool) – If True, all three ranking (S, R, Q) would be returned.

  • *args (is necessary for methods which reqiure some additional data.) –

  • **kwargs (is necessary for methods which reqiure some additional data.) –

Returns

  • if return_all is False

  • ndarray – Q preference values for alternatives. Better alternatives have smaller values.

  • if reeturn_all is True

  • ndarray, ndarray, ndarray – S, R, Q preference values (see VIKOR algorithm explanation).

reverse_ranking = False