Exemplo n.º 1
0
        public static FuzzySet2D MaxMultCompose(FuzzySet2D R, FuzzySet2D S)
        {
            List <double> zList = new List <double>();

            zList.AddRange(R.getUniqueX2());
            zList.AddRange(S.getUniqueX1());
            List <double> xList = new List <double>();

            xList.AddRange(R.getUniqueX1());
            List <double> yList = new List <double>();

            yList.AddRange(S.getUniqueX2());
            FuzzySet2D res = new FuzzySet2D();

            foreach (double x in xList)
            {
                foreach (double y in yList)
                {
                    double sup = 0;
                    foreach (double z in zList)
                    {
                        double tmp = R.Mu(x, z) * S.Mu(z, y);
                        if (tmp > sup)
                        {
                            sup = tmp;
                        }
                    }
                    res.AddDot(x, y, sup);
                }
            }
            return(res);
        }
Exemplo n.º 2
0
        public static FuzzySet2D MinMaxCompose(FuzzySet2D R, FuzzySet2D S)
        {
            List <double> zList = new List <double>();

            zList.AddRange(R.getUniqueX2());
            zList.AddRange(S.getUniqueX1());
            List <double> xList = new List <double>();

            xList.AddRange(R.getUniqueX1());
            List <double> yList = new List <double>();

            yList.AddRange(S.getUniqueX2());
            FuzzySet2D res = new FuzzySet2D();

            foreach (double x in xList)
            {
                foreach (double y in yList)
                {
                    double inf = 1;
                    foreach (double z in zList)
                    {
                        double tmp = Math.Max(R.Mu(x, z), S.Mu(z, y));
                        if (tmp < inf)
                        {
                            inf = tmp;
                        }
                    }
                    res.AddDot(x, y, inf);
                }
            }
            return(res);
        }
Exemplo n.º 3
0
 public FuzzySet2D(FuzzySet2D fs) : this()
 {
     foreach (KeyValuePair <PairD, double> pair in fs.dots)
     {
         this.AddDot(pair.Key.X1, pair.Key.X2, pair.Value);
     }
 }
Exemplo n.º 4
0
        public static FuzzySet2D operator /(FuzzySet2D f1, FuzzySet2D f2)
        {
            if (!f1.discrete || !f2.discrete)
            {
                return(null);
            }
            FuzzySet2D res = new FuzzySet2D();

            foreach (KeyValuePair <PairD, double> pair in f1.dots)
            {
                if (pair.Value - f2.Mu(pair.Key.X1, pair.Key.X2) > 0)
                {
                    res.AddDot(pair.Key.X1, pair.Key.X2, pair.Value - f2.Mu(pair.Key.X1, pair.Key.X2));
                }
            }
            return(res);
        }
Exemplo n.º 5
0
        public static FuzzySet2D operator *(FuzzySet1D f1, FuzzySet1D f2)
        {
            if (!f1.discrete || !f2.discrete)
            {
                return(null);
            }
            FuzzySet2D res = new FuzzySet2D();

            foreach (KeyValuePair <double, double> p1 in f1.dots)
            {
                foreach (KeyValuePair <double, double> p2 in f2.dots)
                {
                    res.AddDot(p1.Key, p2.Key, Math.Min(p1.Value, p2.Value));
                }
            }
            return(res);
        }