Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9237


Ignore:
Timestamp:
02/21/13 15:42:21 (12 years ago)
Author:
bburlacu
Message:

#1772: Merged HeuristicLab.Encodings.SymbolicExpressionTreeEncoding trunk changes into the branch. Changed fragments using the tree manipulator are now tracked using the SymbolicExpressionTreeNodeComparer.

Location:
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Analyzers/SymbolicExpressionTreeLengthAnalyzer.cs

    r9083 r9237  
    7171    }
    7272    #endregion
    73 
    7473    #region Properties
    7574    public bool EnabledByDefault {
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj

    r9083 r9237  
    171171    <Compile Include="Interfaces\IFragment.cs" />
    172172    <Compile Include="Interfaces\Operators\ITracingSymbolicExpressionTreeOperator.cs" />
     173    <Compile Include="Manipulators\RemoveBranchManipulation.cs" />
     174    <Compile Include="SymbolicExpressionTreeTextRenderer.cs" />
    173175    <Compile Include="TracingSymbolicExpressionTreeOperator.cs" />
    174176    <Compile Include="Creators\TracingSymbolicExpressionTreeCreator.cs" />
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Manipulators

  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Manipulators/ChangeNodeTypeManipulation.cs

    r9083 r9237  
    2020#endregion
    2121
     22using System.Collections.Generic;
    2223using System.Linq;
    2324using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    26 using System.Collections.Generic;
    2727
    2828namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Manipulators/RemoveBranchManipulation.cs

    r9083 r9237  
    3131  [StorableClass]
    3232  [Item("RemoveBranchManipulation", "Removes a random sub-tree of the input tree and fixes the tree by generating random subtrees if necessary..")]
    33   public sealed class RemoveBranchManipulation : SymbolicExpressionTreeManipulator, ISymbolicExpressionTreeSizeConstraintOperator {
     33  public sealed class RemoveBranchManipulation : TracingSymbolicExpressionTreeManipulator, ISymbolicExpressionTreeSizeConstraintOperator {
    3434    private const int MAX_TRIES = 100;
    3535    private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength";
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Manipulators/ReplaceBranchManipulation.cs

    r9083 r9237  
    2020#endregion
    2121
     22using System.Collections.Generic;
    2223using System.Linq;
    2324using HeuristicLab.Common;
     
    2627using HeuristicLab.Parameters;
    2728using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    28 using System.Collections.Generic;
    2929
    3030namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Manipulators/TracingSymbolicExpressionTreeManipulator.cs

    r9083 r9237  
    6565      manipulationTypes.Add(typeof(ChangeNodeTypeManipulation), ManipulationType.ChangeNodeTypeManipulation);
    6666      manipulationTypes.Add(typeof(ReplaceBranchManipulation), ManipulationType.ReplaceBranchManipulation);
     67      manipulationTypes.Add(typeof(RemoveBranchManipulation), ManipulationType.RemoveBranchManipulation);
    6768    }
    6869
     
    9596      }
    9697
    97       var concreteType = this.GetType();
     98      //      var concreteType = this.GetType();
    9899
    99       if (!manipulationTypes.ContainsKey(concreteType))
    100         throw new Exception(this.Name + ": Unknown manipulation type (key not found in the dictionary).");
     100      //      if (!manipulationTypes.ContainsKey(concreteType))
     101      //        throw new Exception(this.Name + ": Unknown manipulation type (key not found in the dictionary).");
    101102
    102       var nodes0 = tree.IterateNodesBreadth().ToList(); // list of nodes before manipulation
     103      //      var nodes0 = tree.IterateNodesBreadth().ToList(); // list of nodes before manipulation
     104      //      Manipulate(RandomParameter.ActualValue, tree);
     105      //      var nodes1 = tree.IterateNodesBreadth().ToList(); // list of nodes after manipulation
     106
     107      var comparer = SymbolicExpressionTreeNodeComparer;
     108      var clonedTree = (ISymbolicExpressionTree)tree.Clone();
     109      var nodes0 = clonedTree.IterateNodesBreadth().ToList();
    103110      Manipulate(RandomParameter.ActualValue, tree);
    104       var nodes1 = tree.IterateNodesBreadth().ToList(); // list of nodes after manipulation
     111      var nodes1 = tree.IterateNodesBreadth().ToList();
     112
    105113      int min = Math.Min(nodes0.Count, nodes1.Count);
     114      int i = 0; while (i != min && comparer.Equals(nodes0[i], nodes1[i])) ++i;
     115      fragment = new Fragment(i == min ? null : nodes1[i], 1);
     116      GlobalFragmentMap[tree] = fragment;
    106117
    107       switch (manipulationTypes[concreteType]) {
    108         case ManipulationType.FullTreeShaker: {
    109             // the FullTreeShaker changes the local parameters of all the nodes in the tree
    110             // therefore, the whole tree is considered to be the fragment
    111             fragment = new Fragment(tree.Root.GetSubtree(0).GetSubtree(0));
    112             break;
    113           }
    114         case ManipulationType.OnePointShaker: {
    115             var original = (ISymbolicExpressionTree)GlobalCloneMap[tree];
    116             var nodesOriginal = original.IterateNodesBreadth().ToList();
    117             int i = 0;
    118             var comparer = SymbolicExpressionTreeNodeComparer;
    119             while (i != min && comparer.Equals(nodesOriginal[i], nodes1[i])) ++i;
    120             fragment = new Fragment(i == min ? null : nodes1[i], 1);
    121             break;
    122           }
    123         case ManipulationType.ChangeNodeTypeManipulation: {
    124             int i = 0;
    125             while (i != min && ReferenceEquals(nodes0[i], nodes1[i])) ++i;
    126             fragment = new Fragment(i == min ? null : nodes1[i], 1);
    127             break;
    128           }
    129         case ManipulationType.ReplaceBranchManipulation: {
    130             int i = 0;
    131             while (i != min && ReferenceEquals(nodes0[i], nodes1[i])) ++i;
    132             fragment = new Fragment(i == min ? null : nodes1[i]);
    133             break;
    134           }
    135         default:
    136           throw new Exception(Name + ": Unknown manipulaton type.");
    137       }
     118
     119
     120      //      switch (manipulationTypes[concreteType]) {
     121      //        case ManipulationType.FullTreeShaker: {
     122      //            // the FullTreeShaker changes the local parameters of all the nodes in the tree
     123      //            // therefore, the whole tree is considered to be the fragment
     124      //            fragment = new Fragment(tree.Root.GetSubtree(0).GetSubtree(0));
     125      //            break;
     126      //          }
     127      //        case ManipulationType.OnePointShaker: {
     128      //            var original = (ISymbolicExpressionTree)GlobalCloneMap[tree];
     129      //            var nodesOriginal = original.IterateNodesBreadth().ToList();
     130      //            int i = 0;
     131      //            var comparer = SymbolicExpressionTreeNodeComparer;
     132      //            while (i != min && comparer.Equals(nodesOriginal[i], nodes1[i])) ++i;
     133      //            fragment = new Fragment(i == min ? null : nodes1[i], 1);
     134      //            break;
     135      //          }
     136      //        case ManipulationType.ChangeNodeTypeManipulation: {
     137      //            int i = 0;
     138      //            while (i != min && ReferenceEquals(nodes0[i], nodes1[i])) ++i;
     139      //            fragment = new Fragment(i == min ? null : nodes1[i], 1);
     140      //            break;
     141      //          }
     142      //        case ManipulationType.ReplaceBranchManipulation: {
     143      //            int i = 0;
     144      //            while (i != min && ReferenceEquals(nodes0[i], nodes1[i])) ++i;
     145      //            fragment = new Fragment(i == min ? null : nodes1[i]);
     146      //            break;
     147      //          }
     148      //        case ManipulationType.RemoveBranchManipulation: {
     149      //            int i = 0;
     150      //            while (i != min && ReferenceEquals(nodes0[i], nodes1[i])) ++i;
     151      //            fragment = new Fragment(i == min ? null : nodes1[i]);
     152      //            break;
     153      //          }
     154      //        default:
     155      //          throw new Exception(Name + ": Unknown manipulaton type.");
     156      //      }
    138157
    139158      GlobalFragmentMap[tree] = fragment;
     
    148167      public const byte ChangeNodeTypeManipulation = 3;
    149168      public const byte ReplaceBranchManipulation = 4;
     169      public const byte RemoveBranchManipulation = 5;
    150170    }
    151171  }
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Plugin.cs

    r9083 r9237  
    2323
    2424namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
    25   [Plugin("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding","Provides operators and related classes for the symbolic expression tree encoding.", "3.4.3.8557")]
     25  [Plugin("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding","Provides operators and related classes for the symbolic expression tree encoding.", "3.4.3.9083")]
    2626  [PluginFile("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll", PluginFileType.Assembly)]
    2727  [PluginDependency("HeuristicLab.Analysis", "3.3")]
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/TracingSymbolicExpressionTreeOperator.cs

    r9083 r9237  
    6767      if (!Parameters.ContainsKey(GlobalGeneticExchangeMapParameterName))
    6868        Parameters.Add(new LookupParameter<GeneticExchangeMapType>(GlobalGeneticExchangeMapParameterName, "A global list of genetic exchange transactions."));
     69      if (!Parameters.ContainsKey(SymbolicExpressionTreeNodeComparerParameterName))
     70        Parameters.Add(new ValueParameter<ISymbolicExpressionTreeNodeComparer>(SymbolicExpressionTreeNodeComparerParameterName, SymbolicExpressionTreeNodeComparerParameterDescription));
    6971    }
    7072
Note: See TracChangeset for help on using the changeset viewer.