Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GeneticProgramming.BloodGlucosePrediction/CurvedInsVariableSymbol.cs @ 17177

Last change on this file since 17177 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(CurvedInsVariableSymbol.Name, "")]
32  public class CurvedInsVariableSymbol : Symbol {
33    public new const string Name = "CurvedInsVariableSymbol";
34    #region Properties
35
36    [Storable]
37    private double minAlpha;
38    public double MinAlpha {
39      get { return minAlpha; }
40      set {
41        if (value != minAlpha) {
42          minAlpha = value;
43          OnChanged(EventArgs.Empty);
44        }
45      }
46    }
47    [Storable]
48    private double maxAlpha;
49    public double MaxAlpha {
50      get { return maxAlpha; }
51      set {
52        if (value != maxAlpha) {
53          maxAlpha = value;
54          OnChanged(EventArgs.Empty);
55        }
56      }
57    }
58
59    [Storable]
60    private double minBeta;
61    public double MinBeta {
62      get { return minBeta; }
63      set {
64        if (value != minBeta) {
65          minBeta = value;
66          OnChanged(EventArgs.Empty);
67        }
68      }
69    }
70
71    [Storable]
72    private double maxBeta;
73    public double MaxBeta {
74      get { return maxBeta; }
75      set {
76        if (value != maxBeta) {
77          maxBeta = value;
78          OnChanged(EventArgs.Empty);
79        }
80      }
81    }
82
83    private const int minimumArity = 0;
84    private const int maximumArity = 0;
85
86    public override int MinimumArity {
87      get { return minimumArity; }
88    }
89
90    public override int MaximumArity {
91      get { return maximumArity; }
92    }
93    #endregion
94
95    [StorableHook(HookType.AfterDeserialization)]
96    private void AfterDeserialization() {
97    }
98
99    [StorableConstructor]
100    protected CurvedInsVariableSymbol(bool deserializing)
101      : base(deserializing) {
102    }
103
104    protected CurvedInsVariableSymbol(CurvedInsVariableSymbol original, Cloner cloner)
105      : base(original, cloner) {
106      minAlpha = original.minAlpha;
107      maxAlpha = original.maxAlpha;
108      minBeta = original.minBeta;
109      maxBeta = original.maxBeta;
110    }
111
112    public CurvedInsVariableSymbol(string name, string desc, double minAlpha = 0.001, double maxAlpha = 0.999, double minBeta = 0.001, double maxBeta = 0.999)
113      : base(name, desc) {
114      this.minAlpha = minAlpha;
115      this.maxAlpha = maxAlpha;
116      this.minBeta = minBeta;
117      this.maxBeta = maxBeta;
118    }
119
120    public override ISymbolicExpressionTreeNode CreateTreeNode() {
121      return new CurvedInsVariableTreeNode(this);
122    }
123
124    public override IDeepCloneable Clone(Cloner cloner) {
125      return new CurvedInsVariableSymbol(this, cloner);
126    }
127  }
128}
Note: See TracBrowser for help on using the repository browser.