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.
esp (ndarray or None) – Optimal values for alternatives evaluation. Should be array with ideal (expected) value for each
criterion. If None, ESP will be calculated based on data and criteria types. Default is None.
The COCOSO method is based on an integrated model of simple additive weighting and exponentially weighted
product [2].
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.
The CODAS method is based on an approach based on Euclidean distance and Taxicab from the negative ideal solution [3].
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.
COMET is a method based on characteristic objects on the basis of which preference of the deicision variants is
calculated [4]. 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.
expert_function (callable) –
Function to rate CO. Matrix with CO as rows is passed as
an argument. Function should return vector which will be used
as SJ and the MEJ matrix.
If MEJ was not build None should be returned.
Signature of the function should be as followed:
rate_function(co: np.array) -> np.array, np.array or None
Please, see the implementation of ManualExpert and MethodExpert
in the pymcdm.comet_tools submodule if you want to create your
own custom expert_function.
matrix (ndarray) – Decision matrix / alternatives data.
Alternatives are in rows and Criteria are in columns.
weights (None) – Not used in the COMET method.
types (None) – Not used in the COMET method.
validation (bool) – Enable (True) or disable (False) validation of the input data.
For the COMET method only matrix and cvalues are validated.
Default is True.
verbose (bool) – Explain the MCDA, i.e. provide matrices and vectors from
all the steps of the method, instead of return just the
preference vector. Default is False.
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. See [5][6].
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 [7].
Limits on Property Method is a method primarily proposed for dealing with material selection problems.
It operates on three types of criteria (in method’s convention): lower-limit, upper-limit
and target properties [9].
Read more in the User Guide.
Parameters:
property_limits (np.ndarray or None) – Vector of lower-limit, upper-limit and target value properties. If None, then limits will be derived
from matrix based on types on each call. Default is None.
property_types (np.ndarray or None) – Vector of property types: should be iterable with int values that define types of properties
provided in property_limits argument. Possible values:
- 1 for lower-limit, treated as “no lower than”, equivalent to profit criteria.
- -1 for upper-limit, treated as “no bigger than”, equivalent to cost criteria.
- 0 for target properties, equivalent of Expected Solution Point.
If None, then types argument will be used to determine limits’ types.
Note, that if the
Default is None.
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 or None) – Array with definitions of criteria types:
1 if criteria is profit and -1 if criteria is cost for
each criteria in matrix. Can be omitted if property_limits
and property_types were provided in the constructor.
Note, that if both types and property_types are provided,
property_types are preferred and will be used.
validation (bool) – Enable or disable validation of the all input data. True - validation is enabled,
False - validation is disabled. Default is True.
verbose (bool) – Explain the MCDA, i.e. provide matrices and vectors from
all the steps of the method, instead of return just the
preference vector. Default is False.
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) [10].
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.
The MAIRCA method is based on an assumption in which it determines the gap between ideal and empirical rates [11].
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.
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 [12].
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.
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 [14].
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.
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 [16].
Parameters:
preference_function (str) – Name of the preference function (‘usual’, ‘ushape’, ‘vshape’, ‘level’, ‘vshape_2’)
p (ndarray or list) – p values for each criterion. Can be either float values or function. If function, p value will be calculated based on difference table.
q (ndarray or list) – q values for each criterion. Can be either float values or function. If function, q value will be calculated based on difference table.
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.
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 [20].
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.
The VIKOR method is based on an approach that uses a compromise mechanism to evaluate alternatives using
distance from the ideal [21].
Parameters:
normalization_function (None or 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.
Weighted Aggregated Sum Product ASSessment (WASPAS) [22].
The WASPAS method is a unique combination of two well-known MCDM approaches, i.e. Weighted Sum Model (WSM) and
Weighted Product Model (WPM).
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.
WPM is based on an approach that evaluates alternatives by weighted product.
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.
WSM is based on an approach that evaluates alternatives by weighted sum.
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.
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.
validation (bool) – Enable or disable validation of the all input data. True - validation is enabled,
False - validation is disabled. Default is True.
verbose (bool) – Explain the MCDA, i.e. provide matrices and vectors from
all the steps of the method, instead of return just the
preference vector. Default is False.
Create an object which will rate characteristic objects (CO) using
compromise of several preferences. If the CO is better in most of the
preferences, than it is bigger in the final MEJ.
Parameters:
evaluation_functions (list[Callable]) – List of functions which will evaluate preferences of the
characteristic objets. If you want to use MCDA methods, please
use lambda or partial to provide weights and types to them.
vote_limit (float) – Vote limit decides the limit for the voting. If number of votes
CO_i > CO_j are bigger then vote_limit, then in the final MEJ
matrix CO_i > CO_j, otherwise CO_i < CO_j.
Create an object which will rate characteristic objects using Expected
Solution Points (ESPs) provided by an expert to rate the characteristic
objects.
Parameters:
esps (ndarray) – Numpy 2d matrix which defines chosed Expected Solution Points.
Each row should define one ESP, number of the colums should be
equal to the number of criteria.
bounds (ndarray) – Each row should contain min and max values for each criterion.
Min and max should be different values!
distance_function (Callable or None) – Function which will be used to calculate the distance between
two numpy array a and b. Signature of the function is d(a, b).
If None, ESPExpert._euclides function is used and the Euclides
distance is calculated between vectors.
distance_aggregation (Callable) – Function which is used to aggregate distances to several ESP
for each characteristic object. Default is np.min().
cvalues_psi (float or None) – Float in range (0, 1). This value determines location of the
additional ESP-guided characteristic values. E.g. criteria
domain bounds are [0, 10] and ESP is 3. Then if we chose
psi = 0.2 we will get following characteristic values for
such criterion: [0, 2.4, 3, 4.4, 10] (the psi part of the
distance between bound and ESP is substracted and added).
full_domain_psi (bool) – Determines if additional characteristic values will be
generated using full domain (True) or distance between ESP
and bounds (False). E.g. if full_domain_psi=True, criteria
domain bounds are [0, 10] and ESP is 3. If we chose
psi = 0.2 we will get following characteristic values for
such criterion: [0, 1, 3, 5, 10] (the psi part of the
distance between all domain is substracted and added).
Examples
>>> importnumpyasnp>>> importmatplotlib.pyplotasplt>>> importpymcdmaspm>>> # Define criteria bounds for the decision problem>>> bounds=np.array([[0,1]]*2,dtype=float)>>> # Define the Expected Solution Point (or Points) for this problem>>> esps=np.array([[0.4,0.4]])>>> # Create the expert function using ESPExpert class>>> expert=pm.methods.comet_tools.ESPExpert(esps,... bounds,... cvalues_psi=0.2)>>> # Generate ESP-guided cvalues based on provided ESP and psi>>> cvalues=expert.make_cvalues()>>> # Create and identify COMET model>>> comet=pm.methods.COMET(cvalues,expert)>>> # Create a visualization of the characteriscic values,>>> # ESP and preference function>>> fig,ax=plt.subplots(figsize=(4,3.5),dpi=200)>>> ax,cax=pm.visuals.comet_2d_esp_plot(comet,esps,bounds)>>> plt.tight_layout()>>> plt.show()
Generate the characteristic values array based on provided
ESPs and psi values. Usually using COMET with such cvalues will
provide better results, however it is not mandatory.
Returns:
cvalues – Characteristic values created based on ESPs and psi.
Create an object which will rate characteristic objects using expert function.
Parameters:
expert_function (Callable) – Function with a signature (co_i, co_j) -> float.
If co_i < co_j this function should return 0.0.
If co_i == co_j this function should return 0.5.
If co_i > co_j this function should return 1.0.
Create object of the ManualExpert expert function which allows to
manually identify Matrix of Expert Judgements (MEJ).
Parameters:
criteria_names (list[str]) – Criteria names which would be used during the procedure of the
MEJ identification.
show_MEJ (bool) – If MEJ should be shown after each question answered.
Default is False.
tablefmt (str) – tablefmt argument for the tablulate function. See tabulate
documentation for more info.
Default is ‘simple_grid’.
filename (str or None) – Path to the file in which identified save should be saved.
If None, MEJ will be not saved. If file exists, MEJ will be
loaded from this file. Default is ‘mej.csv’.
Examples
>>> importnumpyasnp>>> frompymcdm.methodsimportCOMET>>> frompymcdm.methods.comet_toolsimportManualExpert>>> cvalues=[... [0,500,1000],... [1,5]... ]>>> expert_function=ManualExpert(... criteria_names=['Price [$]','Profit [grade]'],... show_MEJ=True... )>>> # You will prompted to evaluate all CO>>> comet=COMET(cvalues,expert_function)
Create object of the COMET submodel. This class is mostly for internal
use in the StructuralCOMET class or for creating StructuralCOMET
object.
Parameters:
structure (tuple or int) – Structure of the submodel. Refer to the single criteria by
names (str) or by indexes (int). If structure is more complex
use defined names or nested structures. See example use of
StructuralCOMET for more information.
cvalues (list or None) – Cvalues for output of this submodel. Pass None if it is a final
model to be evaluated.
expert_function (Callable or None) – Expert function to evaluate characteristic objects in
the submodel. See COMET documentation for more information.
None is reserved for internal use in StructuralCOMET class.
name (str or None) – Name (alias) of the Submodel. If name is not None Submodel
could be referred by it in another Submodel in one
StructuralCOMET model.
Create object of the TriadSupportExpert expert function which allows
to manually identify Matrix of Expert Judgements (MEJ), but with the
support of the consistent triads.
Parameters:
criteria_names (list[str]) – Criteria names which would be used during the procedure of the
MEJ identification.
show_MEJ (bool) – If MEJ should be shown after each question answered.
Default is False.
tablefmt (str) – tablefmt argument for the tablulate function. See tabulate
documentation for more info.
Default is ‘simple_grid’.
filename (str or None) – Path to the file in which identified save should be saved.
If None, MEJ will be not saved. If file exists, MEJ will be
loaded from this file. Default is ‘mej.csv’.
Examples
>>> importnumpyasnp>>> frompymcdm.methodsimportCOMET>>> frompymcdm.methods.comet_toolsimportTriadSupportExpert>>> cvalues=[... [0,500,1000],... [1,5]... ]>>> expert_function=TriadSupportExpert(... criteria_names=['Price [$]','Profit [grade]'],... show_MEJ=True... )>>> # You will prompted to evaluate some of the CO and>>> # other CO will be completed using consistent triads.>>> comet=COMET(cvalues,expert_function)
Preference Ranking Organization Method for Enrichment of Evaluations I (PROMETHEE I) method.
The PROMETHEE I method is based on a pairwise comparison of alternatives given a preference function [29].
Parameters:
preference_function (str) – Name of the preference function (‘usual’, ‘ushape’, ‘vshape’, ‘level’, ‘vshape_2’)
p (ndarray or list) – p values for each criterion. Can be either float values or function. If function, p value will be calculated based on difference table.
q (ndarray or list) – q values for each criterion. Can be either float values or function. If function, q value will be calculated based on difference table.