Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeOperator.cs @ 5510

Last change on this file since 5510 was 5445, checked in by swagner, 14 years ago

Updated year of copyrights (#1406)

File size: 4.2 KB
RevLine 
[3294]1#region License Information
2/* HeuristicLab
[5445]3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
[3294]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
[4722]22using HeuristicLab.Common;
[3294]23using HeuristicLab.Core;
24using HeuristicLab.Data;
[4068]25using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces;
[3294]26using HeuristicLab.Operators;
27using HeuristicLab.Optimization;
28using HeuristicLab.Parameters;
29using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
30
31namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
32  /// <summary>
33  /// A base class for operators for symbolic expression trees.
34  /// </summary>
35  [Item("SymbolicExpressionTreeOperator", "A base class for operators for symbolic expression trees.")]
36  [StorableClass]
37  public abstract class SymbolicExpressionTreeOperator : SingleSuccessorOperator, IStochasticOperator, ISymbolicExpressionTreeOperator {
38    private const string RandomParameterName = "Random";
39    private const string MaxTreeSizeParameterName = "MaxTreeSize";
40    private const string MaxTreeHeightParameterName = "MaxTreeHeight";
41    private const string SymbolicExpressionGrammarParameterName = "SymbolicExpressionGrammar";
42
43    public override bool CanChangeName {
44      get { return false; }
45    }
46
[3338]47    #region Parameter Properties
[3294]48    public ILookupParameter<IRandom> RandomParameter {
49      get { return (LookupParameter<IRandom>)Parameters[RandomParameterName]; }
50    }
51    public IValueLookupParameter<IntValue> MaxTreeSizeParameter {
52      get { return (IValueLookupParameter<IntValue>)Parameters[MaxTreeSizeParameterName]; }
53    }
54    public IValueLookupParameter<IntValue> MaxTreeHeightParameter {
55      get { return (IValueLookupParameter<IntValue>)Parameters[MaxTreeHeightParameterName]; }
56    }
57    public ILookupParameter<ISymbolicExpressionGrammar> SymbolicExpressionGrammarParameter {
58      get { return (ILookupParameter<ISymbolicExpressionGrammar>)Parameters[SymbolicExpressionGrammarParameterName]; }
59    }
[3338]60    #endregion
[3294]61
[3338]62    #region Properties
63    public IRandom Random {
64      get { return RandomParameter.ActualValue; }
65    }
66    public IntValue MaxTreeSize {
67      get { return MaxTreeSizeParameter.ActualValue; }
68    }
69    public IntValue MaxTreeHeight {
70      get { return MaxTreeHeightParameter.ActualValue; }
71    }
72    public ISymbolicExpressionGrammar SymbolicExpressionGrammar {
73      get { return SymbolicExpressionGrammarParameter.ActualValue; }
74    }
75    #endregion
76
[4722]77    [StorableConstructor]
78    protected SymbolicExpressionTreeOperator(bool deserializing) : base(deserializing) { }
79    protected SymbolicExpressionTreeOperator(SymbolicExpressionTreeOperator original, Cloner cloner) : base(original, cloner) { }
[3294]80    protected SymbolicExpressionTreeOperator()
81      : base() {
82      Parameters.Add(new LookupParameter<IRandom>(RandomParameterName, "The pseudo random number generator which should be used for symbolic expression tree operators."));
83      Parameters.Add(new ValueLookupParameter<IntValue>(MaxTreeSizeParameterName, "The maximal size (number of nodes) of the symbolic expression tree."));
84      Parameters.Add(new ValueLookupParameter<IntValue>(MaxTreeHeightParameterName, "The maximal height of the symbolic expression tree (a tree with one node has height = 0)."));
85      Parameters.Add(new LookupParameter<ISymbolicExpressionGrammar>(SymbolicExpressionGrammarParameterName, "The grammar that defines the allowed symbols and syntax of the symbolic expression trees."));
86    }
87  }
88}
Note: See TracBrowser for help on using the repository browser.