lattice / ahp
Analytic Hierarchy Process implementation in PHP
dev-master
2020-05-02 11:13 UTC
Requires
- symfony/var-dumper: ^5.0
This package is auto-updated.
Last update: 2025-07-29 01:44:30 UTC
README
PHP implementation of the Analytic Hierarchy Process (AHP) by Thomas L. Saaty.
Description
More on Wikipedia
Installation via Composer
composer require lattice/ahp
Usage
Basic example
Reproducting the Choose a Leader
example from Wikipedia
$ahp = new AHP(); $tom = new Candidate(['name'=>'Tom','profile'=>['experience'=>10,'education'=>5,'charisma'=>9,'age'=>50]]); $dick = new Candidate(['name'=>'Dick','profile'=>['experience'=>30,'education'=>3,'charisma'=>5,'age'=>60]]); $harry = new Candidate(['name'=>'Harry','profile'=>['experience'=>5,'education'=>7,'charisma'=>3,'age'=>30]]); $experienceCriterion = new Criterion('Experience'); $educationCriterion = new Criterion('Education'); $charismaCriterion = new Criterion('Charisma'); $ageCriterion = new Criterion('Age'); $ahp->addCandidate($tom); $ahp->addCandidate($dick); $ahp->addCandidate($harry); $ahp->displayResults('total'); $ahp->displayResults();
More in the following files:
- examples.php explaining basic examples
- examples2.php showing the full example of Choosing a car for the Jones family
- examples3.php documenting the class Matrix
Todo
- implements a load function to define model in a file
- implements custom preference functions
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Acknowledgments
- Inspiration for formatting results and ideas for future evolutions thanks to R package AHP