Free cookie consent management tool by TermsFeed Policy Generator

source: branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/DataAnalysisProblem.cs @ 4695

Last change on this file since 4695 was 4461, checked in by gkronber, 14 years ago

made DataAnalysisProblem and DataAnalysisProblemData and SymbolicTimeSeriesPrognosisSolution savable and added field for conditional evaluation to Symbolic/SymbolicTimeSeriesPrognosisSolution (fix of changeset r4457). #1142

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]
[4457]35  public class DataAnalysisProblem : ParameterizedNamedItem, IDataAnalysisProblem, IStorableContent {
[3373]36    private const string DataAnalysisProblemDataParameterName = "DataAnalysisProblemData";
[3253]37    public override Image ItemImage {
38      get { return HeuristicLab.Common.Resources.VS2008ImageLibrary.Type; }
39    }
40
[4461]41    public string Filename { get; set; }
[4457]42
[3253]43    #region Parameter Properties
[3373]44    public ValueParameter<DataAnalysisProblemData> DataAnalysisProblemDataParameter {
45      get { return (ValueParameter<DataAnalysisProblemData>)Parameters[DataAnalysisProblemDataParameterName]; }
[3253]46    }
47    #endregion
[3264]48    #region properties
[3373]49    public DataAnalysisProblemData DataAnalysisProblemData {
50      get { return DataAnalysisProblemDataParameter.Value; }
[3264]51    }
52    #endregion
[3253]53
[4118]54    [StorableConstructor]
55    protected DataAnalysisProblem(bool deserializing) : base(deserializing) { }
[3373]56    public DataAnalysisProblem()
[3253]57      : base() {
[3373]58      Parameters.Add(new ValueParameter<DataAnalysisProblemData>(DataAnalysisProblemDataParameterName, "The data set, target variable and input variables of the data analysis problem.", new DataAnalysisProblemData()));
[3545]59      RegisterParameterEvents();
60      RegisterParameterValueEvents();
[3253]61    }
62
[3545]63    [StorableHook(HookType.AfterDeserialization)]
64    private void AfterDeserializationHook() {
65      RegisterParameterEvents();
66      RegisterParameterValueEvents();
67    }
68
69    #region events
[3884]70    protected virtual void OnDataAnalysisProblemChanged(EventArgs e) {
71      RaiseReset(e);
72    }
[3545]73
74    private void RegisterParameterEvents() {
75      DataAnalysisProblemDataParameter.ValueChanged += new EventHandler(DataAnalysisProblemDataParameter_ValueChanged);
76    }
77
78    private void RegisterParameterValueEvents() {
79      DataAnalysisProblemData.ProblemDataChanged += new EventHandler(DataAnalysisProblemData_ProblemDataChanged);
80    }
81
82    private void DataAnalysisProblemDataParameter_ValueChanged(object sender, EventArgs e) {
83      OnDataAnalysisProblemChanged(e);
84    }
85
86    private void DataAnalysisProblemData_ProblemDataChanged(object sender, EventArgs e) {
87      OnDataAnalysisProblemChanged(e);
88    }
89    #endregion
90
91    public override IDeepCloneable Clone(Cloner cloner) {
[3877]92      DataAnalysisProblem clone = (DataAnalysisProblem)base.Clone(cloner);
[3545]93      clone.RegisterParameterEvents();
94      clone.RegisterParameterValueEvents();
95      return clone;
96    }
[3877]97
98    #region IProblem Members
99
100    public virtual IParameter SolutionCreatorParameter {
101      get { return null; }
102    }
103
104    public virtual ISolutionCreator SolutionCreator {
105      get { return null; }
106    }
107
108    public virtual IParameter EvaluatorParameter {
109      get { return null; }
110    }
111
112    public virtual IEvaluator Evaluator {
113      get { return null; }
114    }
115
116    public virtual IEnumerable<IOperator> Operators {
117      get { return new IOperator[0]; }
118    }
119
120    public event EventHandler SolutionCreatorChanged;
121    protected void RaiseSolutionCreatorChanged(EventArgs e) {
122      var changed = SolutionCreatorChanged;
123      if (changed != null)
124        changed(this, e);
125    }
126
127    public event EventHandler EvaluatorChanged;
128    protected void RaiseEvaluatorChanged(EventArgs e) {
129      var changed = EvaluatorChanged;
130      if (changed != null)
131        changed(this, e);
132    }
133
134    public event EventHandler OperatorsChanged;
135    protected void RaiseOperatorsChanged(EventArgs e) {
136      var changed = OperatorsChanged;
137      if (changed != null)
138        changed(this, e);
139    }
140
141    public event EventHandler Reset;
142    protected void RaiseReset(EventArgs e) {
143      var changed = Reset;
144      if (changed != null)
145        changed(this, e);
146    }
147    #endregion
[3253]148  }
149}
Note: See TracBrowser for help on using the repository browser.