This is a minimal and optimised implementation of AHP algorithm for multi-criteria decision-making and prescriptive analytics.
npm install ahp-lite``javascript
const linearAlgebra = require('linear-algebra')();
const Matrix = linearAlgebra.Matrix;
const ahp = require('ahp-lite');
``
npm i ahp
AHP Lite


 
This is a simplified implementation in Javascript for NodeJS of the algorithm AHP (Analytic Hierarchy Proccess) created by Saaty in 1986. This method is utilised in the field of prescriptive analytics, operations research, decision science and managerial accouting to methodically asign weighting to conflicting criteria based on systematic and hierchical subjective judgement.
Installation
`
Example Usage
javascript
`
const c = new Matrix([[1, 0.33, 0.2], [3, 1, 0.14], [5, 7, 1]]); // Criteria assessment matrix.
ahp.getWeights(c);
`
Returns:
javascript
`
{ ev: [ 0.1, 0.19, 0.71 ], ci: 0.12, cr: 0.21 }
npm run lint
Documentation
INPUT
| Argument | Description | Mandatory | Type | Rules |
|:-------------:|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:----------:|:-----------------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
| c | c argument stands for 'criteria matrix' and is a matrix that contains the data from comparative judgement between criteria based on Saaty scale. (READ BIBLIOGRAPHY) | True | Matrix of numeric data | This argument MUST be a matrix object from linear-algebra module and MUST contain only numeric data. |
OUTPUT
| Property | Description | Type |
|:-------------:|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:-----------------------:|
| ev | ev property stands for 'eigenvector' and is an array that contains the weights of each criteria. | Array of numeric data. |
| ci | ci property stands for 'consistency index' this is an indicator of inconsistency. | Float number. |
| cr | cr property stands for 'consistency ratio' this is the standarised indicator of inconsistency, higher than 0.2 should be reviewed. | Float number. |
NOTE: Make sure to read through bibliography below of AHP to understand how the algorithm works.
Package roadmap
- [x] AHP.
- [x] Support for Linear-Algebra matrices.
- [ ] Support for MathJS matrices.
- [ ] Support for Group decision-making.
- [ ] (FAHP) Fuzzy AHP.
- [ ] (IFAHP) Intuisionistic Fuzzy AHP.
- [ ] (NAHP) Neutrosophic AHP.
- [ ] (ANP) Analytic Network Process.
- [ ] (NNP) Neural Network Process.
Package Dependencies
- linear-algebra
License
MIT
Contributing
Linting
- AIRBNB
AIRBNB JS CODE STYLE
$3
- Eslint v-5.11.1 // AIRBNB Configuration
$3
- Error checl:
npm run lint-fix
- Error fix: or npm run lint -- --fix`