Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/MetaOptimizationProblemView.cs @ 5306

Last change on this file since 5306 was 5184, checked in by cneumuel, 14 years ago

#1215

  • enhanced combinations generator (now with batchruns!)
  • fixed ActualNames for metaopt-alg
  • added penalty for invalid solution-candidates (algs which throw exceptions)
  • migrated to .NET 4.0
File size: 2.8 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Drawing;
5using System.Data;
6using System.Linq;
7using System.Text;
8using HeuristicLab.MainForm;
9using HeuristicLab.Optimization.Views;
10using HeuristicLab.Optimization;
11
12namespace HeuristicLab.Problems.MetaOptimization.Views {
13  [View("MetaOptimization View")]
14  [Content(typeof(MetaOptimizationProblem), IsDefaultView = true)]
15  public sealed partial class MetaOptimizationProblemView : ProblemView {
16    public new MetaOptimizationProblem Content {
17      get { return (MetaOptimizationProblem)base.Content; }
18      set { base.Content = value; }
19    }
20
21    public MetaOptimizationProblemView() {
22      InitializeComponent();
23    }
24
25    protected override void DeregisterContentEvents() {
26      // TODO: Deregister your event handlers here
27      base.DeregisterContentEvents();
28    }
29
30    protected override void RegisterContentEvents() {
31      base.RegisterContentEvents();
32      // TODO: Register your event handlers here
33    }
34
35    #region Event Handlers (Content)
36    // TODO: Put event handlers of the content here
37    #endregion
38
39    protected override void OnContentChanged() {
40      base.OnContentChanged();
41      if (Content == null) {
42        // TODO: Add code when content has been changed and is null
43      } else {
44        // TODO: Add code when content has been changed and is not null
45      }
46    }
47
48    protected override void SetEnabledStateOfControls() {
49      base.SetEnabledStateOfControls();
50      // TODO: Enable or disable controls based on whether the content is null or the view is set readonly
51    }
52
53    #region Event Handlers (child controls)
54
55    private void createExperimentButton_Click(object sender, EventArgs e) {
56      if (Content != null) {
57        long count = Content.ParameterConfigurationTree.GetCombinationCount();
58
59        System.Windows.Forms.DialogResult result = System.Windows.Forms.DialogResult.OK;
60        if (count > 512) {
61          result = System.Windows.Forms.MessageBox.Show(string.Format("Do you really want to create {0} optimizers? Be aware that this might take a significant amount of time and memory.", count), "Create Experiment", System.Windows.Forms.MessageBoxButtons.OKCancel);
62        }
63        if (result == System.Windows.Forms.DialogResult.OK) {
64          Experiment experiment;
65          if (Content.Repetitions.Value > 1) {
66            experiment = Content.ParameterConfigurationTree.GenerateExperiment(Content.Algorithm, true, Content.Repetitions.Value);
67          } else {
68            experiment = Content.ParameterConfigurationTree.GenerateExperiment(Content.Algorithm);
69          }
70          MainFormManager.MainForm.ShowContent(experiment);
71        }
72      }
73    }
74
75    #endregion
76  }
77}
Note: See TracBrowser for help on using the repository browser.