Exemple #1
0
 private void answerButton_Click(object sender, EventArgs e)
 {
     try
     {
         double[] coordinates = new double[func.Variables];
         for (int i = 0; i < func.Variables; i++)
         {
             coordinates[i] = Convert.ToDouble(t[i].Text);
         }
         Coord x0 = new Coord(coordinates);
         answerTextBox.Text = func.Answer(x0).ToString();
     }
     catch
     {
         bool c = true;
         foreach (TextBox te in t)
         {
             if (te.Text == "" && te.Visible == true)
             {
                 c = false;
             }
         }
         if (!c)
         {
             MessageBox.Show("Не все координаты введены");
         }
         else
         {
             MessageBox.Show("Ошибка");
         }
     }
 }
        //Исследовательский поиск среди новых точек и стартовой точки
        Coord Research(Coord x)
        {
            x_new = new List <Coord>();
            x_new.Add(x);
            SuitablePoints(x, x.coord.Length, x_new);
            //Предположительный минимум
            Coord x_ = new Coord(x);

            foreach (Coord p in x_new)
            {
                if (y.Answer(p) < y.Answer(x_))
                {
                    x_ = new Coord(p);
                }
            }
            return(x_);
        }