Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GeneticProgramming.BloodGlucosePrediction/CurvedChVariableSymbol.cs @ 18054

Last change on this file since 18054 was 14310, checked in by gkronber, 8 years ago

changed interpreter and grammar to smooth ch and ins uptake using a compartement model

File size: 3.6 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2015 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 HeuristicLab.Common;
25using HeuristicLab.Core;
26using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
28
29namespace HeuristicLab.Problems.GeneticProgramming.GlucosePrediction {
30  [StorableClass]
31  [Item(CurvedChVariableSymbol.Name, "")]
32  public class CurvedChVariableSymbol : Symbol {
33    public new const string Name = "CurvedChVariableSymbol";
34    #region Properties
35
36    private const int minimumArity = 0;
37    private const int maximumArity = 0;
38
39    public override int MinimumArity {
40      get { return minimumArity; }
41    }
42
43    public override int MaximumArity {
44      get { return maximumArity; }
45    }
46    #endregion
47
48    [Storable]
49    private double minAlpha;
50    public double MinAlpha {
51      get { return minAlpha; }
52      set {
53        if (value != minAlpha) {
54          minAlpha = value;
55          OnChanged(EventArgs.Empty);
56        }
57      }
58    }
59    [Storable]
60    private double maxAlpha;
61    public double MaxAlpha {
62      get { return maxAlpha; }
63      set {
64        if (value != maxAlpha) {
65          maxAlpha = value;
66          OnChanged(EventArgs.Empty);
67        }
68      }
69    }
70
71    [Storable]
72    private double minBeta;
73    public double MinBeta {
74      get { return minBeta; }
75      set {
76        if (value != minBeta) {
77          minBeta = value;
78          OnChanged(EventArgs.Empty);
79        }
80      }
81    }
82
83    [Storable]
84    private double maxBeta;
85    public double MaxBeta {
86      get { return maxBeta; }
87      set {
88        if (value != maxBeta) {
89          maxBeta = value;
90          OnChanged(EventArgs.Empty);
91        }
92      }
93    }
94    [StorableHook(HookType.AfterDeserialization)]
95    private void AfterDeserialization() {
96    }
97
98    [StorableConstructor]
99    protected CurvedChVariableSymbol(bool deserializing)
100      : base(deserializing) {
101    }
102
103    protected CurvedChVariableSymbol(CurvedChVariableSymbol original, Cloner cloner)
104      : base(original, cloner) {
105      minAlpha = original.minAlpha;
106      maxAlpha = original.maxAlpha;
107      minBeta = original.minBeta;
108      maxBeta = original.maxBeta;
109    }
110
111    public CurvedChVariableSymbol(string name, string desc, double minAlpha = 0.001, double maxAlpha = 0.999, double minBeta = 0.001, double maxBeta = 0.999)
112      : base(name, desc) {
113      this.minAlpha = minAlpha;
114      this.maxAlpha = maxAlpha;
115      this.minBeta = minBeta;
116      this.maxBeta = maxBeta;
117    }
118
119    public override ISymbolicExpressionTreeNode CreateTreeNode() {
120      return new CurvedChVariableTreeNode(this);
121    }
122
123    public override IDeepCloneable Clone(Cloner cloner) {
124      return new CurvedChVariableSymbol(this, cloner);
125    }
126  }
127}
Note: See TracBrowser for help on using the repository browser.