当前位置:网站首页>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边栏推荐
- Singleton mode (hungry and lazy)
- Leetcode 1331 array sequence number conversion [map] the leetcode path of heroding
- What is SOA (Service Oriented Architecture)?
- C language programming | exchange binary odd and even bits (macro Implementation)
- 美联储再加息,75基点 鲍威尔“放鸽”,美股狂欢
- MYCAT read / write separation configuration
- C陷阱与缺陷 第3章 语义“陷阱” 3.8 运算符&&、||和!
- Regular expression bypasses WAF
- ShardingSphere之水平分表实战(三)
- Implement Lmax disruptor queue from scratch (VI) analysis of the principle of disruptor solving pseudo sharing and consumers' elegant stopping
猜你喜欢

Practical guidance for interface automation testing (Part I): what preparations should be made for interface automation

带你来浅聊一下,单商户功能模块汇总

Verilog:阻塞赋值和非阻塞赋值

Detailed steps for installing MySQL 8.0 under Linux
![[technology 1]](/img/eb/63baf1ae3931a156a0a5b377a9b7d1.jpg)
[technology 1]

mycat读写分离配置

【C】 Array

Self study notes on Apache file management -- mapping folders and configuring Apache virtual machines based on single IP and multi domain names
![LeetCode 1331 数组序号转换[Map] HERODING的LeetCode之路](/img/be/d429d0c437dc5ed7cb4448e223a83a.png)
LeetCode 1331 数组序号转换[Map] HERODING的LeetCode之路

Introduction to JVM foundation I (memory structure)
随机推荐
数字图像处理 第10章——图像分割
C obtains JSON format data asynchronously from the web address
Redis configuration cache expiration listening event trigger
makefile详解
During the year, the first "three consecutive falls" of No. 95 gasoline returned to the "8 Yuan era"“
国产ERP有没有机会击败SAP ?
July 28, 2022 Gu Yujia's study notes
mycat读写分离配置
Singleton mode (hungry and lazy)
Three military product baselines (functional baseline, distribution baseline, product baseline) and the documents contained in the baseline
[open the door to the new world] see how the old bird of testing plays API testing between applause
C和指针 第3章 语义“陷阱” 3.5 空指针并非字符串
Redis之sentinel哨兵集群怎么部署
MYSQL入门与进阶(十二)
Alibaba Sentinel - 工作流程及原理解析
Detailed steps for installing MySQL 8.0 under Linux
SAP 中国本地化内容汇总
A case of gradually analyzing the splitting of classes -- colorful ball collisions
服务器运行管理制度
Rongyun real-time community solution