Пример #1
0
        public Vector Solve()
        {
            details = new List <PenaltySolverDetails>();
            Vector x = startPoint;

            while (true)
            {
                var    r    = new Rosenbrock(Function, x, epsilon);
                Vector oldx = x;
                x = r.Solve();
                details.Add(new PenaltySolverDetails(mu, new SmartPoint(oldx), Math.Pow(Penalty(x), 2)));
                if (details.Last().MuAlpha < epsilon)
                {
                    break;
                }
                mu *= beta;
            }
            return(x);
        }
Пример #2
0
 public MainWindow()
 {
     InitializeComponent();
     MinWidth                     = Width;
     MinHeight                    = Height;
     X                            = Y = 0;
     Epsilon                      = 0.001;
     Spn.DataContext              = this;
     EpsilonTB.DataContext        = this;
     ToMinRadio.IsChecked         = true;
     FirstFunctionRadio.IsChecked = true;
     worker                       = new BackgroundWorker();
     worker.DoWork               += (s, e) => e.Result = rosenbrock.Solve();
     worker.RunWorkerCompleted   += (o, eventArgs) =>
     {
         if (!eventArgs.Cancelled)
         {
             OnSolve((Vector)eventArgs.Result);
         }
     };
 }