Free cookie consent management tool by TermsFeed Policy Generator

source: branches/1772_HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/MenuItems/OptimizeDataAnalysisRunsMenuItem.cs @ 16310

Last change on this file since 16310 was 10278, checked in by bburlacu, 11 years ago

#1772: Implemented generic genealogy analyzer (should work with any encoding provided the proper wiring is performed in the problem class), and before/after operators for creation, mutation and crossover.

File size: 2.5 KB
Line 
1#region License Information
2
3/* HeuristicLab
4 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
5 *
6 * This file is part of HeuristicLab.
7 *
8 * HeuristicLab is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * HeuristicLab is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#endregion
23
24using System;
25using System.Collections.Generic;
26using System.Linq;
27using HeuristicLab.MainForm;
28using HeuristicLab.Optimization;
29using HeuristicLab.Optimizer;
30
31using MenuItem = HeuristicLab.MainForm.WindowsForms.MenuItem;
32
33namespace HeuristicLab.Problems.DataAnalysis.Views {
34  public abstract class OptimizeDataAnalysisRunsMenuItem : MenuItem, IOptimizerUserInterfaceItemProvider {
35    public override string Name {
36      get { return "Optimize Runs"; }
37    }
38    public override IEnumerable<string> Structure {
39      get { return new string[] { "&Data Analysis" }; }
40    }
41    public override int Position {
42      get { return 5400; }
43    }
44    public override string ToolTipText {
45      get {
46        return "This command tries to optimize each run by performing a pruning and a constant optimization step on the solution models.";
47      }
48    }
49    protected override void OnToolStripItemSet(EventArgs e) {
50      ToolStripItem.Enabled = false;
51    }
52    protected RunCollection runCollection;
53
54    protected override void OnActiveViewChanged(object sender, EventArgs e) {
55      IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;
56      if (activeView == null) {
57        ToolStripItem.Enabled = false;
58        return;
59      }
60
61      var content = activeView.Content;
62      runCollection = content as RunCollection;
63      if (runCollection == null && content is IOptimizer)
64        runCollection = ((IOptimizer)content).Runs;
65
66      if (runCollection == null) {
67        ToolStripItem.Enabled = false;
68        return;
69      }
70
71      ToolStripItem.Enabled = runCollection.Any(run => run.Results.ContainsKey("Best training solution"));
72    }
73  }
74}
Note: See TracBrowser for help on using the repository browser.