当前位置:网站首页>Mathematical modeling -- analytic hierarchy process model
Mathematical modeling -- analytic hierarchy process model
2022-07-29 03:21:00 【Believe yourself!!!】
One 、 Theoretical knowledge
1. Three issues that should be given priority by using analytic hierarchy process
(1) What is the goal of our evaluation ?
eg: The best destination for college students
(2) What are the solutions to achieve this goal ?
eg: Beijing 、 Shanghai 、 Hangzhou
(3) What is the criterion of evaluation ?
eg: cost 、 traffic 、 accommodation 、 diet 、 scenery
2. Positive reciprocal matrix ( Judgment matrix ) And consistency matrix
(1) Positive reciprocal matrix ( Judgment matrix ) Conditions met
Diagonal lines are 1;Aij*Aji=1;Aij>0.
give an example :
| 1 | 1/7 | 3 |
| 7 | 1 | 5 |
| 1/3 | 1/5 | 1 |
(2) Uniform matrix
If the positive reciprocal matrix satisfies Aij*Ajk=Aik, It is called consistent matrix ( Or it can be understood that the corresponding row or column is proportional ).
give an example :
| 1 | 1/2 | 3 |
| 2 | 1 | 6 |
| 1/3 | 1/6 | 1 |
3. How to calculate the weight
(1) Calculate the weight with the arithmetic average method
First step : Normalize the judgment matrix according to columns ( Each element is divided by the sum of its columns )
The second step : Add the normalized columns ( Sum up by line )
The third line : Divide each element of the vector after adding by n You can get the weight vector
summary : Hypothetical judgment matrix A=
, Then the weight vector obtained by the arithmetic mean method is :

Example : It is known that
| scenery | Hangzhou | Shanghai | Suzhou |
| Hangzhou | 1 | 2 | 4 |
| Shanghai | 1/2 | 1 | 2 |
| Suzhou | 1/4 | 1/2 | 1 |
Calculate according to the first column : Hangzhou :1/(1+1/2+1/4)=0.57
Shanghai :(1/2)/(1+1/2+1/4)=0.29
Suzhou :(1/4)/(1+1/2+1/4)=0.14
Calculate according to the second column : Hangzhou :2/(2+1+1/2)=0.57
Shanghai :1/(2+1+1/2)=0.29
Suzhou :(1/2)/(2+1+1/2)=0.14
Calculate according to the third column : Hangzhou :4/(4+2+1)=0.57
Shanghai :2/(4+2+1)=0.29
Suzhou :1/(4+2+1)=0.14
So in the column of scenery, the weight of the three : Hangzhou :(0.57+0.57+0.57)/3=0.57
Shanghai :(0.29+0.29+0.29)/3=0.29
Suzhou :(0.14+0.14+0.14)/3=0.14
Be careful : If it is a consistent matrix, only one column can be calculated ; If it is a general judgment matrix, you need to calculate a column to find the average .
(2) Calculate the weight by geometric average method
First step : Multiply the matrix by rows to get a new column vector
The second step : Open each component of the new vector n Power
The third step : The weight vector can be obtained by normalizing the column vector

(3) Calculate the weight by eigenvalue method
First step : Find out the maximum eigenvalue of the judgment matrix and its corresponding eigenvector
The second step : The weight can be obtained by normalizing the obtained feature vector
for example :

Be careful : In the above three methods, if all the weights calculated do not add up to 1 It's because a person cut the score when calculating !!!
4. Steps of consistency inspection ( If it is a consistency matrix, this step is not necessary )
(1) First step : Calculate the consistency index CI

(2) The second step : Find the corresponding average random consistency index RI
| n | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| RI | 0 | 0 | 0.52 | 0.89 | 1.12 | 1.26 | 1.36 | 1.41 | 1.46 | 1.49 | 1.52 | 1.54 | 1.56 | 1.58 | 1.59 |
(3) The third step : Calculate the consistency ratio CR

