usingahp.m

来自「一个matlab的AHP库函数,用于解决关于AHP层次分析的问题」· M 代码 · 共 41 行

M
41
字号
function UsingAHP
%AHPCALC    Perform a complete AHP calculation
%    [FINALRANK,RANK,RC]=AHPCALC(ORDER,ALTVCRITERIA,CRITVCRITERIA)
%
%    For N alternatives and M criteria for ranking:
%
%     ORDER is a matrix with M rows and N columns.
%       The elements of the I_th row are the integers 1 to N,
%       indexing the alternatives in descending order of preference
%       with respect to criterion I.
%
%     ALTVCRITERIA is a matrix with M rows and N*(N-1)/2 columns.
%       The I_th row contains the upper triangular entries of the AHP
%       reciprocal matrix ranking the N alternatives with respect to
%       criterion I, in the descending order of preference indicated
%       in the I_th row of ORDER. 
%
%     CRITVCRITERIA may be a vector of length M*(M-1)/2 giving the
%       upper triangular entries of the AHP reciprocal matrix
%       comparing the criteria, or it may be a normalized vector of
%       length M giving the AHP vector weighting the criteria.
%
%    RC is the vector giving the normalized weights of the
%     criteria. Note that if CRITVCRITERIA is specified as a
%     normalized vector, then RC=CRITVCRITERIA
%
%    FINALRANK is a normalized vector of length N giving the overall
%     ranking of the alternatives.
%
%    The rows of RANK give the ranking of the alternatives with
%     respect to the individual attributes.
%    
m=5;
n=10;
order=zeros(m,n);
for i=1:m
    order(i,:)=RandIndexP(n);
end
altvcriteria=rand(m,n*(n-1)/2);
critvcriteria=rand(1,m*(m-1)/2);
[finalrank,rank,rc]=ahpcalc(order,altvcriteria,critvcriteria)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?