Free cookie consent management tool by TermsFeed Policy Generator

source: branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Charting/Record.cs @ 942

Last change on this file since 942 was 576, checked in by gkronber, 16 years ago

added functionality to open the algorithm that generated any model

File size: 3.9 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22#region License Information
23/* HeuristicLab
24 * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
25 *
26 * This file is part of HeuristicLab.
27 *
28 * HeuristicLab is free software: you can redistribute it and/or modify
29 * it under the terms of the GNU General Public License as published by
30 * the Free Software Foundation, either version 3 of the License, or
31 * (at your option) any later version.
32 *
33 * HeuristicLab is distributed in the hope that it will be useful,
34 * but WITHOUT ANY WARRANTY; without even the implied warranty of
35 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
36 * GNU General Public License for more details.
37 *
38 * You should have received a copy of the GNU General Public License
39 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
40 */
41#endregion
42
43using System;
44using System.Collections.Generic;
45using System.Linq;
46using System.Text;
47using HeuristicLab.Core;
48using System.Collections;
49using HeuristicLab.CEDMA.DB.Interfaces;
50using System.Xml;
51using System.Runtime.Serialization;
52using System.IO;
53using HeuristicLab.PluginInfrastructure;
54
55namespace HeuristicLab.CEDMA.Charting {
56  public class Record {
57    public const string MAPE_TRAINING = "MAPE (training)";
58    public const string MAPE_VALIDATION = "MAPE (validation)";
59    public const string MAPE_TEST = "MAPE (test)";
60    public const string R2_TRAINING = "R2 (training)";
61    public const string R2_VALIDATION = "R2 (validation)";
62    public const string R2_TEST = "R2 (test)";
63    public const string TARGET_VARIABLE = "Target variable";
64    public const string TREE_SIZE = "Tree size";
65    public const string TREE_HEIGHT = "Tree height";
66    public const string SELECTIONPRESSURE = "Selection pressure";
67
68    public const string X_JITTER = "__X_JITTER";
69    public const string Y_JITTER = "__Y_JITTER";
70
71    private Dictionary<string, double> values = new Dictionary<string, double>();
72    private ResultList resultList;
73
74    private bool selected = false;
75    public bool Selected { get { return selected; } }
76
77    private string uri;
78    public string Uri { get { return uri; } }
79    public Record(ResultList resultList, string uri) {
80      this.uri = uri;
81      this.resultList = resultList;
82    }
83
84    public void Set(string name, double value) {
85      values.Add(name, value);
86    }
87
88    public double Get(string name) {
89      if(name == null || !values.ContainsKey(name)) return double.NaN;
90      return values[name];
91    }
92
93    public void ToggleSelected() {
94      selected = !selected;
95    }
96
97    internal string GetToolTipText() {
98      StringBuilder b = new StringBuilder();
99      foreach(KeyValuePair<string, double> v in values) {
100        if(v.Key != X_JITTER && v.Key != Y_JITTER) {
101          b.Append(v.Key).Append(" = ").Append(v.Value).AppendLine();
102        }
103      }
104      return b.ToString();
105    }
106
107    internal void OpenModel() {
108      resultList.OpenModel(this);
109    }
110
111    internal void OpenGeneratingAlgorithm() {
112      resultList.OpenAlgorithm(this);
113    }
114  }
115}
Note: See TracBrowser for help on using the repository browser.