/// <summary>
        /// Фаззификация
        /// </summary>
        private double[] Fuzzificate(Problem problem)
        {
            if (problem.InputData == null)
            {
                throw new ArgumentOutOfBoundsException();
            }
            if (problem.InputData.Length != problem.ProblemConditions.Variables.Count - 1)
            {
                throw new ArgumentOutOfBoundsException();
            }

            double[] result = new double[problem.ProblemConditions.NumberOfConditions];
            int      i      = 0;

            InMemoryLogger.PrintMessage("Начало процедуры фаззификации");

            foreach (var rule in problem.ProblemConditions.Rules)
            {
                foreach (var condition in rule.Conditions)
                {
                    var id       = condition.FuzzyVariable.Id;
                    var variable = condition.FuzzyVariable;
                    result[i] = variable.GetValueForTerm(condition.Term, problem.InputData[id]);
                    InMemoryLogger.PrintMessage("Значение нечеткой перемнной: " + variable.Name + " : " + result[i] + " ");
                    i++;
                }
                //InMemoryLogger.PrintMessage();
            }

            InMemoryLogger.PrintMessage("Процедура фаззификации завершена");
            return(result);
        }
        /// <summary>
        /// Агрегация
        /// </summary>
        private double[] Aggregate(Problem problem, double[] fuzzificationResult)
        {
            int i = 0;
            int j = 0;

            double[] result = new double[problem.ProblemConditions.NumberOfConclusions];

            InMemoryLogger.PrintMessage("Начало процедуры аггрегации");

            foreach (var rule in problem.ProblemConditions.Rules)
            {
                double truthOfConditions = 1.0;
                foreach (var condition in rule.Conditions)
                {
                    truthOfConditions = System.Math.Min(truthOfConditions, fuzzificationResult[i]);
                    i++;
                }
                result[j] = truthOfConditions;
                InMemoryLogger.PrintMessage(rule + " Достоверность:" + result[j] + " ");
                j++;
            }
            //InMemoryLogger.PrintMessage();
            InMemoryLogger.PrintMessage("Процедура аггрегации завершена");

            return(result);
        }
        /// <summary>
        /// Композиция
        /// </summary>
        private UnionOfTerms Composite(Problem problem, double[] aggregationResult)
        {
            var result = new UnionOfTerms();

            InMemoryLogger.PrintMessage("Начало процедуры композиции");

            int i = 0;

            foreach (var rule in problem.ProblemConditions.Rules)
            {
                var term = rule.Conclusion.Term.Clone();
                term.AccessoryFunc.SetActivatedValue(aggregationResult[i]);
                result.Add(term);
                i++;
            }

            InMemoryLogger.PrintMessage("Процедура композиции завершена");
            return(result);
        }
        /// <summary>
        /// Дефаззификация
        /// </summary>
        private double Defuzzificate(UnionOfTerms compositionResult)
        {
            double x, y1 = 0.0, y2 = 0.0, step = 0.01;

            InMemoryLogger.PrintMessage("Начало процедуры дефаззификации");

            for (x = 0.0; x <= 1.0; x += step)
            {
                y1 += x * compositionResult.MaxValue(x);
            }
            for (x = 0.0; x <= 1.0; x += step)
            {
                y2 += compositionResult.MaxValue(x);
            }

            InMemoryLogger.PrintMessage("Результат: " + (y1 / y2));
            InMemoryLogger.PrintMessage("Процедура дефаззификации завершена");

            return(y1 / y2);
        }