Introduction
The topsis comprehensive evaluation method is a method of sorting according to the closeness of a limited number of evaluation objects to the idealized target. The TOPSIS method is a commonly used and effective method in multi-objective decision analysis, also known as the superior-inferior solution distance method.
Application Scenario
There are enough evaluation indicators and data, and the types of evaluation indicators are different.
concept
- positive ideal solution
Assuming the best scheme, its corresponding attribute value at least reaches the best value of each scheme.
- negative ideal solution
Assuming the worst scheme, its corresponding attribute value is not better than the worst value of each scheme.
- Satisfactory solution
The feasible solution that is closest to the positive ideal solution and farthest from the negative ideal solution is a satisfactory solution .
data preprocessing
- Interval attribute transformation
The optimal interval is [a, b], which is the intolerable lower limit, which is the intolerable lower limit. In the optimal attribute interval, the value is set to 1, not in
The optimal attribute interval, but within the acceptable range [ , ], adjust it to a number between 0 and 1 according to the formula.
-
vector normalization
Use the formula to transform. After the transformation, different indicators are in the same order of magnitude, between 0 and 1. Some indicators need to be transformed first by interval and then normalized by vector.
Formula: Divide the element by the sum of the squares of the column where it is located, and then open the root sign.
Examples and codes
clc, clear
a=[0.1 5 5000 4.7
0.2 6 6000 5.6
0.4 7 7000 6.7
0.9 10 10000 2.3
1.2 2 400 1.8];
[m,n]=size(a);
x2=@(qujian,lb,ub,x)(1-(qujian(1)-x)./(qujian(1)-lb)).*...
(x>=lb & x<qujian(1))+(x>=qujian(1) & x<=qujian(2))+...
(1-(x-qujian(2))./(ub-qujian(2))).*(x>qujian(2) & x<=ub);
qujian=[5,6]; lb=2; ub=12;
a(:,2)=x2(qujian,lb,ub,a(:,2)); %对属性2进行变换
b=a./vecnorm(a) %利用矩阵广播进行向量规范化
w=[0.2 0.3 0.4 0.1];
c=b.*w; %利用矩阵广播求加权矩阵
Cstar=max(c); %求正理想解
Cstar(4)=min(c(:,4)) %属性4为成本型的
C0=min(c); %q求负理想解
C0(4)=max(c(:,4)) %属性4为成本型的
Sstar=vecnorm(c-Cstar,2,2) %逐行计算2范数即到正理想解的距离
S0=vecnorm(c-C0,2,2) %逐行计算2范数即到负理想解的距离
f=S0./(Sstar+S0)
[sf,ind]=sort(f,'descend') %求排序结果