private double ValueStandarization(List<CriteriaDividing> criteriaValues, double indexValue, IndexOptimizationType optimType) { double xmax=criteriaValues[criteriaValues.Count-1].DividingValue;//todo:需要细化 double xmin=criteriaValues[0].DividingValue; if (optimType == IndexOptimizationType.Undefined) { MessageBox.Show("optimType is null!"); } if (indexValue==double.MaxValue)//todo: { return 100; } if(optimType==IndexOptimizationType.Negative) { if (indexValue > xmax) { return 0; } if (indexValue < xmin) { MessageBox.Show("the range of criteria is wrong!"); } double result = 100 - (indexValue - xmin) / (xmax - xmin) * 100; return result; } else if(optimType==IndexOptimizationType.Positive) { if (indexValue < xmin) { return 0; } if (indexValue >xmax) { MessageBox.Show("the range of criteria is wrong!"); } double result = (indexValue - xmin) / (xmax - xmin) * 100; return result; } else if (optimType == IndexOptimizationType.Middle) { double middle = criteriaValues[1].DividingValue; if (indexValue > xmax) { return 0; } if (indexValue < xmin) { MessageBox.Show("the range of criteria is wrong!"); } double result = 100 - (indexValue - xmin) / (xmax - xmin) * 100; return result; } else { MessageBox.Show("optimType is Undefined!"); return 0; } }
//public DenseVector CalculateFuzzyVector(string index,double originValue) //{ //MemberShipFun membershipFun = new MemberShipFun(); //membershipFun.ValueDivision = FiveLevelCriteria[index]; //var gradeFuzzyVector= membershipFun.TrapezoiMebership(originValue); //return gradeFuzzyVector; //} public double CalculateStandardGrade(string index, IndexOptimizationType optimType,double originValue) { var indexCriteria = criterias.Find(c => c.IndexName == index); if(indexCriteria==null) { MessageBox.Show("there is no criteria for this index"); } return ValueStandarization(indexCriteria.CriteriaValues, originValue, optimType); }