Changeset 12825
- Timestamp:
- 08/02/15 01:14:55 (10 years ago)
- Location:
- branches/PerformanceComparison
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified branches/PerformanceComparison/HeuristicLab.Analysis/3.3/Optimizers/IRRestarter.cs ¶
r12813 r12825 44 44 private const string BestQualityResultName = "BestQuality"; 45 45 private const string RandomRestartsResultName = "RandomRestarts"; 46 private const string RTsResultName = "RTs";47 private const string RTusResultName = "RTus";48 private const string FEsResultName = "FEs";49 private const string FEusResultName = "FEus";46 private const string EvaluatedSolutionsResultName = "EvaluatedSolutions"; 47 private const string EvaluatedMovesResultName = "EvaluatedMoves"; 48 private const string QualityPerClockResultName = "QualityPerClock"; 49 private const string QualityPerEvaluationsResultName = "QualityPerEvaluations"; 50 50 51 51 public string Filename { get; set; } … … 124 124 perEvaluationsAnalyzer.MoveCostPerSolutionParameter.Value = new DoubleValue(moveCostPerSolution); 125 125 OnPropertyChanged("MoveCostPerSolution"); 126 } 127 } 128 129 [Storable] 130 private bool storeSolutionInRun; 131 public bool StoreSolutionInRun { 132 get { return storeSolutionInRun; } 133 set { 134 if (storeSolutionInRun == value) return; 135 storeSolutionInRun = value; 136 OnPropertyChanged("StoreSolutionInRun"); 126 137 } 127 138 } … … 196 207 get { return algorithm; } 197 208 set { 198 if (value != null && !value.ProblemType.IsAssignableFrom(typeof(ISingleObjectiveHeuristicOptimizationProblem)))199 throw new ArgumentException("Algorithm is not single-objective!");200 209 if (algorithm == value) return; 201 210 if (algorithm != null) { … … 266 275 maximumEvaluations = original.maximumEvaluations; 267 276 moveCostPerSolution = original.moveCostPerSolution; 277 storeSolutionInRun = original.storeSolutionInRun; 268 278 targetValue = original.targetValue; 269 279 maximization = original.maximization; … … 291 301 maximumEvaluations = 10000000; // 10 mio 292 302 moveCostPerSolution = 1; 303 storeSolutionInRun = false; 293 304 targetValue = 0; 294 305 maximization = false; … … 311 322 maximumEvaluations = 10000000; // 10 mio 312 323 moveCostPerSolution = 1; 324 storeSolutionInRun = false; 313 325 targetValue = 0; 314 326 maximization = false; … … 330 342 maximumEvaluations = 10000000; // 10 mio 331 343 moveCostPerSolution = 1; 344 storeSolutionInRun = false; 332 345 targetValue = 0; 333 346 maximization = false; … … 391 404 if (!CurrentRun.Results.ContainsKey(ExecutionTimeResultName)) 392 405 CurrentRun.Results.Add(ExecutionTimeResultName, new TimeSpanValue(TimeSpan.Zero)); 393 CurrentRun.Results.Add(perEvaluationsAnalyzer.EvaluatedSolutionsParameter.ActualName, new IntValue(0)); 394 CurrentRun.Results.Add(perEvaluationsAnalyzer.EvaluatedMovesParameter.ActualName, new IntValue(0)); 406 // use double instead of int, otherwise one might run into int.MaxValue (at least with moves) 407 CurrentRun.Results.Add(EvaluatedSolutionsResultName, new DoubleValue(0)); 408 CurrentRun.Results.Add(EvaluatedMovesResultName, new DoubleValue(0)); 395 409 CurrentRun.Results.Add(BestQualityResultName, new DoubleValue(Maximization ? double.MinValue : double.MaxValue)); 396 410 CurrentRun.Results.Add(RandomRestartsResultName, new IntValue(0)); 397 CurrentRun.Results.Add(RTsResultName, new DoubleValue(0)); 398 CurrentRun.Results.Add(RTusResultName, new DoubleValue(0)); 399 CurrentRun.Results.Add(FEsResultName, new DoubleValue(0)); 400 CurrentRun.Results.Add(FEusResultName, new DoubleValue(0)); 401 } 411 } 412 if (Algorithm.ExecutionState == ExecutionState.Stopped) 413 Algorithm.Prepare(true); 402 414 Algorithm.Start(); 403 415 ExecutionState = ExecutionState.Started; … … 417 429 throw new InvalidOperationException(string.Format("Stop not allowed in execution state \"{0}\".", ExecutionState)); 418 430 forceStop = true; 419 Algorithm.Stop(); 431 try { 432 Algorithm.Stop(); 433 } catch (InvalidOperationException) { 434 // sometimes we hit the algorithm in an invalid state 435 } 420 436 } 421 437 … … 522 538 } 523 539 private void Algorithm_Stopped(object sender, EventArgs e) { 524 var bestQuality = UpdateAlgorithmResults(); 540 ExecutionTime += Algorithm.ExecutionTime - lastAlgorithmExecutionTime; 541 lastAlgorithmExecutionTime = Algorithm.ExecutionTime; 525 542 526 543 var execTime = ((TimeSpanValue)CurrentRun.Results[ExecutionTimeResultName]).Value; 527 double evaluationsInThisRun = 0; 528 foreach (var result in Algorithm.Results) { 529 if (result.Name == perClockAnalyzer.QualityPerClockParameter.ResultName) { 530 if (!CurrentRun.Results.ContainsKey(result.Name)) 531 CurrentRun.Results.Add(result.Name, (IItem)result.Value.Clone()); 532 else { 533 var dt = (IndexedDataTable<double>)CurrentRun.Results[result.Name]; 534 var best = dt.Rows.First().Values.Last().Item2; 535 var resultDt = (IndexedDataTable<double>)result.Value; 536 foreach (var tupl in resultDt.Rows.First().Values) { 537 if (Maximization && tupl.Item2 > best || !Maximization && tupl.Item2 < best) { 538 dt.Rows.First().Values.Add(Tuple.Create(execTime.TotalSeconds + tupl.Item1, tupl.Item2)); 539 best = tupl.Item2; 540 } 541 } 544 var solEvals = ((DoubleValue)CurrentRun.Results[EvaluatedSolutionsResultName]).Value; 545 var movEvals = ((DoubleValue)CurrentRun.Results[EvaluatedMovesResultName]).Value; 546 var restarts = ((IntValue)CurrentRun.Results[RandomRestartsResultName]).Value; 547 var improvement = false; 548 549 IResult result; 550 if (Algorithm.Results.TryGetValue(perEvaluationsAnalyzer.EvaluatedSolutionsParameter.ActualName, out result)) { 551 var evals = ((IntValue)result.Value).Value; 552 Evaluations += evals; 553 CurrentRun.Results[EvaluatedSolutionsResultName] = new DoubleValue(solEvals + evals); 554 } 555 if (Algorithm.Results.TryGetValue(perEvaluationsAnalyzer.EvaluatedMovesParameter.ActualName, out result)) { 556 var evals = ((IntValue)result.Value).Value; 557 Evaluations += moveCostPerSolution * evals; 558 CurrentRun.Results[EvaluatedMovesResultName] = new DoubleValue(movEvals + evals); 559 } 560 if (Algorithm.Results.TryGetValue(perEvaluationsAnalyzer.BestQualityParameter.ActualName, out result)) { 561 var bestQuality = ((DoubleValue)result.Value).Value; 562 if (double.IsNaN(BestSoFar) 563 || Maximization && bestQuality > BestSoFar 564 || !Maximization && bestQuality < BestSoFar) { 565 BestSoFar = bestQuality; 566 CurrentRun.Results[BestQualityResultName] = new DoubleValue(bestQuality); 567 improvement = true; 568 } 569 } 570 if (Algorithm.Results.TryGetValue(perClockAnalyzer.QualityPerClockParameter.ResultName, out result)) { 571 UpdateQualityPerClockResult((IndexedDataTable<double>)result.Value, execTime, restarts); 572 } 573 if (Algorithm.Results.TryGetValue(perEvaluationsAnalyzer.QualityPerEvaluationsParameter.ResultName, out result)) { 574 UpdateQualityPerEvaluationsResult((IndexedDataTable<double>)result.Value, solEvals, movEvals, restarts); 575 } 576 if (StoreSolutionInRun) { 577 foreach (var r in Algorithm.Results) { 578 if (r.Name.ToLower().EndsWith("solution") && improvement) { 579 CurrentRun.Results[r.Name] = (IItem)r.Value.Clone(); 542 580 } 543 } else if (result.Name == perEvaluationsAnalyzer.QualityPerEvaluationsParameter.ResultName) {544 if (!CurrentRun.Results.ContainsKey(result.Name))545 CurrentRun.Results.Add(result.Name, (IItem)result.Value.Clone());546 else {547 var dt = (IndexedDataTable<double>)CurrentRun.Results[result.Name];548 var evalSols = ((IntValue)CurrentRun.Results[perEvaluationsAnalyzer.EvaluatedSolutionsParameter.ActualName]).Value;549 var evalMoves = ((IntValue)CurrentRun.Results[perEvaluationsAnalyzer.EvaluatedMovesParameter.ActualName]).Value;550 var best = dt.Rows.First().Values.Last().Item2;551 var resultDt = (IndexedDataTable<double>)result.Value;552 foreach (var tupl in resultDt.Rows.First().Values) {553 if (Maximization && tupl.Item2 > best || !Maximization && tupl.Item2 < best) {554 dt.Rows.First().Values.Add(Tuple.Create(evalSols + moveCostPerSolution * evalMoves + tupl.Item1, tupl.Item2));555 best = tupl.Item2;556 }557 }558 }559 } else if (result.Name == perEvaluationsAnalyzer.EvaluatedSolutionsParameter.ActualName) {560 var oldEvals = ((IntValue)CurrentRun.Results[perEvaluationsAnalyzer.EvaluatedSolutionsParameter.ActualName]).Value;561 var newEvals = ((IntValue)result.Value).Value;562 CurrentRun.Results[perEvaluationsAnalyzer.EvaluatedSolutionsParameter.ActualName] = new IntValue(oldEvals + newEvals);563 evaluationsInThisRun += newEvals;564 } else if (result.Name == perEvaluationsAnalyzer.EvaluatedMovesParameter.ActualName) {565 var oldEvals = ((IntValue)CurrentRun.Results[perEvaluationsAnalyzer.EvaluatedMovesParameter.ActualName]).Value;566 var newEvals = ((IntValue)result.Value).Value;567 CurrentRun.Results[perEvaluationsAnalyzer.EvaluatedMovesParameter.ActualName] = new IntValue(oldEvals + newEvals);568 evaluationsInThisRun += newEvals * moveCostPerSolution;569 } else if (result.Name == perEvaluationsAnalyzer.BestQualityParameter.ActualName) {570 var best = ((DoubleValue)CurrentRun.Results[BestQualityResultName]).Value;571 if (Maximization && best < bestQuality || !Maximization && best > bestQuality)572 CurrentRun.Results[BestQualityResultName] = new DoubleValue(bestQuality);573 } else if (result.Name.ToLower().EndsWith("solution") && BestSoFar == bestQuality) {574 if (CurrentRun.Results.ContainsKey(result.Name))575 CurrentRun.Results[result.Name] = (IItem)result.Value.Clone();576 else CurrentRun.Results.Add(result.Name, (IItem)result.Value.Clone());577 581 } 578 582 } 583 579 584 CurrentRun.Results[ExecutionTimeResultName] = new TimeSpanValue(execTime + Algorithm.ExecutionTime); 580 585 … … 584 589 585 590 if (!forceStop && !IsFinished) { 586 var restarts = ((IntValue)CurrentRun.Results[RandomRestartsResultName]).Value;587 if (restarts == 0) {588 CurrentRun.Results[RTusResultName] = new DoubleValue(Algorithm.ExecutionTime.TotalSeconds);589 CurrentRun.Results[FEusResultName] = new DoubleValue(evaluationsInThisRun);590 } else {591 var rtus = ((DoubleValue)CurrentRun.Results[RTusResultName]).Value;592 var feus = ((DoubleValue)CurrentRun.Results[FEusResultName]).Value;593 CurrentRun.Results[RTusResultName] = new DoubleValue(rtus * restarts / (restarts + 1.0) + Algorithm.ExecutionTime.TotalSeconds / (restarts + 1.0));594 CurrentRun.Results[FEusResultName] = new DoubleValue(feus * restarts / (restarts + 1.0) + evaluationsInThisRun / (restarts + 1.0));595 }596 591 CurrentRun.Results[RandomRestartsResultName] = new IntValue(restarts + 1); 597 592 Algorithm.Prepare(true); 598 593 Algorithm.Start(); 599 594 } else { 600 if (Maximization && BestSoFar >= TargetValue || !Maximization && BestSoFar <= TargetValue) {601 CurrentRun.Results[RTsResultName] = (IItem)Algorithm.Results[perClockAnalyzer.QualityPerClockParameter.ResultName].Value.Clone();602 CurrentRun.Results[FEsResultName] = (IItem)Algorithm.Results[perEvaluationsAnalyzer.QualityPerEvaluationsParameter.ResultName].Value.Clone();603 }604 595 forceStop = false; 605 596 Runs.Add(CurrentRun); … … 610 601 } 611 602 612 private double UpdateAlgorithmResults() { 613 ExecutionTime += Algorithm.ExecutionTime - lastAlgorithmExecutionTime; 614 lastAlgorithmExecutionTime = Algorithm.ExecutionTime; 615 616 IResult evaluationsResult; 617 if (Algorithm.Results.TryGetValue(perEvaluationsAnalyzer.EvaluatedSolutionsParameter.ActualName, out evaluationsResult)) { 618 var evals = ((IntValue)evaluationsResult.Value).Value; 619 Evaluations += evals; 620 } 621 if (Algorithm.Results.TryGetValue(perEvaluationsAnalyzer.EvaluatedMovesParameter.ActualName, out evaluationsResult)) { 622 var evals = ((IntValue)evaluationsResult.Value).Value; 623 Evaluations += moveCostPerSolution * evals; 624 } 625 if (Algorithm.Results.TryGetValue(perEvaluationsAnalyzer.BestQualityParameter.ActualName, out evaluationsResult)) { 626 var bestQuality = ((DoubleValue)evaluationsResult.Value).Value; 627 if (double.IsNaN(BestSoFar) 628 || Maximization && bestQuality > BestSoFar 629 || !Maximization && bestQuality < BestSoFar) 630 BestSoFar = bestQuality; 631 return bestQuality; 632 } 633 return double.NaN; 603 private void UpdateQualityPerClockResult(IndexedDataTable<double> perClock, TimeSpan execTime, int restarts) { 604 IndexedDataTable<double> dt; 605 if (!CurrentRun.Results.ContainsKey(QualityPerClockResultName)) { 606 dt = (IndexedDataTable<double>)perClock.Clone(); 607 if (!dt.Rows.ContainsKey("Restarts")) 608 dt.Rows.Add(new IndexedDataRow<double>("Restarts") { 609 VisualProperties = { 610 ChartType = DataRowVisualProperties.DataRowChartType.StepLine, 611 SecondYAxis = true 612 } 613 }); 614 foreach (var v in dt.Rows.First().Values) 615 dt.Rows["Restarts"].Values.Add(Tuple.Create(v.Item1, 0.0)); 616 CurrentRun.Results.Add(QualityPerClockResultName, dt); 617 } else { 618 dt = (IndexedDataTable<double>)CurrentRun.Results[QualityPerClockResultName]; 619 var best = dt.Rows.First().Values.Last().Item2; 620 foreach (var tupl in perClock.Rows.First().Values) { 621 if (Maximization && tupl.Item2 > best || !Maximization && tupl.Item2 < best) { 622 dt.Rows.First().Values.Add(Tuple.Create(execTime.TotalSeconds + tupl.Item1, tupl.Item2)); 623 dt.Rows["Restarts"].Values.Add(Tuple.Create(execTime.TotalSeconds + tupl.Item1, (double)restarts)); 624 best = tupl.Item2; 625 } 626 } 627 } 628 if (IsFinished) { 629 dt.Rows.First().Values.Add(Tuple.Create(ExecutionTime.TotalSeconds, BestSoFar)); 630 dt.Rows["Restarts"].Values.Add(Tuple.Create(ExecutionTime.TotalSeconds, (double)restarts)); 631 } 632 } 633 634 private void UpdateQualityPerEvaluationsResult(IndexedDataTable<double> perEvaluations, double solEvals, double movEvals, int restarts) { 635 IndexedDataTable<double> dt; 636 if (!CurrentRun.Results.ContainsKey(QualityPerEvaluationsResultName)) { 637 dt = (IndexedDataTable<double>)perEvaluations.Clone(); 638 if (!dt.Rows.ContainsKey("Restarts")) 639 dt.Rows.Add(new IndexedDataRow<double>("Restarts") { 640 VisualProperties = { 641 ChartType = DataRowVisualProperties.DataRowChartType.StepLine, 642 SecondYAxis = true 643 } 644 }); 645 foreach (var v in dt.Rows.First().Values) 646 dt.Rows["Restarts"].Values.Add(Tuple.Create(v.Item1, 0.0)); 647 CurrentRun.Results.Add(QualityPerEvaluationsResultName, dt); 648 } else { 649 dt = (IndexedDataTable<double>)CurrentRun.Results[QualityPerEvaluationsResultName]; 650 var best = dt.Rows.First().Values.Last().Item2; 651 foreach (var tupl in perEvaluations.Rows.First().Values) { 652 if (Maximization && tupl.Item2 > best || !Maximization && tupl.Item2 < best) { 653 dt.Rows.First().Values.Add(Tuple.Create(solEvals + moveCostPerSolution * movEvals + tupl.Item1, tupl.Item2)); 654 dt.Rows["Restarts"].Values.Add(Tuple.Create(solEvals + moveCostPerSolution * movEvals + tupl.Item1, (double)restarts)); 655 best = tupl.Item2; 656 } 657 } 658 } 659 if (IsFinished) { 660 dt.Rows.First().Values.Add(Tuple.Create(Evaluations, BestSoFar)); 661 dt.Rows["Restarts"].Values.Add(Tuple.Create(Evaluations, (double)restarts)); 662 } 634 663 } 635 664 -
TabularUnified branches/PerformanceComparison/HeuristicLab.Optimization.Views/3.3/IRRestarterView.Designer.cs ¶
r12805 r12825 56 56 this.maximizationLabel = new System.Windows.Forms.Label(); 57 57 this.maximizationCheckBox = new System.Windows.Forms.CheckBox(); 58 this.storeSolutionInRunLabel = new System.Windows.Forms.Label(); 59 this.storeBestSolutionCheckBox = new System.Windows.Forms.CheckBox(); 58 60 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 59 61 this.tabControl.SuspendLayout(); … … 66 68 // 67 69 this.startButton.Location = new System.Drawing.Point(0, 440); 68 this.startButton.TabIndex = 9;70 this.startButton.TabIndex = 18; 69 71 this.toolTip.SetToolTip(this.startButton, "Start/Resume Optimizer"); 70 72 // … … 72 74 // 73 75 this.executionTimeTextBox.Location = new System.Drawing.Point(412, 444); 76 this.executionTimeTextBox.TabIndex = 23; 74 77 // 75 78 // executionTimeLabel 76 79 // 77 80 this.executionTimeLabel.Location = new System.Drawing.Point(323, 447); 81 this.executionTimeLabel.TabIndex = 22; 78 82 // 79 83 // pauseButton 80 84 // 81 85 this.pauseButton.Location = new System.Drawing.Point(30, 440); 82 this.pauseButton.TabIndex = 1 0;86 this.pauseButton.TabIndex = 19; 83 87 this.toolTip.SetToolTip(this.pauseButton, "Pause Optimizer"); 84 88 // … … 86 90 // 87 91 this.stopButton.Location = new System.Drawing.Point(60, 440); 88 this.stopButton.TabIndex = 11;92 this.stopButton.TabIndex = 20; 89 93 this.toolTip.SetToolTip(this.stopButton, "Stop Optimizer"); 90 94 // … … 92 96 // 93 97 this.resetButton.Location = new System.Drawing.Point(90, 440); 94 this.resetButton.TabIndex = 12;98 this.resetButton.TabIndex = 21; 95 99 this.toolTip.SetToolTip(this.resetButton, "Reset Optimizer"); 96 100 // … … 151 155 this.tabControl.Controls.Add(this.currentRunTabPage); 152 156 this.tabControl.Controls.Add(this.runsTabPage); 153 this.tabControl.Location = new System.Drawing.Point(0, 1 32);157 this.tabControl.Location = new System.Drawing.Point(0, 152); 154 158 this.tabControl.Name = "tabControl"; 155 159 this.tabControl.SelectedIndex = 0; 156 this.tabControl.Size = new System.Drawing.Size(546, 302);157 this.tabControl.TabIndex = 8;160 this.tabControl.Size = new System.Drawing.Size(546, 282); 161 this.tabControl.TabIndex = 17; 158 162 // 159 163 // algorithmTabPage … … 166 170 this.algorithmTabPage.Name = "algorithmTabPage"; 167 171 this.algorithmTabPage.Padding = new System.Windows.Forms.Padding(3); 168 this.algorithmTabPage.Size = new System.Drawing.Size(538, 2 76);172 this.algorithmTabPage.Size = new System.Drawing.Size(538, 256); 169 173 this.algorithmTabPage.TabIndex = 1; 170 174 this.algorithmTabPage.Text = "Algorithm"; … … 185 189 this.algorithmViewHost.Name = "algorithmViewHost"; 186 190 this.algorithmViewHost.ReadOnly = false; 187 this.algorithmViewHost.Size = new System.Drawing.Size(526, 2 34);191 this.algorithmViewHost.Size = new System.Drawing.Size(526, 214); 188 192 this.algorithmViewHost.TabIndex = 2; 189 193 this.algorithmViewHost.ViewsLabelVisible = true; … … 218 222 this.currentRunTabPage.Name = "currentRunTabPage"; 219 223 this.currentRunTabPage.Padding = new System.Windows.Forms.Padding(6); 220 this.currentRunTabPage.Size = new System.Drawing.Size(538, 2 76);224 this.currentRunTabPage.Size = new System.Drawing.Size(538, 256); 221 225 this.currentRunTabPage.TabIndex = 4; 222 226 this.currentRunTabPage.Text = "Current Run"; … … 231 235 this.currentRunView.Name = "currentRunView"; 232 236 this.currentRunView.ReadOnly = false; 233 this.currentRunView.Size = new System.Drawing.Size(526, 2 64);237 this.currentRunView.Size = new System.Drawing.Size(526, 244); 234 238 this.currentRunView.TabIndex = 0; 235 239 // … … 240 244 this.runsTabPage.Name = "runsTabPage"; 241 245 this.runsTabPage.Padding = new System.Windows.Forms.Padding(6); 242 this.runsTabPage.Size = new System.Drawing.Size(538, 2 76);246 this.runsTabPage.Size = new System.Drawing.Size(538, 256); 243 247 this.runsTabPage.TabIndex = 3; 244 248 this.runsTabPage.Text = "Runs"; … … 253 257 this.runsView.Name = "runsView"; 254 258 this.runsView.ReadOnly = false; 255 this.runsView.Size = new System.Drawing.Size(526, 2 64);259 this.runsView.Size = new System.Drawing.Size(526, 244); 256 260 this.runsView.TabIndex = 1; 257 261 // … … 268 272 this.targetValueTextBox.Name = "targetValueTextBox"; 269 273 this.targetValueTextBox.Size = new System.Drawing.Size(157, 20); 270 this.targetValueTextBox.TabIndex = 6;274 this.targetValueTextBox.TabIndex = 10; 271 275 this.targetValueTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.targetValueTextBox_Validating); 272 276 // … … 277 281 this.targetValueLabel.Name = "targetValueLabel"; 278 282 this.targetValueLabel.Size = new System.Drawing.Size(71, 13); 279 this.targetValueLabel.TabIndex = 5;283 this.targetValueLabel.TabIndex = 9; 280 284 this.targetValueLabel.Text = "Target Value:"; 281 285 // … … 289 293 this.terminationComboBox.Name = "terminationComboBox"; 290 294 this.terminationComboBox.Size = new System.Drawing.Size(409, 21); 291 this.terminationComboBox.TabIndex = 1 6;295 this.terminationComboBox.TabIndex = 14; 292 296 this.terminationComboBox.SelectedIndexChanged += new System.EventHandler(this.terminationComboBox_SelectedIndexChanged); 293 297 // … … 298 302 this.terminationLabel.Name = "terminationLabel"; 299 303 this.terminationLabel.Size = new System.Drawing.Size(65, 13); 300 this.terminationLabel.TabIndex = 5;304 this.terminationLabel.TabIndex = 13; 301 305 this.terminationLabel.Text = "Termination:"; 302 306 // … … 308 312 this.moveCostPerSolutionTextBox.Name = "moveCostPerSolutionTextBox"; 309 313 this.moveCostPerSolutionTextBox.Size = new System.Drawing.Size(123, 20); 310 this.moveCostPerSolutionTextBox.TabIndex = 6;314 this.moveCostPerSolutionTextBox.TabIndex = 8; 311 315 this.moveCostPerSolutionTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.moveCostPerSolutionTextBox_Validating); 312 316 // … … 317 321 this.moveCostPerSolutionLabel.Name = "moveCostPerSolutionLabel"; 318 322 this.moveCostPerSolutionLabel.Size = new System.Drawing.Size(117, 13); 319 this.moveCostPerSolutionLabel.TabIndex = 5;323 this.moveCostPerSolutionLabel.TabIndex = 7; 320 324 this.moveCostPerSolutionLabel.Text = "Move cost per solution:"; 321 325 // … … 326 330 this.maximizationLabel.Name = "maximizationLabel"; 327 331 this.maximizationLabel.Size = new System.Drawing.Size(70, 13); 328 this.maximizationLabel.TabIndex = 5;332 this.maximizationLabel.TabIndex = 11; 329 333 this.maximizationLabel.Text = "Maximization:"; 330 334 // … … 335 339 this.maximizationCheckBox.Name = "maximizationCheckBox"; 336 340 this.maximizationCheckBox.Size = new System.Drawing.Size(15, 14); 337 this.maximizationCheckBox.TabIndex = 1 7;341 this.maximizationCheckBox.TabIndex = 12; 338 342 this.maximizationCheckBox.UseVisualStyleBackColor = true; 339 343 this.maximizationCheckBox.CheckedChanged += new System.EventHandler(this.maximizationCheckBox_CheckedChanged); 340 344 // 345 // storeSolutionInRunLabel 346 // 347 this.storeSolutionInRunLabel.AutoSize = true; 348 this.storeSolutionInRunLabel.Location = new System.Drawing.Point(3, 132); 349 this.storeSolutionInRunLabel.Name = "storeSolutionInRunLabel"; 350 this.storeSolutionInRunLabel.Size = new System.Drawing.Size(76, 13); 351 this.storeSolutionInRunLabel.TabIndex = 15; 352 this.storeSolutionInRunLabel.Text = "Store Solution:"; 353 // 354 // storeBestSolutionCheckBox 355 // 356 this.storeBestSolutionCheckBox.AutoSize = true; 357 this.storeBestSolutionCheckBox.Location = new System.Drawing.Point(115, 132); 358 this.storeBestSolutionCheckBox.Name = "storeBestSolutionCheckBox"; 359 this.storeBestSolutionCheckBox.Size = new System.Drawing.Size(15, 14); 360 this.storeBestSolutionCheckBox.TabIndex = 16; 361 this.storeBestSolutionCheckBox.UseVisualStyleBackColor = true; 362 this.storeBestSolutionCheckBox.CheckedChanged += new System.EventHandler(this.storeBestSolutionCheckBox_CheckedChanged); 363 // 341 364 // IndependentRandomRestarterView 342 365 // 343 366 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 367 this.Controls.Add(this.storeBestSolutionCheckBox); 344 368 this.Controls.Add(this.maximizationCheckBox); 345 369 this.Controls.Add(this.terminationComboBox); … … 348 372 this.Controls.Add(this.timeLimitLabel); 349 373 this.Controls.Add(this.terminationLabel); 374 this.Controls.Add(this.storeSolutionInRunLabel); 350 375 this.Controls.Add(this.targetValueLabel); 351 376 this.Controls.Add(this.maximizationLabel); … … 364 389 this.Controls.SetChildIndex(this.maximizationLabel, 0); 365 390 this.Controls.SetChildIndex(this.targetValueLabel, 0); 391 this.Controls.SetChildIndex(this.storeSolutionInRunLabel, 0); 366 392 this.Controls.SetChildIndex(this.terminationLabel, 0); 367 393 this.Controls.SetChildIndex(this.timeLimitLabel, 0); … … 379 405 this.Controls.SetChildIndex(this.terminationComboBox, 0); 380 406 this.Controls.SetChildIndex(this.maximizationCheckBox, 0); 407 this.Controls.SetChildIndex(this.storeBestSolutionCheckBox, 0); 381 408 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 382 409 this.tabControl.ResumeLayout(false); … … 413 440 private System.Windows.Forms.TabPage currentRunTabPage; 414 441 private RunView currentRunView; 442 private System.Windows.Forms.Label storeSolutionInRunLabel; 443 private System.Windows.Forms.CheckBox storeBestSolutionCheckBox; 415 444 } 416 445 } -
TabularUnified branches/PerformanceComparison/HeuristicLab.Optimization.Views/3.3/IRRestarterView.cs ¶
r12804 r12825 77 77 maximizationCheckBox.CheckState = CheckState.Indeterminate; 78 78 terminationComboBox.SelectedIndex = -1; 79 storeBestSolutionCheckBox.CheckState = CheckState.Indeterminate; 79 80 80 81 algorithmViewHost.Content = null; … … 88 89 maximizationCheckBox.Checked = Content.Maximization; 89 90 terminationComboBox.SelectedItem = Content.TerminationCriterium; 91 storeBestSolutionCheckBox.Checked = Content.StoreSolutionInRun; 90 92 91 93 algorithmViewHost.Content = Content.Algorithm; … … 104 106 maximizationCheckBox.Enabled = Content != null && !ReadOnly && !Locked; 105 107 terminationComboBox.Enabled = Content != null && !ReadOnly && !Locked; 108 storeBestSolutionCheckBox.Enabled = Content != null && !ReadOnly && !Locked; 106 109 newAlgorithmButton.Enabled = Content != null && !ReadOnly; 107 110 openAlgorithmButton.Enabled = Content != null && !ReadOnly; … … 126 129 #region Content events 127 130 private void Content_PropertyChanged(object sender, PropertyChangedEventArgs e) { 131 if (InvokeRequired) { 132 Invoke((Action<object, PropertyChangedEventArgs>)Content_PropertyChanged, sender, e); 133 return; 134 } 128 135 SuppressEvents = true; 129 136 try { … … 135 142 case "Maximization": maximizationCheckBox.Checked = Content.Maximization; break; 136 143 case "MoveCostPerSolution": moveCostPerSolutionTextBox.Text = Content.MoveCostPerSolution.ToString(CultureInfo.CurrentCulture.NumberFormat); break; 144 case "StoreSolutionInRun": storeBestSolutionCheckBox.Checked = Content.StoreSolutionInRun; break; 137 145 case "Algorithm": algorithmViewHost.Content = Content.Algorithm; break; 138 146 case "CurrentRun": currentRunView.Content = Content.CurrentRun; break; … … 228 236 } 229 237 Content.TerminationCriterium = (TerminationCriterium)terminationComboBox.SelectedItem; 238 } 239 240 private void storeBestSolutionCheckBox_CheckedChanged(object sender, EventArgs e) { 241 if (SuppressEvents) return; 242 if (InvokeRequired) { 243 Invoke((Action<object, EventArgs>)storeBestSolutionCheckBox_CheckedChanged, sender, e); 244 return; 245 } 246 Content.StoreSolutionInRun = storeBestSolutionCheckBox.Checked; 230 247 } 231 248
Note: See TracChangeset
for help on using the changeset viewer.