Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/DataAnalysisProblem.cs @ 5306

Last change on this file since 5306 was 5287, checked in by abeham, 14 years ago

#1337

  • Renamed VS2008ImageLibrary resource to VSImageLibrary
  • Added Filter icon to the VS2010ImageLibrary folder and the resource manager
File size: 5.0 KB
RevLine 
[3253]1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2010 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
22using System;
23using System.Collections.Generic;
[4068]24using System.Drawing;
[3376]25using HeuristicLab.Common;
[3253]26using HeuristicLab.Core;
[4068]27using HeuristicLab.Optimization;
28using HeuristicLab.Parameters;
[3253]29using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
30
[3373]31namespace HeuristicLab.Problems.DataAnalysis {
[3528]32  [Item("Data Analysis Problem", "Represents a data analysis problem.")]
[3253]33  [Creatable("Problems")]
34  [StorableClass]
[4419]35  public class DataAnalysisProblem : ParameterizedNamedItem, IDataAnalysisProblem, IStorableContent {
[3373]36    private const string DataAnalysisProblemDataParameterName = "DataAnalysisProblemData";
[4419]37
38    public string Filename { get; set; }
39
[3253]40    public override Image ItemImage {
[5287]41      get { return HeuristicLab.Common.Resources.VSImageLibrary.Type; }
[3253]42    }
43
44    #region Parameter Properties
[3373]45    public ValueParameter<DataAnalysisProblemData> DataAnalysisProblemDataParameter {
46      get { return (ValueParameter<DataAnalysisProblemData>)Parameters[DataAnalysisProblemDataParameterName]; }
[3253]47    }
48    #endregion
[3264]49    #region properties
[3373]50    public DataAnalysisProblemData DataAnalysisProblemData {
51      get { return DataAnalysisProblemDataParameter.Value; }
[3264]52    }
53    #endregion
[3253]54
[4118]55    [StorableConstructor]
56    protected DataAnalysisProblem(bool deserializing) : base(deserializing) { }
[4722]57    protected DataAnalysisProblem(DataAnalysisProblem original, Cloner cloner)
58      : base(original, cloner) {
59      RegisterParameterEvents();
60      RegisterParameterValueEvents();
61    }
62
[3373]63    public DataAnalysisProblem()
[3253]64      : base() {
[3373]65      Parameters.Add(new ValueParameter<DataAnalysisProblemData>(DataAnalysisProblemDataParameterName, "The data set, target variable and input variables of the data analysis problem.", new DataAnalysisProblemData()));
[3545]66      RegisterParameterEvents();
67      RegisterParameterValueEvents();
[3253]68    }
69
[3545]70    [StorableHook(HookType.AfterDeserialization)]
[4722]71    private void AfterDeserialization() {
[3545]72      RegisterParameterEvents();
73      RegisterParameterValueEvents();
74    }
75
76    #region events
[3884]77    protected virtual void OnDataAnalysisProblemChanged(EventArgs e) {
78      RaiseReset(e);
79    }
[3545]80
81    private void RegisterParameterEvents() {
82      DataAnalysisProblemDataParameter.ValueChanged += new EventHandler(DataAnalysisProblemDataParameter_ValueChanged);
83    }
84
85    private void RegisterParameterValueEvents() {
86      DataAnalysisProblemData.ProblemDataChanged += new EventHandler(DataAnalysisProblemData_ProblemDataChanged);
87    }
88
89    private void DataAnalysisProblemDataParameter_ValueChanged(object sender, EventArgs e) {
90      OnDataAnalysisProblemChanged(e);
91    }
92
93    private void DataAnalysisProblemData_ProblemDataChanged(object sender, EventArgs e) {
94      OnDataAnalysisProblemChanged(e);
95    }
96    #endregion
97
98    public override IDeepCloneable Clone(Cloner cloner) {
[4722]99      return new DataAnalysisProblem(this, cloner);
[3545]100    }
[3877]101
102    #region IProblem Members
103
104    public virtual IParameter SolutionCreatorParameter {
105      get { return null; }
106    }
107
108    public virtual ISolutionCreator SolutionCreator {
109      get { return null; }
110    }
111
112    public virtual IParameter EvaluatorParameter {
113      get { return null; }
114    }
115
116    public virtual IEvaluator Evaluator {
117      get { return null; }
118    }
119
120    public virtual IEnumerable<IOperator> Operators {
121      get { return new IOperator[0]; }
122    }
123
124    public event EventHandler SolutionCreatorChanged;
125    protected void RaiseSolutionCreatorChanged(EventArgs e) {
126      var changed = SolutionCreatorChanged;
127      if (changed != null)
128        changed(this, e);
129    }
130
131    public event EventHandler EvaluatorChanged;
132    protected void RaiseEvaluatorChanged(EventArgs e) {
133      var changed = EvaluatorChanged;
134      if (changed != null)
135        changed(this, e);
136    }
137
138    public event EventHandler OperatorsChanged;
139    protected void RaiseOperatorsChanged(EventArgs e) {
140      var changed = OperatorsChanged;
141      if (changed != null)
142        changed(this, e);
143    }
144
145    public event EventHandler Reset;
146    protected void RaiseReset(EventArgs e) {
147      var changed = Reset;
148      if (changed != null)
149        changed(this, e);
150    }
151    #endregion
[3253]152  }
153}
Note: See TracBrowser for help on using the repository browser.