public EvaluationViewModel(IEnumerable<FuzzyVariableViewModel> input, FuzzyConfiguration fuzzyConfiguration, ControllerConfiguration controllerConfiguration)
            : this()
        {
            if (fuzzyConfiguration == null) 
                throw new ArgumentNullException("fuzzyConfiguration");
            if (controllerConfiguration == null) 
                throw new ArgumentNullException("controllerConfiguration");

            foreach (var inputVar in input.Select(item => item.NumericVariable))
            {
                var numVm = new NumericValueViewModel
                {
                    Identifier = inputVar.Identifier,
                    MinValue = inputVar.MinValue,
                    MaxValue = inputVar.MaxValue,
                    Value =  0
                };
                if (numVm.MinValue.HasValue && numVm.Value < numVm.MinValue.Value)
                    numVm.Value = numVm.MinValue;

                if (numVm.MaxValue.HasValue && numVm.Value > numVm.MaxValue.Value)
                    numVm.Value = numVm.MaxValue;

                NumericValues.Add(numVm);
            }

            _fuzzyController = new FuzzyController(fuzzyConfiguration, controllerConfiguration);
        }
Example #2
0
        public FuzzyController(FuzzyConfiguration fuzzyConfiguration, ControllerConfiguration controllerConfiguration)
        {
            _fuzzification = fuzzyConfiguration.Fuzzification;
            _iterations = fuzzyConfiguration.Iterations;
            _defuzzification = fuzzyConfiguration.Defuzzification;

            _fuzzifier = controllerConfiguration.Fuzzifier;
            _inference = controllerConfiguration.Inference;
            _defuzzifier = controllerConfiguration.Defuzzifier;
        }