Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/02/10 16:49:20 (14 years ago)
Author:
gkronber
Message:

Moved general set of symbols and evaluator into Encodings.SymbolicExpressionTreeEncoding. #937 (Data types and operators for symbolic expression tree encoding)

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/ArithmeticExpressionGrammar.cs

    r3255 r3257  
    2626using System.Linq;
    2727using HeuristicLab.Core;
    28 using HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols;
    2928using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    30 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
     29using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.GeneralSymbols;
     30using HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Symbols;
     31namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic {
    3132  [StorableClass]
    3233  public class ArithmeticExpressionGrammar : Item, ISymbolicExpressionGrammar {
    33 
    34     private class EmptySymbol : Symbol {
    35       public EmptySymbol() {
    36         Name = "Start";
    37       }
    38     }
    3934
    4035    public ArithmeticExpressionGrammar()
     
    4338    #region ISymbolicExpressionGrammar Members
    4439    [Storable]
    45     private EmptySymbol startSymbol = new EmptySymbol();
     40    private StartSymbol startSymbol = new StartSymbol();
    4641    public Symbol StartSymbol {
    4742      get { return startSymbol; }
     
    5550      new Division(),
    5651      new Constant(),
    57       new HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols.Variable()
     52      new HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Symbols.Variable()
    5853    };
    5954    [Storable]
    6055    private Dictionary<Type, Dictionary<int, IEnumerable<Symbol>>> allowedSymbols = new Dictionary<Type, Dictionary<int, IEnumerable<Symbol>>>() {
    6156      {
    62         typeof(EmptySymbol),
     57        typeof(StartSymbol),
    6358        new Dictionary<int, IEnumerable<Symbol>>()
    6459        {
     
    10499    [Storable]
    105100    private Dictionary<Type, int> minLength = new Dictionary<Type, int>() {
    106       {typeof(EmptySymbol), 1},
     101      {typeof(StartSymbol), 1},
    107102      {typeof(Addition), 3},
    108103      {typeof(Subtraction), 3},
     
    110105      {typeof(Division), 4},
    111106      {typeof(Constant), 1},
    112       {typeof(HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols.Variable), 1},
     107      {typeof(HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Symbols.Variable), 1},
    113108    };
    114109    public int MinimalExpressionLength(Symbol start) {
     
    118113    [Storable]
    119114    private Dictionary<Type, int> maxLength = new Dictionary<Type, int>() {
    120       {typeof(EmptySymbol), int.MaxValue},
     115      {typeof(StartSymbol), int.MaxValue},
    121116      {typeof(Addition), int.MaxValue},
    122117      {typeof(Subtraction), int.MaxValue},
    123118      {typeof(Multiplication), int.MaxValue},
    124119      {typeof(Division), int.MaxValue},
    125       {typeof(HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols.Variable), 1},
     120      {typeof(HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Symbols.Variable), 1},
    126121      {typeof(Constant), 1},
    127122    };
     
    132127    [Storable]
    133128    private Dictionary<Type, int> minDepth = new Dictionary<Type, int>() {
    134       {typeof(EmptySymbol), 1},
     129      {typeof(StartSymbol), 1},
    135130      {typeof(Addition), 1},
    136131      {typeof(Subtraction), 1},
     
    138133      {typeof(Division), 1},
    139134      {typeof(Constant), 0},
    140       {typeof(HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols.Variable), 0}
     135      {typeof(HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Symbols.Variable), 0}
    141136    };
    142137    public int MinimalExpressionDepth(Symbol start) {
     
    146141    [Storable]
    147142    private Dictionary<Type, int> subTrees = new Dictionary<Type, int>() {
    148       {typeof(EmptySymbol), 1},
     143      {typeof(StartSymbol), 1},
    149144      {typeof(Addition), 2},
    150145      {typeof(Subtraction), 2},
    151146      {typeof(Multiplication), 2},
    152147      {typeof(Division), 2},
    153       {typeof(HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols.Variable), 0},
     148      {typeof(HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Symbols.Variable), 0},
    154149      {typeof(Constant), 0},
    155150    };
Note: See TracChangeset for help on using the changeset viewer.