예제 #1
0
        public TRFN Multiplication(TRFN N1, TRFN N2)
        {
            OperacionesNumericas opn = new OperacionesNumericas();
            double t  = (tmult(N1, N2).Max() - tmult(N1, N2).Min()) / 2;
            double ab = opn.ValorAbsoluto((N1.U * N2.Alfa) + opn.ValorAbsoluto(N2.U * N1.Alfa));

            return(new TRFN(Constantes.NDType.AlfaBetaType, opn.Media(N1.L, N1.U) * opn.Media(N2.L, N2.U) - t, opn.Media(N1.L, N1.U) * opn.Media(N2.L, N2.U) + t, opn.ValorAbsoluto(ab), opn.ValorAbsoluto(ab)));
        }
예제 #2
0
        public TRFN Addition(List <TRFN> NL)
        {
            TRFN result = new TRFN(0);

            foreach (TRFN N in NL)
            {
                result = Addition(result, N);
            }
            return(result);
        }
예제 #3
0
        public FuzzyParameter(string name, double n1, double n2, double n3, double n4)
        {
            this.Name = name;

            if (n1 < n2 && n2 < n3 && n3 < n4)
            {
                this.Value = new TRFN(Constantes.NDType.NumType, n1, n2, n3, n4);
            }
            else
            {
                this.Value = new TRFN(Constantes.NDType.AlfaBetaType, n1, n2, n3, n4);
            }
        }
예제 #4
0
        public TRFN OperateConstant(TRFN N, string op, double constant)
        {
            switch (op)
            {
            case Constantes.Suma: return(new TRFN(Constantes.NDType.AlfaBetaType, N.L + constant, N.U + constant, N.Alfa + _opNum.ValorAbsoluto(constant), N.Beta + _opNum.ValorAbsoluto(constant)));

            case Constantes.Resta: return(new TRFN(Constantes.NDType.AlfaBetaType, N.L - constant, N.U - constant, N.Alfa + _opNum.ValorAbsoluto(constant), N.Beta + _opNum.ValorAbsoluto(constant)));

            case Constantes.Multiplicacion: return(new TRFN(Constantes.NDType.AlfaBetaType, N.L * constant, N.U * constant, N.Alfa * _opNum.ValorAbsoluto(constant), N.Beta * _opNum.ValorAbsoluto(constant)));

            case Constantes.Division: return((constant != 0) ? (new TRFN(Constantes.NDType.AlfaBetaType, N.L / constant, N.U / constant, N.Alfa / _opNum.ValorAbsoluto(constant), N.Beta / _opNum.ValorAbsoluto(constant))) : null);

            default: return(null);
            }
        }
예제 #5
0
 public FuzzyParameter(string name, TRFN value)
 {
     this.Name  = name;
     this.Value = value;
 }
예제 #6
0
 public IEnumerable <TRFN> OperateFuzzyConstant(IEnumerable <double> ListN, string op, TRFN constant)
 {
     return(ListN.Select(x => OperateConstant(constant, op, x)).ToList());
 }
예제 #7
0
 public TRFN Rest(TRFN N1, TRFN N2)
 {
     return(!(IsEquivalent(N1, N2)) ? Addition(N1, MakeNegative(N2)) : new TRFN(0));
 }
예제 #8
0
 public TRFN MakeNegative(TRFN N)
 {
     return((N != null) ? new TRFN(Constantes.NDType.AlfaBetaType, -N.U, -N.L, N.Alfa, N.Beta) : null);
 }
예제 #9
0
 public TRFN Subtraction(TRFN N1, TRFN N2)
 {
     return(new TRFN(Constantes.NDType.AlfaBetaType, N1.L - N2.L, N1.U - N2.U, N1.Alfa + N2.Alfa, N1.Beta + N2.Beta));
 }
예제 #10
0
 private IEnumerable <double> tmult(TRFN N1, TRFN N2)
 {
     return(new double[4] {
         N1.L *N2.L, N1.L *N2.U, N1.U *N2.L, N1.U *N2.U
     });
 }
예제 #11
0
 public TRFN Addition(TRFN N1, TRFN N2)
 {
     return(new TRFN(Constantes.NDType.AlfaBetaType, N1.L + N2.L, N1.U + N2.U, N1.Alfa + N2.Alfa, N1.Beta + N2.Beta));
 }
예제 #12
0
 public bool IsZero(TRFN n)
 {
     return(n.L + n.U == 0);
 }
예제 #13
0
 public bool IsEquivalent(TRFN N1, TRFN N2)
 {
     return((N1.L + N1.U) / 2 == (N2.L + N2.U) / 2);
 }
예제 #14
0
 public IEnumerable <TRFN> MultiplicationFuzzyConstant(IEnumerable <TRFN> ListN, TRFN constant)
 {
     return(ListN.Select(x => Multiplication(constant, x)).ToList());
 }