Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/02/15 13:58:40 (9 years ago)
Author:
bburlacu
Message:

#1772: Micro optimization inside the TraceCalculator and inside the GenealogyGraphNode (Children and Parents properties), resulting in maybe 25% speed gain. Corrected item name for the BeforeCrossoverOperator, very minor refactoring inside the BeforeManipulatorOperator. Updated project file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/BeforeManipulatorOperator.cs

    r11387 r11858  
    5353    public override IOperation Apply() {
    5454      // since mutation always takes place after crossover, the vertex for the current child is already in the tree
    55       var childVertex = GenealogyGraph.GetByContent(ChildParameter.ActualValue);
    56       var clonedVertex = (IGenealogyGraphNode<T>)childVertex.Clone();
    57       clonedVertex.Rank = childVertex.Rank - 0.5;
    58       GenealogyGraph.AddVertex(clonedVertex);
     55      var vChild = GenealogyGraph.GetByContent(ChildParameter.ActualValue);
     56      var vClone = (IGenealogyGraphNode<T>)vChild.Clone();
     57      vClone.Rank = vChild.Rank - 0.5;
     58      GenealogyGraph.AddVertex(vClone);
    5959
    60       var arcs = childVertex.InArcs.ToList();
     60      var arcs = vChild.InArcs.ToList();
    6161      foreach (var arc in arcs) {
    6262        var p = arc.Source;
    6363        GenealogyGraph.RemoveArc(arc);
    64         GenealogyGraph.AddArc(new GenealogyGraphArc(p, clonedVertex));
     64        GenealogyGraph.AddArc(new GenealogyGraphArc(p, vClone));
    6565      }
    6666      // by convention, the arc connecting child with parent (non-root parent in case of crossover)
    6767      // holds fragment data when applicable. the following line of code preserves this data
    6868      // the graph arcs are now connecting parent (rank n) --> clone (rank n+0.5) --> child (rank n+1)
    69       clonedVertex.InArcs.Last().Data = arcs.Last().Data;
    70       GenealogyGraph.AddArc(new GenealogyGraphArc(clonedVertex, childVertex));
     69      vClone.InArcs.Last().Data = arcs.Last().Data;
     70      GenealogyGraph.AddArc(new GenealogyGraphArc(vClone, vChild));
    7171
    7272      return base.Apply();
Note: See TracChangeset for help on using the changeset viewer.