1. for {i = 1, i <= k − 1, i + +} do

2. for {j = 1, j < 2i−1, j + +} do

3. if {PVx < (Pij+r/2)} then

4. if {PVx > (Pij−r/2)} then

5. {Vx become the candidate of a AHPi}

6. {Comparing the |PVx − Pij| and |PVNx − Pij|}

7. if {|PVx − Pij| is the smallest one} then

8. {Vx becomes the AHPi}

9. else

10. {Vx becomes only candidate of AHPi}

11. end if

12. end if

13. end if

14. end for

15.end for