private double Centroid(List<FuzzyNumber> nums, LingVariable variable) { double stepN = 17; double start = variable.Range[0]; double end = variable.Range[1]; double step = (end - start) / (stepN - 1); double uppersum = 0; double lowersum = 0; for (int i = 0; i < nums.Count; i++) { MemberShipFunction mf = variable.getMFbyName(nums[i].MemberShipName); for (double j = start; j < end; j = step + j) { double value = mf.getOutput(j); if (value > 0) { if (value < nums[i].FuzzyValue) { uppersum = value * j + uppersum; lowersum = value + lowersum; } else { uppersum = nums[i].FuzzyValue * j + uppersum; lowersum = nums[i].FuzzyValue + lowersum; } } } } return (uppersum / lowersum); }
private double Centroid(List <FuzzyNumber> nums, LingVariable variable) { double stepN = 17; double start = variable.Range[0]; double end = variable.Range[1]; double step = (end - start) / (stepN - 1); double uppersum = 0; double lowersum = 0; for (int i = 0; i < nums.Count; i++) { MemberShipFunction mf = variable.getMFbyName(nums[i].MemberShipName); for (double j = start; j < end; j = step + j) { double value = mf.getOutput(j); if (value > 0) { if (value < nums[i].FuzzyValue) { uppersum = value * j + uppersum; lowersum = value + lowersum; } else { uppersum = nums[i].FuzzyValue * j + uppersum; lowersum = nums[i].FuzzyValue + lowersum; } } } } return(uppersum / lowersum); }
private double MaxHeightDeFuzzifcation(List <FuzzyNumber> nums, LingVariable variable) { double lowvalue = 0; double highvalue = 0; for (int i = 0; i < nums.Count; i++) { MemberShipFunction mf = variable.getMFbyName(nums[i].MemberShipName); highvalue = ((mf.CenterOfMass * getImplication(nums[i].FuzzyValue, mf.getOutput(mf.CenterOfMass))) / (mf.Spread * mf.Spread)) + highvalue; lowvalue = (getImplication(nums[i].FuzzyValue, mf.getOutput(mf.CenterOfMass)) / (mf.Spread * mf.Spread)) + lowvalue; } return(highvalue / lowvalue); }
private double MaxHeightDeFuzzifcation(List<FuzzyNumber> nums, LingVariable variable) { double lowvalue = 0; double highvalue = 0; for (int i = 0; i < nums.Count; i++) { MemberShipFunction mf = variable.getMFbyName(nums[i].MemberShipName); highvalue = ((mf.CenterOfMass * getImplication(nums[i].FuzzyValue, mf.getOutput(mf.CenterOfMass))) / (mf.Spread * mf.Spread)) + highvalue; lowvalue = (getImplication(nums[i].FuzzyValue, mf.getOutput(mf.CenterOfMass)) / (mf.Spread * mf.Spread)) + lowvalue; } return (highvalue / lowvalue); }