예제 #1
0
 /// <summary>
 ///     Выбираем метод
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void methodComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     _currMethod = _methods[methodComboBox.SelectedIndex];
     _methodChosen = true;
     UpdateForm();
 }
예제 #2
0
 /// <summary>
 ///     Нажатие кнопки "TEST ALL"
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void materialFlatButton1_Click(object sender, EventArgs e)
 {
     var exports = new List<TestExport>(_functions.Count*_methods.Count);
     foreach (var function in _functions)
     {
         ParseFunction(function);
         foreach (var method in _methods)
         {
             _currMethod = method;
             _currMethod.AlphaMethod = null;
             Vector<double> start = new DenseVector(_varCount);
             try
             {
                 var text = startingPointTextBox.Text;
                 var textValues = text.Split(',');
                 for (var i = 0; i < _varCount; i++)
                 {
                     start[i] = double.Parse(textValues[i]);
                 }
             }
             catch (Exception)
             {
                 start.Clear();
             }
             var fh = new FunctionHolder(_currFunction, start);
             _currMethod.Fh = fh;
             if (_alphaMethodChosen)
             {
                 _currAlphaMethod.F = fh.AlphaFunction;
                 _currAlphaMethod.Df = fh.AlphaDiffFunction;
                 _currMethod.AlphaMethod = _currAlphaMethod;
             }
             double eps;
             try
             {
                 eps = double.Parse(precisionTextBox.Text);
             }
             catch (Exception)
             {
                 eps = 1e-5;
                 precisionTextBox.Text = @"1e-5";
             }
             _currMethod.Eps = eps;
             //Делаем сам метод
             var sw = Stopwatch.StartNew();
             _currMethod.Execute();
             sw.Stop();
             //Вывод, Двуменрная функция
             var coord = _currMethod.Answer;
             exports.Add(new TestExport(method.Name,function,coord.ToVectorString(),method.IterationCount.ToString(),sw.ElapsedMilliseconds.ToString(),eps.ToString()));
         }
     }
     var testForm = new TestForm(exports);
     _materialSkinManager.AddFormToManage(testForm);
     testForm.ShowDialog();
 }