If CR<0.1, Then it can be considered that the consistency of the judgment matrix is acceptable ; Otherwise, the judgment matrix needs to be modified ( You can modify flexibly ).
Two 、 The problem solving steps
First step : Analyze the relationship between various factors in the system , Establish the hierarchical relationship of the system
The second step : Compare the importance of each element at the same level with respect to a certain criterion in the upper level , Construct judgment matrix
| scenery | cost | live | diet | traffic | |
| scenery | 1 | 1/2 | 4 | 3 | 3 |
| cost | 2 | 1 | 8 | 6 | 6 |
| live | 1/4 | 1/8 | 1 | 3/4 | 3/4 |
| diet | 1/3 | 1/6 | 4/3 | 1 | 1 |
| traffic | 1/3 | 1/6 | 4/3 | 1 | 1 |
Then use the above three methods to solve the weight to get Index weight
Suppose the weight obtained above is :
| Index weight | |
| scenery | 0.2636 |
| cost | 0.4758 |
| live | 0.0538 |
| diet | 0.0981 |
| traffic | 0.1087 |
The third step : There is a judgment matrix to calculate the relative weight of the compared elements for the criterion , And conduct consistency inspection ( Only when the consistency test passes the weight can it be used )
| scenery | Hangzhou | Shanghai | Suzhou |
| Hangzhou | 1 | 2 | 4 |
| Shanghai | 1/2 | 1 | 2 |
| Suzhou | 1/4 | 1/2 | 1 |
| cost | Hangzhou | Shanghai | Suzhou |
| Hangzhou | 1 | 2 | 4 |
| Shanghai | 1/2 | 1 | 2 |
| Suzhou | 1/4 | 1/2 | 1 |
| live | Hangzhou | Shanghai | Suzhou |
| Hangzhou | 1 | 2 | 4 |
| Shanghai | 1/2 | 1 | 2 |
| Suzhou | 1/4 | 1/2 | 1 |
| diet | Hangzhou | Shanghai | Suzhou |
| Hangzhou | 1 | 2 | 4 |
| Shanghai | 1/2 | 1 | 2 |
| Suzhou | 1/4 | 1/2 | 1 |
| traffic | Hangzhou | Shanghai | Suzhou |
| Hangzhou | 1 | 2 | 4 |
| Shanghai | 1/2 | 1 | 2 |
| Suzhou | 1/4 | 1/2 | 1 |
The calculation method of weight is the same as above , Refer to the above for the method of consistency inspection .
Assume that the weights obtained above are :
| Beijing | Shanghai | Hangzhou | |
| scenery | 0.5954 | 0.2764 | 0.1283 |
| cost | 0.0819 | 0.2363 | 0.6817 |
| live | 0.4286 | 0.4286 | 0.1429 |
| diet | 0.6337 | 0.1919 | 0.1744 |
| traffic | 0.1667 | 0.1667 | 0.6667 |
Step four : Calculate the composite weight of each layer element to the system target , And sort
| Index weight | Beijing | Shanghai | Hangzhou | |
| scenery | 0.2636 | 0.5954 | 0.2764 | 0.1283 |
| cost | 0.4758 | 0.0819 | 0.2363 | 0.6817 |
| live | 0.0538 | 0.4286 | 0.4286 | 0.1429 |
| diet | 0.0981 | 0.6337 | 0.1919 | 0.1744 |
| traffic | 0.1087 | 0.1667 | 0.1667 | 0.6667 |
Beijing :0.2636*0.5945+0.4758*0.0819+0.0538*0.4286+0.0981*0.6337+0.1087*0.1667=0.2992604
Shanghai :0.2636*0.2764+0.4758*0.2363+0.0538*0.4286+0.0981*0.1919+0.1087*0.1667=0.24529494
Hangzhou :0.2636*0.1283+0.4758*0.6817+0.0538*0.1429+0.0981*0.1744+0.1087*0.6667=0.45543969
therefore , in summary , Hangzhou is the best , Beijing comes second , Shanghai finally .
3、 ... and 、Matlab Code demonstration —— Calculate the required weight
% Analytic hierarchy process —— Find the weight of a given matrix
% First step : Input judgment matrix
clear;
clc;
A=input('Please enter your number:');
% A =[1 1 4 1/3 3;
% 1 1 4 1/3 3;
% 1/4 1/4 1 1/3 1/2;
% 3 3 3 1 3;
% 1/3 1/3 2 1/3 1];
Error=0;
[xx,yy]=size(A);
% Judge whether it is a square matrix 、 Whether the dimension is less than or equal to 1
if xx~=yy || xx<=1
Error=1;
end
% Judge whether the elements in the matrix are less than 0
if Error==0
if min(min(A))<=0
Error=2;
end
end
% Determine whether the dimension exceeds 15
if Error==0
if size(A,1)>15
Error=3;
end
end
% Judge whether it is satisfied Aij*Aji=1
if Error==0
if A' .* A~=ones(size(A,1))
Error=4;
end
end
if Error==0
if size(A,1)~=2 % If the dimension is greater than 2 To judge consistency , If 2 There is no need to judge consistency , Because at this time, it must be a consistent matrix
% The second step : Judge consistency
[E,F]=eig(A); % obtain A All eigenvalues of the matrix form a column vector ,E Is the eigenvector matrix ,F Is the eigenvalue matrix , Diagonals are eigenvalues , Others are 0
Fmax=max(max(F)); % Get the maximum eigenvalue
n=size(A,1);
CI=(Fmax-n)/(n-1);
RI=[0 0 0.52 0.89 1.12 1.26 1.36 1.41 1.46 1.49 1.52 1.54 1.56 1.58 1.59];
CR=CI/RI(n);
if CR<0.1
disp('CI=');
disp(CI);
disp('CR=');
disp(CR);
disp(' The consistency of the matrix is acceptable !');
else
disp(' The consistency of the matrix is unacceptable !');
end
end
% The third step : Calculate the weight
% Method 1 : Calculate the weight with the arithmetic average method
Sum_A=sum(A,1); % Sum the columns to get a row vector
SUM_A=repmat(Sum_A,size(A,1),1); % use repmat Function to construct a matrix whose elements are sum
Stand_A=A./SUM_A; % Each element is divided by the sum of its column to form a normalization matrix , Notice that this is ./, No /
disp(' The weight obtained by the arithmetic mean method is :');
disp(sum(Stand_A,2)/n);
% Method 2 : Calculate the weight by geometric average method
A_prod=prod(A,2);
A_prod=A_prod.^(1/n);
disp(' The weight obtained by geometric average method is :');
disp(A_prod/sum(A_prod));
% Method 3 : Calculate the weight by eigenvalue method
[x,y]=find(F~=0,1); % An eigenvalue of the uniform matrix is n, The rest are 0
%[x,y]=find(F==Fmax,1);
disp(' The weight obtained by the eigenvalue method is :');
disp(E(:,y)/sum(E(:,y)));
elseif Error==1
disp(' The input matrix is not a square matrix or the dimension is less than or equal to 1 !');
elseif Error==2
disp(' The input matrix has elements less than or equal to 0 !');
elseif Error==3
disp(' The dimension of the input matrix is greater than 15 !');
elseif Error==4
disp(' The input matrix does not meet Aij*Aji=1 !');
end边栏推荐
- MySQL installation and configuration super detailed tutorial and simple database and table building method
- A simple and general method to obtain the size of function stack space
- 生产部署zabbix5.0笔记
- Introduction and advanced MySQL (XIV)
- Alibaba Sentinel - 工作流程及原理解析
- Calculation of array serial number of force deduction questions (daily question 7/28)
- 服务器运行管理制度
- 复现20字符短域名绕过以及xss相关知识点
- Singleton mode (hungry and lazy)
- [freeswitch development practice] unimrcp compilation and installation
猜你喜欢
![LeetCode 1331 数组序号转换[Map] HERODING的LeetCode之路](/img/be/d429d0c437dc5ed7cb4448e223a83a.png)
LeetCode 1331 数组序号转换[Map] HERODING的LeetCode之路

