# How to validate the correct software implementation of AHP?

Sometimes I receive the question, how to validate the correct implementation of my AHP excel template or my AHP online software, i.e. are the results correct and reliable? There are a number of steps to test the correct implementation of the method:

1. Check for a 2 x 2 decision matrix.
2. Use “1” for all elements of the decision matrix, i.e. each criterion has the same importance as all other criteria.
3. Use extremes, i.e. one criterion is extremely (9 times) more important than all other criteria.
4. Take specific examples from the literature – published research papers containing data of the decision matrix and priorities – and compare.
5. Compare the results for same input data with the results from another software implementation of the AHP method.

This is what I have done, and in the following I will explain each step in more detail.

## 1. Check for a 2 x 2 decision matrix

For two criteria there is only one comparison and one solution only: If criterion A is x-times more important than B, the weight w(A) = x/(1+x). w(B) = 1-w(A) as w(A)+w(B) = 1. Eigenvalue = 2; CR is always 0.

Example: Criterion A is 3 times more important than criterion B:
w(A) = 3/4 (75%), w(B) = 1/4 (25%). Check: w(A)/w(B) = 3.

## 2. Each criterion has the same importance as all other criteria

If all criteria have the same importance, the resulting weight should be 1/n, with n the number of criteria.

Example: Four criteria should result in a weight of 1/4 = 25% for each criterion.

## 3. One criterion is 9 times more important than all other criteria

If one criterion is 9 times more important than all other criteria, the weights depend on the number of criteria, the maximum weight or maximum priority wmax is always

wmax = M/(n + M – 1)

with M = 9, the maximum of the AHP scale, and n the number of criteria. All other weights should be

wmin = (1 – wmax )/(– 1)

Example: 5 criteria, one criterion 9 times more important than all others

wmax = 9/(5 + 9 – 1) = 9/13 = 69.2%

wmin = (1 – 69.2% )/(5 – 1) = 0.31/4 = 7.7%

## 4. Specific examples from the literature

Here a practical example comparing the results with  an example (7 criteria) given by Saaty in Int. J. Services Sciences, Vol. 1, No. 1, 2008 (p 86, table 2). The AHP matrix is:

 1 9 5 2 1 1 1/2 1/9 1 1/3 1/9 1/9 1/9 1/9 1/5 3 1 1/3 1/4 1/3 1/9 1/2 9 3 1 1/2 1 1/3 1 9 4 2 1 2 1/2 1 9 3 1 1/2 1 1/3 2 9 9 3 2 3 1

The result according Saaty is
(0.177,  0.019, 0.042, 0.116, 0.190, 0.129, 0.327) with consistency ratio of 0,022

My AHP Excel template and my online software should give the same results.

## 5.  Comparison with other software implementations

As I have implemented AHP under Excel and written in php script language for the online version, I can simply compare the results from both implementations, using the same input data.