Exemplo n.º 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);
            }
        }
Exemplo n.º 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);
         }
     }
 }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Important! Calculate m (mass assignment) (phep gan khoi), calculate prob (A->B)
        /// </summary>
        /// <param name="discFS1">A</param>
        /// <param name="discFS2">B</param>
        /// <param name="rel"></param>
        /// <returns></returns>
        public double interpreteForDiscFS(DiscreteFuzzySetBLL discFS1, DiscreteFuzzySetBLL discFS2, string rel)
        {
            double result = 0;
            //calculate m (Phep gan khoi).
            MassAssignmentBLL mass1 = new MassAssignmentBLL(discFS1);
            MassAssignmentBLL mass2 = new MassAssignmentBLL(discFS2);

            for (int i = 0; i < mass1.ProSubset.Count; i++)
            {
                for (int j = 0; j < mass2.ProSubset.Count; j++)
                {
                    double add = (relProbOnSets(mass1.ProSubset[i].Subset, mass2.ProSubset[j].Subset, rel)) * (mass1.ProSubset[i].MassSubset) * (mass2.ProSubset[j].MassSubset);
                    result = result + add;
                }
            }
            return(Math.Round(result, 4));
        }
Exemplo n.º 6
0
 public DiscreteFuzzySetBLL(DiscreteFuzzySetBLL disFuzzy)
     : base(disFuzzy)
 {
     this.valueSet      = disFuzzy.valueSet;
     this.membershipSet = disFuzzy.membershipSet;
 }
Exemplo n.º 7
0
 public MassAssignmentBLL()
 {
     this.disFuzzy  = new DiscreteFuzzySetBLL();
     this.proSubset = new List <ProbSubSetBLL>();
 }
Exemplo n.º 8
0
 public MassAssignmentBLL(MassAssignmentBLL massAssign)
 {
     this.disFuzzy  = massAssign.disFuzzy;
     this.proSubset = massAssign.proSubset;
 }
Exemplo n.º 9
0
 public MassAssignmentBLL(DiscreteFuzzySetBLL dis, List <ProbSubSetBLL> pro)
 {
     this.disFuzzy  = dis;
     this.proSubset = pro;
 }
Exemplo n.º 10
0
 public MassAssignmentBLL(DiscreteFuzzySetBLL dis)
 {
     this.disFuzzy  = dis;
     this.proSubset = new List <ProbSubSetBLL>();
     setMassAssignment();
 }