import java.math.BigDecimal;
import java.util.Arrays;
//作者:刘兴
//http://www.doc88.com/p-8416975531497.html
//https://www.iteye.com/resource/a442180673-4328722
//看不出有啥用 w0[] = w2[]
//AHP 层次分析法计算权重
public class AHPComputeWeight {
public static void main(String[] args) {
double[][] a = { { 1, 3, 5 }, { 2, 3, 1 }, { 4, 7, 3 } };
// double[][] a = {
// {1,0.531,0.415,0.474
// }, {0.531,1,0.632,0.577
// }, {0.415,0.632,1,0.794
// }, {0.474,0.577,0.794,1}
// };
int N = a[0].length;
double[] weight = new double[N];
AHPComputeWeight instance = AHPComputeWeight.getInstance();
instance.weight(a, weight, N);
System.out.println("weight[] "+Arrays.toString(weight));
}
// 单例
private static final AHPComputeWeight acw = new AHPComputeWeight();
// 平均随机一致性指针
private double[] RI = { 0.00, 0.00, 0.58, 0.90, 1.12, 1.21, 1.32,
1.41, 1.45, 1.49 };
// 随机一致性比率
private double CR = 0.0;
// 最大特征值
private double lamta = 0;
//
private AHPComputeWeight() {
}
评论1