private static double CompareContFS(object one, object two, string rel) { ContinuousFuzzySetBLL contfs1 = new ContinuousFuzzySetBLL().GetContinuousFuzzySetByName(one.ToString().Trim()); ContinuousFuzzySetBLL contfs2 = new ContinuousFuzzySetBLL(two.ToString()); if (contfs2.CheckContinuousFuzzySetByName(two.ToString().Trim())) { contfs2 = new ContinuousFuzzySetBLL().GetContinuousFuzzySetByName(two.ToString().Trim()); } else { if (!new FProDataTypeBLL().IsDataType(two.ToString().Trim(), "Double")) { contfs2.FuzzySetName = two.ToString().Trim(); contfs2.SetValue(0, 0, 0, 0); } else { contfs2.FuzzySetName = two.ToString().Trim(); double val = Convert.ToDouble(two.ToString()); contfs2.SetValue(val, val, val, val); } } if (contfs1 == null || contfs2 == null) { return(-1.0); } else { FuzzyInterpreter fuzzinter = new FuzzyInterpreter(); double pro = fuzzinter.interpreteForContFS(contfs1, contfs2, rel); return(pro); } }
/// <summary> /// Important! Get set of fuzzy from library /// </summary> /// <param name="one"></param> /// <param name="two"></param> /// <param name="rel"></param> /// <returns></returns> private static double CompareDisFS(object one, object two, string rel) { DiscreteFuzzySetBLL disfs1 = DiscreteFuzzySetBLL.GetByName(one.ToString().Trim()); DiscreteFuzzySetBLL disfs2 = new DiscreteFuzzySetBLL(two.ToString().Trim()); if (disfs2.CheckDiscFuzzySetByName(two.ToString().Trim())) { disfs2 = DiscreteFuzzySetBLL.GetByName(two.ToString().Trim()); } else { if (!new FProDataTypeBLL().IsDataType(two.ToString().Trim(), "Double")) { disfs2.FuzzySetName = two.ToString().Trim(); disfs2.ValueSet.Add(0); disfs2.MembershipSet.Add(0); } else { disfs2.FuzzySetName = two.ToString().Trim(); disfs2.ValueSet.Add(Double.Parse(two.ToString())); disfs2.MembershipSet.Add(1); } } if (disfs1 == null || disfs2 == null) { return(-1.0); } else { FuzzyInterpreter fuzzinter = new FuzzyInterpreter(); double pro = fuzzinter.interpreteForDiscFS(disfs1, disfs2, rel); return(pro); } }