Beispiel #1
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            LinguisticVariable variable = obj as LinguisticVariable;

            if ((System.Object)variable == null)
            {
                return(false);
            }


            return(this.MaxValue == variable.MaxValue &&
                   this.MinValue == variable.MinValue &&
                   this.Name.Equals(variable.Name) &&
                   this.Terms.SequenceEqual(variable.Terms));
        }
 public void Remove(LinguisticVariable variable)
 {
     if (variable.Type == LinguisticVariableType.Input)
     {
         InputLinguisticVariables.Remove(variable);
     }
     else if (variable.Type == LinguisticVariableType.Output)
     {
         OutputLinguisticVariables.Remove(variable);
     }
 }
Beispiel #3
0
        public Term CreateTermForVariable(string name, LinguisticVariable variable, IFuzzyFunction function)
        {
            Term term = new Term(name);

            term.Variable = variable;
            term.SetFunction(function);

            variable.Terms.Add(term);

            return(term);
        }
        public LinguisticVariable GetLinguisticVariable(String name)
        {
            LinguisticVariable inputVariableByName  = GetInputVariableByName(name);
            LinguisticVariable outputVariableByName = GetOutputVariableByName(name);

            if (inputVariableByName != null)
            {
                return(inputVariableByName);
            }
            else if (outputVariableByName != null)
            {
                return(outputVariableByName);
            }
            else
            {
                throw new LinguisticVariableNotFoundException("Linguistic variable not found");
            }
        }
        public LinguisticVariableType GetLinguisticVariableType(LinguisticVariable variable)
        {
            LinguisticVariable variableInInputList = InputLinguisticVariables
                                                     .FirstOrDefault(curVariable => curVariable.Equals(variable));

            if (variableInInputList != null)
            {
                return(LinguisticVariableType.Input);
            }

            LinguisticVariable variableInOutputList = OutputLinguisticVariables
                                                      .FirstOrDefault(curVariable => curVariable.Equals(variable));

            if (variableInOutputList != null)
            {
                return(LinguisticVariableType.Output);
            }

            return(LinguisticVariableType.Undefined);
        }