Object-oriented Multiple Criteria Decision Analysis library for JavaScript and TypeScript.
If you use MCDA.js in your research, please cite the following paper:
Or using Bitbtex:
DOI: https://doi.org/10.1016/j.omega.2018.07.004
@article{WATROBSKI2019107,
title = {Generalised framework for multi-criteria method selection},
journal = {Omega},
volume = {86},
pages = {107-124},
year = {2019},
issn = {0305-0483},
doi = {https://doi.org/10.1016/j.omega.2018.07.004},
url = {https://www.sciencedirect.com/science/article/pii/S0305048317308563},
author = {Jarosław Wątróbski and Jarosław Jankowski and Paweł Ziemba and Artur Karczmarczyk and Magdalena Zioło},
}Install MCDA.js using your preferred package manager:
npm install mcdajsor
yarn add mcdajsor
pnpm add mcdajsor
bun add mcdajsimport {
TopsisDecisionProblem,
CriterionType,
} from "mcdajs";
const problem = new TopsisDecisionProblem();const {
TopsisDecisionProblem,
CriterionType,
} = require("mcdajs");
const problem = new TopsisDecisionProblem();<script type="module">
import {
TopsisDecisionProblem,
CriterionType,
} from "https://esm.sh/mcdajs";
const problem = new TopsisDecisionProblem();
</script><script src="https://cdn.jsdelivr.net/npm/mcdajs/dist/index.iife.js"></script>
<script>
const problem = new Mcda.TopsisDecisionProblem();
</script>MCDA.js models every Multiple-Criteria Decision Analysis (MCDA) problem as a decision problem. The library provides two abstract base classes:
AbstractDecisionProblem– base class for methods operating directly on the decision matrix (e.g. PROMETHEE).AbstractNormalizedDecisionProblem– extendsAbstractDecisionProblemfor methods requiring a normalization step (e.g. TOPSIS).
To solve a decision problem:
- Choose the desired MCDA method by creating the corresponding decision problem class (e.g.
TopsisDecisionProblemorPrometheeDecisionProblem).
const problem = new TopsisDecisionProblem();- Configure its public properties.
const matrix = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
];
const weights = [1 / 3, 1 / 3, 1 / 3];
const alternativeNames = ["A1", "A2", "A3"];
const criteriaNames = ["C1", "C2", "C3"];
const types = [CriterionType.BENEFIT, CriterionType.COST, CriterionType.BENEFIT];
problem.matrix = matrix;
problem.weights = weights;
problem.types = types;
problem.alternatives = alternativeNames;
problem.criteria = criteriaNames;- Read the resulting preference scores.
const scores = problem.scores;At minimum, every decision problem requires:
- a decision matrix (
matrix), - criterion weights (
weights), - criterion types (
types), indicating whether each criterion is a benefit or a cost (CriterionType.BENEFIT/CriterionType.COST).
Also, optional alternative and criterion names are supported through the alternatives and criteria properties.
Method-specific configuration (such as normalization callbacks for TOPSIS or preference functions for PROMETHEE) is exposed through additional public properties.
// set normalization approach to TopsisDecisionProblem
problem.normalizationCallback = vectorNormalizationCallback;To inspect intermediate results produced by an MCDA method, enable debugging before computing the scores:
problem.enableDebug(true);
const scores = problem.scores;
const debugResults = problem.debugBag as TopsisDebugResults;
// type TopsisDebugResults = {
// normalizedMatrix: number[][];
// weightedNormalizedMatrix: number[][];
// idealBest: number[];
// idealWorst: number[];
// distanceToBest: number[];
// distanceToWorst: number[];
// };The debugBag contains method-specific intermediate computations (such as normalized matrices, ideal solutions, preference matrices, or flow values), making it useful for debugging, validation against the literature, or educational purposes.
Every decision problem exposes the computed preference values through the scores getter:
const scores = problem.scores;Different MCDA methods use different score semantics. For some methods (e.g. TOPSIS), higher scores indicate better alternatives, while for others the opposite may be true. The library provides the rank() utility to convert scores into rankings consistently:
const scores = problem.scores;
const ranks = rank(scores);
console.log(ranks);See the examples directory for complete examples demonstrating usage in browser (IIFE, ESM), node usage as well as integration with Angular, React and Vue.
Currently, the library supports the following MCDA methods:
- TOPSIS (Technique for the Order of Prioritisation by Similarity to Ideal Solution) [1]
- PROMETHEE II (Preference Ranking Organization METHod for Enrichment of Evaluations II) [2]
- CODAS (COmbinative Distance-based ASsessment) [3]
- EDAS (Evaluation based on Distance from Average Solution) [4]
- MABAC (Multi-Attributive Border Approximation area Comparison) [5]
- SAW (Simple Additive Weighting) [6]
- SPOTIS (Stable Preference Ordering Towards Ideal Solution) [7]
- VIKOR (VIšeKriterijumska Optimizacija I Kompromisno Rešenje) [8]
- WASPAS (Weighted Aggregates Sum Product ASsessment) [9]
[1] Hwang, C. L., & Yoon, K. (1981). Methods for multiple attribute decision making. In Multiple attribute decision making (pp. 58-191). Springer, Berlin, Heidelberg.
[2] Brans, J. P., Vincke, P., & Mareschal, B. (1986). How to select and how to rank projects: The PROMETHEE method. European journal of operational research, 24(2), 228-238.
[3] Keshavarz-Ghorabaee, M. (2016). A new combinative distance-based assessment (CODAS) method for multi-criteria decision-making.
[4] 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.
[5] 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.
[6] Fishburn, P. C. (1967). Additive utilities with incomplete product sets: Application to priorities and assignments. Operations research, 15(3), 537-542.
[7] 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.
[8] Opricovic, S. (1998). Multicriteria optimization of civil engineering systems. Faculty of civil engineering, Belgrade, 2(1), 5-21.
[9] Zavadskas, E. K., Turskis, Z., Antucheviciene, J., & Zakarevicius, A. (2012). Optimization of weighted aggregated sum product assessment. Elektronika ir elektrotechnika, 122(6), 3-6.