private bool CalculatePcm(double[][] matrix) { //insertLog("\nENTER FUNC()=> private bool calculatePCM(...)"); PrioritiesSelector ps = new PrioritiesSelector(); GeneralMatrix oldMatrix = new GeneralMatrix(matrix); //for all transposed elements calculate their inverse values GeneralMatrix newMatrix = AHPModel.ExpandUtility(oldMatrix); ps.ComputePriorities(newMatrix); //System.Math.Round(choices.GetElement(0, 0) * 100, 0)) InsertLog(string.Format("Consistency Ratio: {0}%", System.Math.Round(ps.ConsistencyRatio * 100, 0))); //if(ps.ConsistencyRatio == double.NaN) return(ps.ConsistencyRatio <= CiAcceptableValue); }
public void TestConsistencyRatio() { PrioritiesSelector ps = new PrioritiesSelector(); double[][] mat = new double[][] { new double[] { 1, 0.333333333, 2, 4 }, new double[] { 3, 1, 5, 3 }, new double[] { 0.5, 0.2, 1, 0.3333333333333 }, new double[] { 0.25, 0.3333333333333, 3, 1 } }; GeneralMatrix matrix = new GeneralMatrix(mat); ps.ComputePriorities(matrix); //should be 0.13900+change Assert.IsTrue(ps.ConsistencyRatio < 0.14); }
public void TestPriorities() { PrioritiesSelector ps = new PrioritiesSelector(); double[][] mat = new double[][] { new double[] { 1, 0.333333333, 2, 4 }, new double[] { 3, 1, 5, 3 }, new double[] { 0.5, 0.2, 1, 0.3333333333333 }, new double[] { 0.25, 0.3333333333333, 3, 1 } }; GeneralMatrix matrix = new GeneralMatrix(mat); ps.ComputePriorities(matrix); GeneralMatrix pr = ps.CalculatedMatrix; Assert.IsTrue(System.Math.Round(pr.GetElement(0, 0), 2) == 0.26); }