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