6 vues (au cours des 30 derniers jours)
Rahim Rahim le 13 Fév 2023
I followed all the steps of the `MARCOS` (: Measurement of alternatives and ranking according to Compromise
solution) algorithm. I tried it and I follow the algorithm but always the code gave me the same restulats. Please help me... everything is okay the problem is `FKm` and `FKp`, always give the same values.
For example, lets try the alternatives are:
Networks =
8 50 4 134 12 67
66 74 1 50 42 75
42 60 49 285 5 68
47 60 45 68 6 63
8 50 4 145 17 61
61 83 1 44 11 63
48 60 59 288 4 75
45 60 21 95 4 33
and the weights:
weights= 0.0360 0.1240 0.1040 0.3250 0.3070 0.1020
```
function Score = MARCOS(Networks,Weights)
global CostperByte;
global Security;
global DataRate;
global PacketDelay;
global PacketJitter;
global PacketLoss;
%NumberOfNetworks;
CostperByte=1;
Security=2;
DataRate=3;
PacketDelay=4;
PacketJitter=5;
PacketLoss=6;
SIZE = size(Networks);
NumberOfNetworks = SIZE(1);
NumberOfCriteria = SIZE(2);
AAI=zeros(1,NumberOfCriteria);
AI= zeros(1,NumberOfCriteria);
for j=1:NumberOfCriteria
if ( (j==DataRate) || (j==Security) ) % benifit
AAI(1,j)= min (Networks(:,j));
AI(1,j)=max (Networks(:,j));
else
AAI(1,j)=max (Networks(:,j));
AI(1,j)=min(Networks(:,j));
end
end
Networks= [ AAI ; Networks ; AI];
SIZE = size(Networks);
NumberOfNetworks = SIZE(1);
NumberOfCriteria = SIZE(2);
Normalization=[];
for i=1:NumberOfNetworks
for j=1:NumberOfCriteria
if ( (j==DataRate) || (j==Security) ) %%%%%%% data rate, security, bandwidth
Normalization(i,j) = ( Networks (i,j)) / AI(1,j) ;
else %%%%%%% jitter, delay,st,
Normalization(i,j) = AI(1,j) / ( Networks (i,j));
end
end
end
for i=1: NumberOfNetworks
for j=1: NumberOfCriteria
W(i,j)=Normalization(i,j)*Weights(j);
end
end
Saai= sum(W(1,:));
Sai= sum(W(NumberOfNetworks,:)) ;
W=W(2:NumberOfNetworks-1,:);
SIZE = size(W );
NumberOfNetworks = SIZE(1);
NumberOfCriteria = SIZE(2);
for i=1:NumberOfNetworks
S(i) =sum( W(i,:));
end
for i = 1: NumberOfNetworks
Km(i) = S(i)/ Saai;
Kp(i) = S(i) / Sai;
end
for i=1:NumberOfNetworks
FKm(i) = Kp(i)/( Kp(i)+Km(i));
FKm(i)
FKp(i) = Km(i)/( Kp(i)+Km(i));
end
for i=1:NumberOfNetworks
FK(i)= ( FKm(i) + (FKp(i)) ) / ( 1+ ( (1-FKp (i))/FKp(i) ) + ( (1-FKm(i))/FKm(i) ) ) ;
end
%%summation%%
Results=[];
for i=1:NumberOfNetworks
Results= [Results; FK(i) ];
end
Score= Results;
end```
**Tried the code above
**
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange

R2021a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by