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