Free cookie consent management tool by TermsFeed Policy Generator

source: branches/GP-MoveOperators/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/ReplaceBranchMove.cs @ 8206

Last change on this file since 8206 was 8206, checked in by gkronber, 10 years ago

#1847: merged r8084:8205 from trunk into GP move operators branch

File size: 2.9 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2012 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 HeuristicLab.Common;
23using HeuristicLab.Core;
24using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
25using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
26
27namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
28  [Item("ReplaceBranchMove", "")]
29  [StorableClass]
30  public class ReplaceBranchMove : Item {
31
32    [Storable]
33    public ISymbolicExpressionTree Tree { get; set; }
34
35    [Storable]
36    public ISymbolicExpressionTreeNode Parent { get; set; }
37
38    [Storable]
39    public int SubtreeIndex { get; set; }
40
41    [Storable]
42    public ISymbolicExpressionTreeNode NewBranch { get; set; }
43
44    [Storable]
45    public double[] OriginalOutput { get; private set; }
46
47    [Storable]
48    public double[] NewOutput { get; private set; }
49
50    [Storable]
51    public double Alpha { get; set; }
52
53    [Storable]
54    public double Beta { get; set; }
55
56
57    [StorableConstructor]
58    protected ReplaceBranchMove(bool deserializing) : base(deserializing) { }
59    protected ReplaceBranchMove(ReplaceBranchMove original, Cloner cloner)
60      : base(original, cloner) {
61      this.Tree = cloner.Clone(original.Tree);
62      this.SubtreeIndex = original.SubtreeIndex;
63      this.Parent = cloner.Clone(original.Parent);
64      this.NewBranch = cloner.Clone(original.NewBranch);
65      this.OriginalOutput = original.OriginalOutput;
66      this.NewOutput = original.NewOutput;
67      this.Alpha = original.Alpha;
68      this.Beta = original.Beta;
69    }
70    public ReplaceBranchMove(ISymbolicExpressionTree tree, ISymbolicExpressionTreeNode parent, int subtreeIndex, ISymbolicExpressionTreeNode newChild, double[] originalOutput, double[] newOutput)
71      : base() {
72      this.Tree = tree;
73      this.SubtreeIndex = subtreeIndex;
74      this.Parent = parent;
75      this.NewBranch = newChild;
76      this.OriginalOutput = originalOutput;
77      this.NewOutput = newOutput;
78    }
79
80    public override IDeepCloneable Clone(Cloner cloner) {
81      return new ReplaceBranchMove(this, cloner);
82    }
83  }
84}
Note: See TracBrowser for help on using the repository browser.