Пример #1
0
        /// <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);
            }
        }
Пример #2
0
 private static bool EqualDisFS(object one, object two)
 {
     if (one.ToString().Trim() == two.ToString().Trim())
     {
         return(true);
     }
     else
     {
         DiscreteFuzzySetBLL disfs1 = DiscreteFuzzySetBLL.GetByName(one.ToString().Trim());
         DiscreteFuzzySetBLL disfs2 = DiscreteFuzzySetBLL.GetByName(two.ToString().Trim());
         if (disfs1 == null || disfs2 == null)
         {
             return(false);
         }
         else
         {
             List <Double> h1 = disfs1.getXsForMembership(0.1);
             List <Double> h2 = disfs2.getXsForMembership(0.1);
             for (int i = 0; i < h1.Count; i++)
             {
                 for (int j = 0; j < h2.Count; j++)
                 {
                     if (h1[i] == h2[j])
                     {
                         return(true);
                     }
                 }
             }
             return(false);
         }
     }
 }