Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/WindowedSymbol.cs @ 18082

Last change on this file since 18082 was 18060, checked in by pfleck, 3 years ago

#3040 Added a subvector symbol with ranges as subtrees.

File size: 5.2 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 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 HeuristicLab.Common;
24using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
25using HEAL.Attic;
26
27namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
28  [StorableType("2E342E38-BE2F-4E49-A9C3-2E833B83FDBC")]
29  public abstract class WindowedSymbol : Symbol, IWindowedSymbol {
30    #region Properties
31    [Storable]
32    private bool enableWindowing;
33    public bool EnableWindowing {
34      get { return enableWindowing; }
35      set {
36        if (value != enableWindowing) {
37          enableWindowing = value;
38          OnChanged(EventArgs.Empty);
39        }
40      }
41    }
42
43    [Storable]
44    private double offsetMu;
45    public double OffsetMu {
46      get { return offsetMu; }
47      set {
48        if (value != offsetMu) {
49          offsetMu = value;
50          OnChanged(EventArgs.Empty);
51        }
52      }
53    }
54    [Storable]
55    private double offsetSigma;
56    public double OffsetSigma {
57      get { return offsetSigma; }
58      set {
59        if (offsetSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed.");
60        if (value != offsetSigma) {
61          offsetSigma = value;
62          OnChanged(EventArgs.Empty);
63        }
64      }
65    }
66    [Storable]
67    private double lengthMu;
68    public double LengthMu {
69      get { return lengthMu; }
70      set {
71        if (value != lengthMu) {
72          lengthMu = value;
73          OnChanged(EventArgs.Empty);
74        }
75      }
76    }
77    [Storable]
78    private double lengthSigma;
79    public double LengthSigma {
80      get { return lengthSigma; }
81      set {
82        if (lengthSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed.");
83        if (value != lengthSigma) {
84          lengthSigma = value;
85          OnChanged(EventArgs.Empty); ;
86        }
87      }
88    }
89
90    [Storable]
91    private double manipulatorOffsetMu;
92    public double ManipulatorOffsetMu {
93      get { return manipulatorOffsetMu; }
94      set {
95        if (value != manipulatorOffsetMu) {
96          manipulatorOffsetMu = value;
97          OnChanged(EventArgs.Empty);
98        }
99      }
100    }
101    [Storable]
102    private double manipulatorOffsetSigma;
103    public double ManipulatorOffsetSigma {
104      get { return manipulatorOffsetSigma; }
105      set {
106        if (manipulatorOffsetSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed.");
107        if (value != manipulatorOffsetSigma) {
108          manipulatorOffsetSigma = value;
109          OnChanged(EventArgs.Empty);
110        }
111      }
112    }
113    [Storable]
114    private double manipulatorLengthMu;
115    public double ManipulatorLengthMu {
116      get { return manipulatorLengthMu; }
117      set {
118        if (value != manipulatorLengthMu) {
119          manipulatorLengthMu = value;
120          OnChanged(EventArgs.Empty);
121        }
122      }
123    }
124    [Storable]
125    private double manipulatorLengthSigma;
126    public double ManipulatorLengthSigma {
127      get { return manipulatorLengthSigma; }
128      set {
129        if (manipulatorLengthSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed.");
130        if (value != manipulatorLengthSigma) {
131          manipulatorLengthSigma = value;
132          OnChanged(EventArgs.Empty);
133        }
134      }
135    }
136    #endregion
137
138    [StorableConstructor]
139    protected WindowedSymbol(StorableConstructorFlag _) : base(_) {
140    }
141    protected WindowedSymbol(WindowedSymbol original, Cloner cloner)
142      : base(original, cloner) {
143      enableWindowing = original.enableWindowing;
144
145      offsetMu = original.offsetMu;
146      offsetSigma = original.offsetSigma;
147      lengthMu = original.lengthMu;
148      lengthSigma = original.lengthSigma;
149
150      manipulatorOffsetMu = original.manipulatorOffsetMu;
151      manipulatorOffsetSigma = original.manipulatorOffsetSigma;
152      manipulatorLengthMu = original.manipulatorLengthMu;
153      manipulatorLengthSigma = original.manipulatorLengthSigma;
154    }
155    protected WindowedSymbol(string name, string description)
156      : base(name, description) {
157      enableWindowing = false;
158
159      offsetMu = 0.0;
160      offsetSigma = 0.2;
161      lengthMu = 1.0;
162      lengthSigma = 0.2;
163
164      manipulatorOffsetMu = 0.0;
165      manipulatorOffsetSigma = 0.05;
166      manipulatorLengthMu = 0.0;
167      manipulatorLengthSigma = 0.05;
168    }
169
170    public override ISymbolicExpressionTreeNode CreateTreeNode() {
171      return new WindowedSymbolTreeNode(this);
172    }
173  }
174}
Note: See TracBrowser for help on using the repository browser.