Example #1
0
        private void RunAlgorithmHill(object sender, RoutedEventArgs e)
        {
            var a = int.Parse(Hill_A.Text);
            var b = int.Parse(Hill_B.Text);
            var d = decimal.Parse(Hill_D.Text, CultureInfo.InvariantCulture);
            var t = int.Parse(Hill_T.Text);

            HillAlgorithm = new HillAlgorithm(a, b, d, t);
            HillAlgorithm.Run();
            var result = HillAlgorithm.Result;

            DrawHillPlot(HillAlgorithm.Result);
            DisplaySummaryInHillSummaryDataGrid();
        }
Example #2
0
        private void TestHillAlgorithm(object sender, RoutedEventArgs e)
        {
            var t = 1000;
            var a = -4;
            var b = 12;
            var d = 0.001m;

            var random  = new Random();
            var manager = new NumberFormatService(a, b, d, random);

            var result = new List <int>();

            for (int i = 0; i < t; i++)
            {
                var algorithm = new HillAlgorithm(t, random, manager);
                algorithm.Run();
                result.Add(algorithm.Result.Count);
            }

            var dup = result.GroupBy(_ => _).Select(_ => new dup2(_.Key, _.Count())).OrderBy(_ => _.Key).ToList();

            DrawHillTestPlot(dup);
            HillTestDataGrid.ItemsSource = dup;
        }