当前位置:网站首页>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边栏推荐
- Introduction and advanced level of MySQL (11)
- Reproduce 20 character short domain name bypass and XSS related knowledge points
- 单例模式(饿汉式 懒汉式)
- Redis配置缓存过期监听事件触发
- 2022-07-28 study notes of group 4 self-cultivation class (every day)
- Sanzi chess (player + computer)
- Inventory of domestic and foreign project collaborative management software: SAAS and customization become a trend
- Digital image processing Chapter 10 - image segmentation
- shell脚本总结
- C和指针 第3章 语义“陷阱” 3.5 空指针并非字符串
猜你喜欢

The Federal Reserve raised interest rates again, Powell "let go of doves" at 75 basis points, and US stocks reveled

Introduction to JVM foundation I (memory structure)

照片比例校正工具:DxO ViewPoint 3 直装版
![Leetcode 1331 array sequence number conversion [map] the leetcode path of heroding](/img/be/d429d0c437dc5ed7cb4448e223a83a.png)
Leetcode 1331 array sequence number conversion [map] the leetcode path of heroding

"PHP Basics" output approximate value of PI

Rongyun real-time community solution

Shell programming specifications and variables

Idea configuration web container and war packaging
![[robot learning] matlab kinematics and ADMAS dynamics analysis of manipulator gripper](/img/e1/a67048ea69bfe6064651d459311a88.png)
[robot learning] matlab kinematics and ADMAS dynamics analysis of manipulator gripper

2022-07-28 第四小组 修身课 学习笔记(every day)
随机推荐
makefile详解
Three military product baselines (functional baseline, distribution baseline, product baseline) and the documents contained in the baseline
C language programming | exchange binary odd and even bits (macro Implementation)
Practical guidance for interface automation testing (Part I): what preparations should be made for interface automation
C陷阱与缺陷 第3章 语义“陷阱” 3.9 整数溢出
How close can QA be to business code Direct exposure of defects through codediff
Summary of SAP localized content in China
Regular expression bypasses WAF
力扣刷题之数组序号计算(每日一题7/28)
军品三大基线(功能基线、分配基线、产品基线)及基线包含的文件
Shell programming specifications and variables
Anti vulnerability · benefit from uncertainty --- management?
mycat读写分离配置
C traps and defects Chapter 3 semantic "traps" 3.3 array declaration as parameters
3D高级渲染器:Artlantis studio 2021.2中文版
Kubernetes-1.24.x feature
Idea configuration web container and war packaging
How close can QA be to business code QA conducts testability transformation on business code
2022-07-28 顾宇佳 学习笔记
13_ UE4 advanced_ Montage animation realizes attack while walking