Calculation of array serial number of force deduction questions (daily question 7/28)

01-sdram: Code of initialization module

微信为之疯狂的Glide使用——之生命周期学习

12_ UE4 advanced_ Change a more beautiful character model

makefile详解

How dare you write a resume that is proficient in concurrent programming? Why do you use a two-way linked list in AQS?

July 28, 2022 Gu Yujia's study notes

Singleton mode (hungry and lazy)

Idea configuration web container and war packaging
随机推荐
力扣刷题之数组序号计算(每日一题7/28)
Redis之sentinel哨兵集群怎么部署
Kubernetes-1.24.x feature
C和指针 第3章 语义“陷阱” 3.5 空指针并非字符串
MySQL流程控制之while、repeat、loop循环实例分析
基于单片机烟雾温湿度甲醛监测设计
SAP 中国本地化内容汇总
Makefile details
web-uploader不能多文件上传
Introduction to JVM foundation I (memory structure)
军品研制过程-转阶段
单例模式(饿汉式 懒汉式)
MYSQL入门与进阶(十四)
Hangao database best practice configuration tool Hg_ BP log collection content
GJB common confused concepts
照片比例校正工具:DxO ViewPoint 3 直装版
MySQL operation database data error: fatal error encoded during command execution
一种简单通用的获取函数栈空间大小的方法
多行文本省略
C traps and defects Chapter 3 semantic "traps" 3.1 pointers and arrays