Free cookie consent management tool by TermsFeed Policy Generator

source: branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.MultiVariate/3.3/MultiVariateDataAnalysisProblem.cs @ 12724

Last change on this file since 12724 was 5305, checked in by gkronber, 14 years ago

worked on data analysis feature exploration branch. #1142

File size: 5.4 KB
Line 
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;
24using System.Drawing;
25using HeuristicLab.Common;
26using HeuristicLab.Core;
27using HeuristicLab.Optimization;
28using HeuristicLab.Parameters;
29using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
30
31namespace HeuristicLab.Problems.DataAnalysis.MultiVariate {
32  [Item("Multi Variate Data Analysis Problem", "Represents a multi variate data analysis problem.")]
33  [Creatable("Problems")]
34  [StorableClass]
35  public class MultiVariateDataAnalysisProblem : ParameterizedNamedItem, IMultiVariateDataAnalysisProblem, IStorableContent {
36    private const string MultiVariateDataAnalysisProblemDataParameterName = "MultiVariateDataAnalysisProblem";
37    public override Image ItemImage {
38      get { return HeuristicLab.Common.Resources.VS2008ImageLibrary.Type; }
39    }
40
41    public string Filename { get; set; }
42
43    #region Parameter Properties
44    public ValueParameter<MultiVariateDataAnalysisProblemData> MultiVariateDataAnalysisProblemDataParameter {
45      get { return (ValueParameter<MultiVariateDataAnalysisProblemData>)Parameters[MultiVariateDataAnalysisProblemDataParameterName]; }
46    }
47    #endregion
48    #region properties
49    public MultiVariateDataAnalysisProblemData MultiVariateDataAnalysisProblemData {
50      get { return MultiVariateDataAnalysisProblemDataParameter.Value; }
51    }
52    #endregion
53
54    [StorableConstructor]
55    protected MultiVariateDataAnalysisProblem(bool deserializing) : base(deserializing) { }
56    protected MultiVariateDataAnalysisProblem(MultiVariateDataAnalysisProblem original, Cloner cloner)
57      : base(original, cloner) {
58        RegisterParameterEvents();
59        RegisterParameterValueEvents();
60    }
61    public MultiVariateDataAnalysisProblem()
62      : base() {
63      Parameters.Add(new ValueParameter<MultiVariateDataAnalysisProblemData>(MultiVariateDataAnalysisProblemDataParameterName, "The data set, target variables and input variables of the multi-variate data analysis problem.", new MultiVariateDataAnalysisProblemData()));
64      RegisterParameterEvents();
65      RegisterParameterValueEvents();
66    }
67
68    [StorableHook(HookType.AfterDeserialization)]
69    private void AfterDeserializationHook() {
70      RegisterParameterEvents();
71      RegisterParameterValueEvents();
72    }
73
74    #region events
75    protected virtual void OnMultiVariateDataAnalysisProblemChanged(EventArgs e) {
76      RaiseReset(e);
77    }
78    private void RegisterParameterEvents() {
79      MultiVariateDataAnalysisProblemDataParameter.ValueChanged += new EventHandler(MultiVariateDataAnalysisProblemDataParameter_ValueChanged);
80    }
81
82    private void RegisterParameterValueEvents() {
83      MultiVariateDataAnalysisProblemData.ProblemDataChanged += new EventHandler(MultiVariateDataAnalysisProblemData_ProblemDataChanged);
84    }
85
86    private void MultiVariateDataAnalysisProblemDataParameter_ValueChanged(object sender, EventArgs e) {
87      OnMultiVariateDataAnalysisProblemChanged(e);
88    }
89
90    private void MultiVariateDataAnalysisProblemData_ProblemDataChanged(object sender, EventArgs e) {
91      OnMultiVariateDataAnalysisProblemChanged(e);
92    }
93    #endregion
94
95    public override IDeepCloneable Clone(Cloner cloner) {
96      return new MultiVariateDataAnalysisProblem(this, cloner);
97    }
98
99    #region IProblem Members
100
101    public virtual IParameter SolutionCreatorParameter {
102      get { return null; }
103    }
104
105    public virtual ISolutionCreator SolutionCreator {
106      get { return null; }
107    }
108
109    public virtual IParameter EvaluatorParameter {
110      get { return null; }
111    }
112
113    public virtual IEvaluator Evaluator {
114      get { return null; }
115    }
116
117    public virtual IEnumerable<IOperator> Operators {
118      get { return new IOperator[0]; }
119    }
120
121    public event EventHandler SolutionCreatorChanged;
122    protected void RaiseSolutionCreatorChanged(EventArgs e) {
123      var changed = SolutionCreatorChanged;
124      if (changed != null)
125        changed(this, e);
126    }
127
128    public event EventHandler EvaluatorChanged;
129    protected void RaiseEvaluatorChanged(EventArgs e) {
130      var changed = EvaluatorChanged;
131      if (changed != null)
132        changed(this, e);
133    }
134
135    public event EventHandler OperatorsChanged;
136    protected void RaiseOperatorsChanged(EventArgs e) {
137      var changed = OperatorsChanged;
138      if (changed != null)
139        changed(this, e);
140    }
141
142    public event EventHandler Reset;
143    protected void RaiseReset(EventArgs e) {
144      var changed = Reset;
145      if (changed != null)
146        changed(this, e);
147    }
148    #endregion
149  }
150}
Note: See TracBrowser for help on using the repository browser.