Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
 private static bool EqualContFS(object one, object two)
 {
     if (one.ToString().Trim() == two.ToString().Trim())
     {
         return(true);
     }
     else
     {
         ContinuousFuzzySetBLL contfs1 = new ContinuousFuzzySetBLL().GetContinuousFuzzySetByName(one.ToString().Trim());
         ContinuousFuzzySetBLL contfs2 = new ContinuousFuzzySetBLL().GetContinuousFuzzySetByName(two.ToString().Trim());
         if (contfs1 == null || contfs2 == null)
         {
             return(false);
         }
         else
         {
             if (contfs1.TopRight <= contfs2.TopRight && contfs1.TopRight >= contfs2.TopLeft)
             {
                 return(true);
             }
             else
             {
                 if (contfs2.TopRight >= contfs1.TopLeft && contfs2.TopRight <= contfs1.TopRight)
                 {
                     return(true);
                 }
                 return(false);
             }
         }
     }
 }
Ejemplo n.º 3
0
 public ContinuousFuzzySetBLL(ContinuousFuzzySetBLL consFuzzy)
     : base(consFuzzy)
 {
     this.bottomLeft  = consFuzzy.bottomLeft;
     this.topLeft     = consFuzzy.topLeft;
     this.topRight    = consFuzzy.topRight;
     this.bottomRight = consFuzzy.bottomRight;
 }
Ejemplo n.º 4
0
        private DiscreteFuzzySetBLL discretize(ContinuousFuzzySetBLL contFS, double beginPoint, double epsilon)
        {
            DiscreteFuzzySetBLL discFS = new DiscreteFuzzySetBLL();

            discFS.FuzzySetName = contFS.FuzzySetName;
            for (double val = beginPoint; val <= contFS.BottomRight; val += epsilon)
            {
                double mbs = contFS.GetMembershipAt(val);
                discFS.AddPoint(val, mbs);
            }
            return(discFS);
        }
Ejemplo n.º 5
0
        public double interpreteForContFS(ContinuousFuzzySetBLL contFS1, ContinuousFuzzySetBLL contFS2, string rel)
        {
            int everageNumPoint = 20;
            //double epsilon = 0.1;
            double beginPoint1 = contFS1.BottomLeft;
            double beginPoint2 = contFS2.BottomLeft;

            double epsilon = (beginPoint1 + beginPoint2) / everageNumPoint;

            DiscreteFuzzySetBLL discFS1 = discretize(contFS1, beginPoint1, epsilon);

            DiscreteFuzzySetBLL discFS2 = discretize(contFS2, beginPoint2, epsilon);

            return(interpreteForDiscFS(discFS1, discFS2, rel));
        }