Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/25/10 19:19:37 (15 years ago)
Author:
gkronber
Message:

Worked on SymbolicTreeEncoding plugin. #937 (Data types and operators for symbolic expression tree encoding)

Location:
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTree/3.3
Files:
5 added
19 edited
3 moved

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTree/3.3

    • Property svn:ignore set to
      bin
      *.user
      obj
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTree/3.3/Creators/ProbabilisticTreeCreator.cs

    r3218 r3219  
    2323using HeuristicLab.Data;
    2424using HeuristicLab.Random;
    25 using HeuristicLab.GP.Interfaces;
    2625using System;
    2726
    28 namespace HeuristicLab.GP.Operators {
     27namespace HeuristicLab.Encodings.SymbolicExpressionTree {
    2928  public class ProbabilisticTreeCreator : OperatorBase {
    3029    private static int MAX_TRIES { get { return 100; } }
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTree/3.3/Creators/RampedTreeCreator.cs

    r3218 r3219  
    2525using HeuristicLab.Random;
    2626using System.Diagnostics;
    27 using HeuristicLab.GP.Interfaces;
    2827
    29 namespace HeuristicLab.GP.Operators {
     28namespace HeuristicLab.Encodings.SymbolicExpressionTree {
    3029  public class RampedTreeCreator : OperatorBase {
    3130    public override string Description {
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTree/3.3/Crossovers/GPCrossoverBase.cs

    r3218 r3219  
    2323using HeuristicLab.Core;
    2424using System.Diagnostics;
    25 using HeuristicLab.Evolutionary;
    26 using HeuristicLab.GP.Interfaces;
    2725
    28 namespace HeuristicLab.GP.Operators {
     26namespace HeuristicLab.Encodings.SymbolicExpressionTree {
    2927  public abstract class GPCrossoverBase : CrossoverBase {
    3028    public GPCrossoverBase()
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTree/3.3/Crossovers/LangdonHomologousCrossOver.cs

    r3218 r3219  
    2525using HeuristicLab.GP.Interfaces;
    2626
    27 namespace HeuristicLab.GP.Operators {
     27namespace HeuristicLab.Encodings.SymbolicExpressionTree {
    2828  /// <summary>
    2929  /// Implementation of a homologous crossover operator as described in:
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTree/3.3/Crossovers/OnePointCrossOver.cs

    r3218 r3219  
    2424using HeuristicLab.GP.Interfaces;
    2525
    26 namespace HeuristicLab.GP.Operators {
     26namespace HeuristicLab.Encodings.SymbolicExpressionTree {
    2727  /// <summary>
    2828  /// Implementation of a homologous one point crossover operator as described in:
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTree/3.3/Crossovers/SizeConstrictedGPCrossoverBase.cs

    r3218 r3219  
    2424using HeuristicLab.GP.Interfaces;
    2525
    26 namespace HeuristicLab.GP.Operators {
     26namespace HeuristicLab.Encodings.SymbolicExpressionTree {
    2727  public abstract class SizeConstrictedGPCrossoverBase : GPCrossoverBase {
    2828
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTree/3.3/Crossovers/SizeFairCrossOver.cs

    r3218 r3219  
    2626using HeuristicLab.Random;
    2727
    28 namespace HeuristicLab.GP.Operators {
     28namespace HeuristicLab.Encodings.SymbolicExpressionTree {
    2929  /// <summary>
    3030  /// Implementation of a size fair crossover operator as described in:
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTree/3.3/Crossovers/StandardCrossOver.cs

    r3218 r3219  
    2424using HeuristicLab.GP.Interfaces;
    2525
    26 namespace HeuristicLab.GP.Operators {
     26namespace HeuristicLab.Encodings.SymbolicExpressionTree {
    2727  public class StandardCrossOver : SizeConstrictedGPCrossoverBase {
    2828    private int MaxRecombinationTries { get { return 20; } }
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTree/3.3/Crossovers/UniformCrossover.cs

    r3218 r3219  
    2222using System.Collections.Generic;
    2323using HeuristicLab.Core;
    24 using HeuristicLab.GP.Interfaces;
    2524
    26 namespace HeuristicLab.GP.Operators {
     25namespace HeuristicLab.Encodings.SymbolicExpressionTree {
    2726  /// <summary>
    2827  /// Implementation of a homologous uniform crossover operator as described in:
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTree/3.3/HeuristicLabEncodingsSymbolicExpressionTreePlugin.cs.frame

    r3218 r3219  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2525using HeuristicLab.PluginInfrastructure;
    2626
    27 namespace HeuristicLab.GP.Operators {
    28   [Plugin("HeuristicLab.GP.Operators", "3.3.0.$WCREV$")]
    29   [PluginFile("HeuristicLab.GP.Operators-3.3.dll", PluginFileType.Assembly)]
    30   [PluginDependency("HeuristicLab.Core-3.2")]
    31   [PluginDependency("HeuristicLab.Data-3.2")]
    32   [PluginDependency("HeuristicLab.Evolutionary-3.2")]
    33   [PluginDependency("HeuristicLab.GP", "3.3")]
    34   [PluginDependency("HeuristicLab.GP.Interfaces", "3.3")]
    35   [PluginDependency("HeuristicLab.Operators-3.2")]
    36   [PluginDependency("HeuristicLab.Random-3.2")]
    37   [PluginDependency("HeuristicLab.Selection-3.2")]
    38   public class HeuristicLabGPOperatorsPlugin : PluginBase {
     27namespace HeuristicLab.Encodings.SymbolicExpressionTree {
     28  [Plugin("HeuristicLab.Encodings.SymbolicExpressionTree", "3.3.0.$WCREV$")]
     29  [PluginFile("HeuristicLab.Encodings.SymbolicExpressionTree-3.3.dll", PluginFileType.Assembly)]
     30  [PluginDependency("HeuristicLab.Core", "3.3.0.0")]
     31  [PluginDependency("HeuristicLab.Data", "3.3.0.0")]
     32  [PluginDependency("HeuristicLab.Optimization", "3.3.0.0")]
     33  [PluginDependency("HeuristicLab.Parameters", "3.3.0.0")]
     34  [PluginDependency("HeuristicLab.Persistence", "3.3.0.0")]
     35  [PluginDependency("HeuristicLab.Random", "3.3.0.0")]
     36  public class HeuristicLabEncodingsSymbolicExpressionTreePlugin : PluginBase {
    3937  }
    4038}
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTree/3.3/Interfaces/IFunction.cs

    r3218 r3219  
    2525using HeuristicLab.Core;
    2626
    27 namespace HeuristicLab.GP.Interfaces {
     27namespace HeuristicLab.Encodings.SymbolicExpressionTree {
    2828  public interface IFunction : IItem {
    2929    string Name { get; }
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTree/3.3/Interfaces/IFunctionTree.cs

    r3218 r3219  
    2525using HeuristicLab.Core;
    2626
    27 namespace HeuristicLab.GP.Interfaces {
    28   public interface IFunctionTree : IStorable {
     27namespace HeuristicLab.Encodings.SymbolicExpressionTree {
     28  public interface IFunctionTree {
    2929    bool HasLocalParameters { get; }
    3030    IList<IFunctionTree> SubTrees { get; }
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTree/3.3/Manipulators/ChangeNodeTypeManipulation.cs

    r3218 r3219  
    2727using HeuristicLab.GP.Interfaces;
    2828
    29 namespace HeuristicLab.GP.Operators {
     29namespace HeuristicLab.Encodings.SymbolicExpressionTree {
    3030  public class ChangeNodeTypeManipulation : GPManipulatorBase {
    3131
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTree/3.3/Manipulators/CutOutNodeManipulation.cs

    r3218 r3219  
    2727using HeuristicLab.GP.Interfaces;
    2828
    29 namespace HeuristicLab.GP.Operators {
     29namespace HeuristicLab.Encodings.SymbolicExpressionTree {
    3030  public class CutOutNodeManipulation : GPManipulatorBase {
    3131    public override string Description {
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTree/3.3/Manipulators/DeleteSubTreeManipulation.cs

    r3218 r3219  
    2626using HeuristicLab.GP.Interfaces;
    2727
    28 namespace HeuristicLab.GP.Operators {
     28namespace HeuristicLab.Encodings.SymbolicExpressionTree {
    2929  public class DeleteSubTreeManipulation : GPManipulatorBase {
    3030    public override string Description {
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTree/3.3/Manipulators/FullTreeShaker.cs

    r3218 r3219  
    2525using HeuristicLab.Random;
    2626using HeuristicLab.Data;
    27 using HeuristicLab.GP.Interfaces;
    28 using HeuristicLab.Selection;
    2927
    30 namespace HeuristicLab.GP.Operators {
     28namespace HeuristicLab.Encodings.SymbolicExpressionTree {
    3129  public class FullTreeShaker : DelegatingOperator {
    3230    public override string Description {
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTree/3.3/Manipulators/GPManipulatorBase.cs

    r3218 r3219  
    2323using HeuristicLab.Random;
    2424using HeuristicLab.Data;
    25 using HeuristicLab.GP.Interfaces;
    2625
    27 namespace HeuristicLab.GP.Operators {
     26namespace HeuristicLab.Encodings.SymbolicExpressionTree {
    2827  public abstract class GPManipulatorBase : OperatorBase {
    2928    public GPManipulatorBase()
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTree/3.3/Manipulators/OnePointShaker.cs

    r3218 r3219  
    2525using HeuristicLab.Random;
    2626using HeuristicLab.Data;
    27 using HeuristicLab.Selection;
    28 using HeuristicLab.GP.Interfaces;
    2927
    30 namespace HeuristicLab.GP.Operators {
     28namespace HeuristicLab.Encodings.SymbolicExpressionTree {
    3129  public class OnePointShaker : DelegatingOperator {
    3230    public override string Description {
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTree/3.3/Manipulators/SubstituteSubTreeManipulation.cs

    r3218 r3219  
    2727using HeuristicLab.GP.Interfaces;
    2828
    29 namespace HeuristicLab.GP.Operators {
     29namespace HeuristicLab.Encodings.SymbolicExpressionTree {
    3030  public class SubstituteSubTreeManipulation : GPManipulatorBase {
    3131
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTree/3.3/Symbol.cs

    r3218 r3219  
    2424using System.Text;
    2525using HeuristicLab.Core;
    26 using System.Xml;
    27 using System.Diagnostics;
    28 using HeuristicLab.GP.Interfaces;
    2926using System.Linq;
    3027
    31 namespace HeuristicLab.GP {
    32   public abstract class Function : ItemBase, IFunction {
    33     private List<List<IFunction>> allowedSubFunctions = new List<List<IFunction>>();
     28namespace HeuristicLab.Encodings.SymbolicExpressionTree {
     29  public abstract class Symbol {
     30    private List<List<Symbol>> allowedSubFunctions = new List<List<Symbol>>();
    3431    private int minArity = -1;
    3532    private int maxArity = -1;
     
    8885            if (allowedSubFunctions.Count > 0) {
    8986              // copy the list of allowed sub-functions from the previous slot
    90               allowedSubFunctions.Add(new List<IFunction>(allowedSubFunctions[allowedSubFunctions.Count - 1]));
     87              allowedSubFunctions.Add(new List<Symbol>(allowedSubFunctions[allowedSubFunctions.Count - 1]));
    9188            } else {
    9289              // add empty list
    93               allowedSubFunctions.Add(new List<IFunction>());
     90              allowedSubFunctions.Add(new List<Symbol>());
    9491            }
    9592          }
     
    107104          FireChanged();
    108105        }
    109         Debug.Assert(minTreeSize > 0);
     106        // Debug.Assert(minTreeSize > 0);
    110107        return minTreeSize;
    111108      }
     
    118115          FireChanged();
    119116        }
    120         Debug.Assert(minTreeHeight > 0);
     117        // Debug.Assert(minTreeHeight > 0);
    121118        return minTreeHeight;
    122119      }
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTree/3.3/SymbolicExpressionTree.cs

    r3218 r3219  
    2424using System.Text;
    2525using HeuristicLab.Core;
    26 using HeuristicLab.GP.Interfaces;
    2726using System.Xml;
    2827
    29 namespace HeuristicLab.GP {
    30   public class FunctionTree : IFunctionTree {
    31     private List<IFunctionTree> subTrees;
     28namespace HeuristicLab.Encodings.SymbolicExpressionTree {
     29  public class SymbolicExpressionTree {
     30    private List<SymbolicExpressionTree> subTrees;
    3231    private IFunction function;
    3332
    34     public FunctionTree() {
     33    public SymbolicExpressionTree() {
    3534    }
    3635
    37     public FunctionTree(IFunction function) {
    38       subTrees = new List<IFunctionTree>();
     36    public SymbolicExpressionTree(Symbol symbol) {
     37      subTrees = new List<SymbolicExpressionTree>();
    3938      this.function = function;
    4039    }
    4140
    42     protected FunctionTree(FunctionTree original) {
     41    protected SymbolicExpressionTree(SymbolicExpressionTree original) {
    4342      this.function = original.Function;
    44       this.subTrees = new List<IFunctionTree>(original.SubTrees.Count);
    45       foreach (IFunctionTree originalSubTree in original.SubTrees) {
    46         this.SubTrees.Add((IFunctionTree)originalSubTree.Clone());
     43      this.subTrees = new List<SymbolicExpressionTree>(original.SubTrees.Count);
     44      foreach (SymbolicExpressionTree originalSubTree in original.SubTrees) {
     45        this.SubTrees.Add((SymbolicExpressionTree)originalSubTree.Clone());
    4746      }
    4847    }
    4948
    50     #region IFunctionTree Members
    5149    public virtual bool HasLocalParameters {
    5250      get { return false; }
    5351    }
    5452
    55     public virtual IList<IFunctionTree> SubTrees {
     53    public virtual IList<SymbolicExpressionTree> SubTrees {
    5654      get { return subTrees; }
    5755    }
    5856
    59     public IFunction Function {
     57    public Symbol Function {
    6058      get { return function; }
    6159      protected set { function = value; }
     
    6462    public int GetSize() {
    6563      int size = 1;
    66       foreach (IFunctionTree tree in SubTrees) size += tree.GetSize();
     64      foreach (SymbolicExpressionTree tree in SubTrees) size += tree.GetSize();
    6765      return size;
    6866    }
     
    7068    public int GetHeight() {
    7169      int maxHeight = 0;
    72       foreach (IFunctionTree tree in SubTrees) maxHeight = Math.Max(maxHeight, tree.GetHeight());
     70      foreach (SymbolicExpressionTree tree in SubTrees) maxHeight = Math.Max(maxHeight, tree.GetHeight());
    7371      return maxHeight + 1;
    7472    }
     
    8280    }
    8381
    84     public void AddSubTree(IFunctionTree tree) {
     82    public void AddSubTree(SymbolicExpressionTree tree) {
    8583      SubTrees.Add(tree);
    8684    }
    8785
    88     public virtual void InsertSubTree(int index, IFunctionTree tree) {
     86    public virtual void InsertSubTree(int index, SymbolicExpressionTree tree) {
    8987      SubTrees.Insert(index, tree);
    9088    }
     
    9896    }
    9997
    100     #endregion
    10198
    10299    #region IStorable Members
     
    107104
    108105    public virtual object Clone() {
    109       return new FunctionTree(this);
     106      return new SymbolicExpressionTree(this);
    110107    }
    111108
Note: See TracChangeset for help on using the changeset viewer.