Changeset 12815 for branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/MainWindow.xaml.cs
- Timestamp:
- 07/30/15 16:37:14 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/MainWindow.xaml.cs
r12781 r12815 1 1 using System.Collections.ObjectModel; 2 using System.Security.AccessControl; 2 3 using System.Threading; 3 4 using System.Xml.Serialization; … … 32 33 private EvaluationViewModel vm; 33 34 34 private DispatcherTimer updateCollectionTimer;35 36 35 private DrawingPage treeDrawingPage; 37 36 … … 42 41 this.DataContext = vm = new EvaluationViewModel(); 43 42 vm.MaxLen = 100; 44 vm.Max Evaluations = 1000000;43 vm.MaxIterations = 1000000; 45 44 vm.NrRuns = 10; 46 vm.VerticalAxisString = "SolutionQuality";47 vm.HorizontalAxisString = "Iteration";48 45 } 49 46 … … 58 55 } 59 56 60 private void Draw LineChart(Run run)57 private void DrawQualityChart(Run run) 61 58 { 62 59 List<FoundSolution> solutions = new List<FoundSolution>(run.FoundSolutions); … … 76 73 77 74 graph.StrokeThickness = 2; 78 graph.AddToPlotter(ChartPlotter); 75 graph.AddToPlotter(QualityChartPlotter); 76 } 77 78 private void DrawSelectionChart(Run run) 79 { 80 List<SelectionIndicator> selectionIndicators = new List<SelectionIndicator>(run.SelectionIndicators); 81 82 var ds = new EnumerableDataSource<SelectionIndicator>(selectionIndicators); 83 84 ds.SetXMapping(x => x.TotalSelections); 85 ds.SetYMapping(y => y.Indicator); 86 87 LineGraph graph = new LineGraph(ds); 88 89 graph.StrokeThickness = 2; 90 graph.AddToPlotter(SelectionChartPlotter); 79 91 } 80 92 … … 93 105 run.StartTime = DateTime.Now; 94 106 95 run.Solver.Run(run.Max Evaluations);107 run.Solver.Run(run.MaxIterations); 96 108 97 109 run.EndTime = DateTime.Now; … … 136 148 { 137 149 ButtonRun.IsEnabled = true; 138 TextBoxMax Evaluations.IsEnabled = true;150 TextBoxMaxIterations.IsEnabled = true; 139 151 TextBoxMaxLen.IsEnabled = true; 140 152 TextBoxRuns.IsEnabled = true; … … 162 174 policyInstance = new ThresholdAscentPolicy(); 163 175 } 176 else if (policy == typeof(BoltzmannExplorationPolicy)) 177 { 178 policyInstance = new BoltzmannExplorationPolicy(2); 179 } 164 180 else 165 181 { … … 197 213 } 198 214 199 Run run = new Run(problem, policyInstance, solver, i + 1, vm.Max Evaluations, vm.MaxLen);215 Run run = new Run(problem, policyInstance, solver, i + 1, vm.MaxIterations, vm.MaxLen); 200 216 201 217 vm.Runs.Add(run); … … 205 221 } 206 222 207 private void Clear LineChart()208 { 209 ChartPlotter.Children.RemoveAll<LineGraph>();223 private void ClearQualityChart() 224 { 225 QualityChartPlotter.Children.RemoveAll<LineGraph>(); 210 226 } 211 227 … … 215 231 } 216 232 233 private void ClearSelectionChart() 234 { 235 SelectionChartPlotter.Children.RemoveAll<LineGraph>(); 236 } 237 217 238 private void ButtonRun_OnClick(object sender, RoutedEventArgs e) 218 239 { 219 Clear LineChart();240 ClearQualityChart(); 220 241 ClearComparisonChart(); 242 ClearSelectionChart(); 221 243 222 244 vm.Runs.Clear(); 223 245 vm.SelectedRun = null; 224 246 ButtonRun.IsEnabled = false; 225 TextBoxMax Evaluations.IsEnabled = false;247 TextBoxMaxIterations.IsEnabled = false; 226 248 TextBoxMaxLen.IsEnabled = false; 227 249 TextBoxRuns.IsEnabled = false; … … 287 309 vm.SelectedRun.Solver.FoundNewBestSolution += SelectedRun_FoundNewBestSolution; 288 310 289 ClearLineChart(); 290 DrawLineChart(vm.SelectedRun); 311 ClearQualityChart(); 312 DrawQualityChart(vm.SelectedRun); 313 314 if (vm.SelectedRun.RunState == RunState.Finished) 315 { 316 ClearSelectionChart(); 317 DrawSelectionChart(vm.SelectedRun); 318 } 291 319 //DrawTreeChart(vm.SelectedRun); 292 320 } … … 301 329 Dispatcher.BeginInvoke(new Action(() => 302 330 { 303 Clear LineChart();304 Draw LineChart(vm.SelectedRun);331 ClearQualityChart(); 332 DrawQualityChart(vm.SelectedRun); 305 333 })); 306 334 }
Note: See TracChangeset
for help on using the changeset viewer.