Changeset 12840 for branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/MainWindow.xaml.cs
- Timestamp:
- 08/08/15 19:49:05 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/MainWindow.xaml.cs
r12833 r12840 5 5 using System.Threading.Tasks; 6 6 using System.Windows.Documents; 7 using System.Windows.Media; 7 8 using System.Xml.Serialization; 8 9 using Evaluation.ViewModel; … … 43 44 CenterWindowOnScreen(); 44 45 this.DataContext = vm = new EvaluationViewModel(); 45 vm.MaxLen = 23;46 vm.MaxIterations = 500000;46 vm.MaxLen = 17; 47 vm.MaxIterations = 300000; 47 48 vm.NrRuns = 20; 48 vm.MaxThreads = 5;49 vm.MaxThreads = 10; 49 50 } 50 51 … … 72 73 73 74 ds.SetXMapping(x => x.Iteration); 74 ds.SetYMapping(y => y.Quality );75 ds.SetYMapping(y => y.Quality / run.BestKnownQuality); 75 76 76 77 LineGraph graph = new LineGraph(ds); … … 82 83 private void DrawSelectionChart(Run run) 83 84 { 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 84 104 List<SelectionIndicator> selectionIndicators = new List<SelectionIndicator>(run.SelectionIndicators); 85 105 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); 93 112 graph.StrokeThickness = 2; 113 graph.Stroke = Brushes.Red; 94 114 graph.AddToPlotter(SelectionChartPlotter); 95 115 } … … 182 202 policyInstance = new BoltzmannExplorationPolicy(2); 183 203 } 184 else if (policy == typeof 204 else if (policy == typeof(EpsGreedyPolicy)) 185 205 { 186 206 policyInstance = new EpsGreedyPolicy(vm.Epsylon); … … 228 248 } 229 249 Task.Run(() => 230 Parallel.For(0, vm.NrRuns, new ParallelOptions { MaxDegreeOfParallelism = vm.MaxThreads},250 Parallel.For(0, vm.NrRuns, new ParallelOptions { MaxDegreeOfParallelism = vm.MaxThreads }, 231 251 i => DoRun(vm.Runs[i]))); 232 252 } … … 434 454 private void ComboBoxPolicies_OnSelectionChanged(object sender, SelectionChangedEventArgs e) 435 455 { 436 if (vm.SelectedPolicy == typeof 456 if (vm.SelectedPolicy == typeof(EpsGreedyPolicy)) 437 457 { 438 458 TextBoxEpsylon.Visibility = Visibility.Visible; … … 445 465 } 446 466 } 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 } 447 493 } 448 494 }
Note: See TracChangeset
for help on using the changeset viewer.