Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/04/12 16:12:15 (12 years ago)
Author:
bburlacu
Message:

#1772: Performance improvements for the GenealogyGraph. Minor refactoring to VisualGenealogyGraphArc and VisualGenealogyGraphNode classes. Added new functionality to the SymbolicExpressionTreeFragmentsAnalyzer, minor refactoring in the other two analyzers. Refactored View code. Updated project references and plugin dependencies and added HeuristicLab.Problems.DataAnalysis.Symbolic to the branch.

Location:
branches/HeuristicLab.EvolutionaryTracking
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionaryTracking

    • Property svn:ignore
      •  

        old new  
         1*.suo
        12_ReSharper.HeuristicLab.Tracking
        23bin
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4

    • Property svn:ignore
      •  

        old new  
         1*.user
        12bin
        23obj
        3 HeuristicLabEncodingsSymbolicExpressionTreeEncodingPlugin.cs
        4 *.user
        5 *.vs10x
        6 Plugin.cs
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Manipulators/TracingSymbolicExpressionTreeManipulator.cs

    r7997 r8213  
    2121
    2222using System;
    23 using System.Collections.Generic;
     23using System.Linq;
    2424using HeuristicLab.Common;
    2525using HeuristicLab.Core;
     
    9696        gScope.Variables.Add(new Variable(GlobalFragmentMapParameterName, new CloneMapType()));
    9797
     98      int i = 0;
    9899      if (GlobalTraceMap.ContainsKey(tree)) {
    99100        // tree was affected by crossover before mutation
     
    102103        // In order to preserve information, a tree clone is created before mutation and added to the trace map.
    103104        var clone = (IItem)tree.Clone();
    104         GlobalTraceMap[clone] = GlobalTraceMap[tree];
    105         GlobalTraceMap[tree] = new ItemList<IItem> { clone };
    106         GlobalFragmentMap[clone] = GlobalFragmentMap[tree];
     105        GlobalTraceMap[clone] = GlobalTraceMap[tree]; // clone gets parents of tree
     106        GlobalTraceMap[tree] = new ItemList<IItem> { clone }; // tree gets clone as parent
     107        var nodes = tree.IterateNodesBreadth().ToList();
     108        for (i = 0; i != nodes.Count; ++i) {
     109          if ((GlobalFragmentMap[tree] as GenericWrapper<SymbolicExpressionTreeNode>).Content == nodes[i]) break;
     110        }
     111        var fragment = (SymbolicExpressionTreeNode)(((SymbolicExpressionTree)clone).IterateNodesBreadth().ElementAt(i));
     112        GlobalFragmentMap[clone] = new GenericWrapper<SymbolicExpressionTreeNode>(fragment);
    107113      } else {
    108114        var original = GlobalCloneMap[tree];
    109115        GlobalTraceMap[tree] = new ItemList<IItem> { original };
    110116      }
    111       var nodes0 = tree.IterateNodesBreadth() as List<ISymbolicExpressionTreeNode>;
     117      var nodes0 = tree.IterateNodesBreadth().ToList();
    112118      Manipulate(RandomParameter.ActualValue, tree);
    113       var nodes1 = tree.IterateNodesBreadth() as List<ISymbolicExpressionTreeNode>;
    114       int i, min = Math.Max(nodes0.Count, nodes1.Count);
     119      var nodes1 = tree.IterateNodesBreadth().ToList();
     120      int min = Math.Min(nodes0.Count, nodes1.Count);
    115121      for (i = 0; i != min; ++i)
    116122        if (nodes0[i] != nodes1[i]) break;
    117       if (i == min) i = 0;
    118       GlobalFragmentMap[tree] = new GenericWrapper<ISymbolicExpressionTreeNode>(nodes1[i]);
    119 
     123      GlobalFragmentMap[tree] = new GenericWrapper<SymbolicExpressionTreeNode>(i == min ? null : (SymbolicExpressionTreeNode)nodes1[i]);
    120124      return base.Apply();
    121125    }
Note: See TracChangeset for help on using the changeset viewer.