ELECTRE II方法中秩反转的matlab代码
时间: 2023-07-15 19:13:28 浏览: 190
ELECTRE II方法中的秩反转可以通过以下matlab代码实现:
假设有$n$个决策对象和$m$个决策准则,其中决策对象的得分矩阵为$X$,权重矩阵为$W$,阈值矩阵为$Q$,则可以按照以下步骤进行秩反转:
1. 计算正理想解和负理想解:
```matlab
v_plus = max(X,[],1); % 正理想解
v_minus = min(X,[],1); % 负理想解
```
2. 计算距离矩阵$D$:
```matlab
D = zeros(n,m);
for j = 1:m
D(:,j) = (W(j)*(X(:,j)-v_minus(j))) ./ (v_plus(j)-v_minus(j));
end
```
3. 计算排名矩阵$R$:
```matlab
[~,idx] = sort(D,'descend');
R = zeros(n,m);
for j = 1:m
[~,rank] = sort(idx(:,j));
R(:,j) = rank;
end
```
4. 计算秩反转后的距离矩阵$D^*$:
```matlab
R_star = m-R+1;
D_star = zeros(n,m);
for j = 1:m
D_star(:,j) = (W(j)*(v_plus(j)-X(:,j))) ./ (v_plus(j)-v_minus(j));
D_star(R_star(:,j)<=Q(j),j) = 0; % 秩反转
end
```
其中,$Q$为阈值矩阵,表示每个准则在秩反转前保留的排名数量。最终的决策对象排名可以通过对$D^*$进行排序得到:
```matlab
[~,idx] = sort(D_star,'descend');
rank = zeros(n,1);
for i = 1:n
[~,rank(i)] = sort(idx(i,:));
end
```
阅读全文