private void Optimize_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (operatingDataSet.Count == 0)
                {
                    throw new NullReferenceException();
                }

                var distance = metrics.Distance(operatingFunction);

                /*for (int i = 0; i < optimizationStepsCount; i++)
                 * {
                 *  distance -= distanceStep;
                 *  var newParameters = optimizer.Minimize(operatingFunction, distanceCount, distance, maxiter);
                 *
                 *  double s = 0;
                 *  for (int j = 0; j < newParameters.Length; j++)
                 *  {
                 *      s += Math.Pow(newParameters[j] - parametersFunctions[parametersFunctions.Count - 1][j], 2);
                 *  }
                 *  s /= newParameters.Length;
                 *  if (s > 0.01)
                 *  {
                 *      parametersFunctions.Add(newParameters);
                 *  }
                 * }*/

                var newParameters = minimizer.Minimize(operatingFunction, metrics, eps, maxiter);

                operatingFunction.SetParametersValues(newParameters);
                parametersFunctions.Add(newParameters);

                operatingFunctionParameters.Clear();
                foreach (var parameter in operatingFunction.GetParameters())
                {
                    var newParameter = new FunctionParameter(parameter.Key, parameter.Value);

                    operatingFunctionParameters.Add(newParameter);
                }

                DrawFunctions();

                LogBox.Text += string.Format("Используемая функция: {0}\n", FunctionChoice.Text);
                LogBox.Text += string.Format("Используемая метрика: {0}\n", MetricsChoice.Text);
                LogBox.Text += string.Format("Используемая функция: {0}\n\n", MinimizerChoice.Text);
                foreach (var parameter in operatingFunctionParameters)
                {
                    LogBox.Text += parameter.ParameterStringToPrint();
                }
                LogBox.Text += string.Format("Расстояние: {0}\n", metrics.Distance(operatingFunction));
                LogBox.Text += "------------------------------------------\n";
                LogBox.ScrollToLine(LogBox.LineCount - 2);

                ClearOptimize.IsEnabled = true;

                Optimize.IsEnabled        = false;
                PointsTable.IsEnabled     = false;
                ParametersTable.IsEnabled = false;
                AddingDotsMode.IsChecked  = false;
                AddingDotsMode.IsEnabled  = false;
                ClearPoints.IsEnabled     = false;
                MaxiterValue.IsEnabled    = false;
                EpsValue.IsEnabled        = false;
                FunctionChoice.IsEnabled  = false;
                MinimizerChoice.IsEnabled = false;
                MetricsChoice.IsEnabled   = false;
                PolynomDegree.IsEnabled   = false;
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("Задайте данные", "", MessageBoxButton.OK);
            }
        }