Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/08/15 19:49:05 (9 years ago)
Author:
aballeit
Message:

#2283 Final

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/MainWindow.xaml.cs

    r12833 r12840  
    55using System.Threading.Tasks;
    66using System.Windows.Documents;
     7using System.Windows.Media;
    78using System.Xml.Serialization;
    89using Evaluation.ViewModel;
     
    4344            CenterWindowOnScreen();
    4445            this.DataContext = vm = new EvaluationViewModel();
    45             vm.MaxLen = 23;
    46             vm.MaxIterations = 500000;
     46            vm.MaxLen = 17;
     47            vm.MaxIterations = 300000;
    4748            vm.NrRuns = 20;
    48             vm.MaxThreads = 5;
     49            vm.MaxThreads = 10;
    4950        }
    5051
     
    7273
    7374            ds.SetXMapping(x => x.Iteration);
    74             ds.SetYMapping(y => y.Quality);
     75            ds.SetYMapping(y => y.Quality / run.BestKnownQuality);
    7576
    7677            LineGraph graph = new LineGraph(ds);
     
    8283        private void DrawSelectionChart(Run run)
    8384        {
     85            // quality line
     86            List<FoundSolution> solutions = new List<FoundSolution>(run.FoundSolutions);
     87
     88            if (run.BestSolutionFoundAt < run.Evaluations)
     89            {
     90                solutions.Add(new FoundSolution(run.EndTime, run.Evaluations, run.BestQuality, run.BestSolution));
     91            }
     92
     93            var ds = new EnumerableDataSource<FoundSolution>(solutions);
     94
     95
     96            ds.SetXMapping(x => x.Iteration);
     97            ds.SetYMapping(y => y.Quality / run.BestKnownQuality);
     98
     99            LineGraph graph = new LineGraph(ds);
     100            graph.StrokeThickness = 2;
     101            graph.AddToPlotter(SelectionChartPlotter);
     102
     103            // selection indicator line
    84104            List<SelectionIndicator> selectionIndicators = new List<SelectionIndicator>(run.SelectionIndicators);
    85105
    86             var ds = new EnumerableDataSource<SelectionIndicator>(selectionIndicators);
    87 
    88             ds.SetXMapping(x => x.TotalSelections);
    89             ds.SetYMapping(y => y.Indicator);
    90 
    91             LineGraph graph = new LineGraph(ds);
    92 
     106            var dssi = new EnumerableDataSource<SelectionIndicator>(selectionIndicators);
     107
     108            dssi.SetXMapping(x => x.Evaluation);
     109            dssi.SetYMapping(y => y.Indicator);
     110
     111            graph = new LineGraph(dssi);
    93112            graph.StrokeThickness = 2;
     113            graph.Stroke = Brushes.Red;
    94114            graph.AddToPlotter(SelectionChartPlotter);
    95115        }
     
    182202                policyInstance = new BoltzmannExplorationPolicy(2);
    183203            }
    184             else if (policy == typeof (EpsGreedyPolicy))
     204            else if (policy == typeof(EpsGreedyPolicy))
    185205            {
    186206                policyInstance = new EpsGreedyPolicy(vm.Epsylon);
     
    228248            }
    229249            Task.Run(() =>
    230                 Parallel.For(0, vm.NrRuns, new ParallelOptions {MaxDegreeOfParallelism = vm.MaxThreads},
     250                Parallel.For(0, vm.NrRuns, new ParallelOptions { MaxDegreeOfParallelism = vm.MaxThreads },
    231251                    i => DoRun(vm.Runs[i])));
    232252        }
     
    434454        private void ComboBoxPolicies_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
    435455        {
    436             if (vm.SelectedPolicy == typeof (EpsGreedyPolicy))
     456            if (vm.SelectedPolicy == typeof(EpsGreedyPolicy))
    437457            {
    438458                TextBoxEpsylon.Visibility = Visibility.Visible;
     
    445465            }
    446466        }
     467
     468        private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
     469        {
     470            if (ChartSelector.SelectedItem == TabSelectionIndicator)
     471            {
     472                if (vm.SelectedRun != null)
     473                {
     474                    if (vm.SelectedRun.RunState == RunState.Finished)
     475                    {
     476                        ClearSelectionChart();
     477                        DrawSelectionChart(vm.SelectedRun);
     478                    }
     479                }
     480            }
     481            else if (ChartSelector.SelectedItem == TabQualityChart)
     482            {
     483                if (vm.SelectedRun != null)
     484                {
     485                    if (vm.SelectedRun.RunState == RunState.Finished)
     486                    {
     487                        ClearQualityChart();
     488                        DrawQualityChart(vm.SelectedRun);
     489                    }
     490                }
     491            }
     492        }
    447493    }
    448494}
Note: See TracChangeset for help on using the changeset viewer.