Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/31/14 18:28:25 (10 years ago)
Author:
bburlacu
Message:

#1772: Fixed bug and improved handling of elite individuals in the genealogy analyzer. Fixed minor bug in the tracing code. Other minor cosmetic improvements to the GenealogyGraph and FragmentGraphView.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Analyzers/GenealogyAnalyzer.cs

    r11288 r11318  
    272272          var prevVertex = (IGenealogyGraphNode<T>)GenealogyGraph.GetByContent(elite);
    273273          prevVertex.IsElite = true; // mark elites in the graph retroactively
    274           var w = (IGenealogyGraphNode<T>)prevVertex.Clone();
    275           var v = new GenealogyGraphNode<T>(prevVertex.Data) {
     274          var v = new GenealogyGraphNode<T>((IDeepCloneable)prevVertex.Data.Clone()) {
    276275            Rank = generation,
    277276            Quality = prevVertex.Quality,
    278277            IsElite = false
    279278          };
    280 
    281           object data = null;
    282           if (prevVertex.InArcs.Any())
    283             data = prevVertex.InArcs.Last().Data;
    284           var children = prevVertex.Children.ToList();
    285           var parents = prevVertex.Parents.ToList();
    286 
    287           GenealogyGraph.RemoveVertex(prevVertex);
    288           GenealogyGraph.AddVertex(w);
    289279          GenealogyGraph.AddVertex(v);
    290           GenealogyGraph.AddArc(w, v); // connect current elite with previous elite
    291 
    292           // recreate connections after prevVertex was replaced with w
    293           foreach (var c in children) GenealogyGraph.AddArc(w, c);
    294           foreach (var p in parents) GenealogyGraph.AddArc(p, w);
    295 
    296           v.InArcs.Last().Data = data;
    297 
    298           if (w.InArcs.Any())
    299             w.InArcs.Last().Data = data;
     280          GenealogyGraph.AddArc(prevVertex, v);
    300281
    301282          // inject the graph node unique id to the scope
     283          ExecutionContext.Scope.SubScopes[index].Variables[BeforeManipulatorOperator.ChildParameter.ActualName].Value = v.Data;
    302284          ExecutionContext.Scope.SubScopes[index].Variables["Id"].Value = new StringValue(v.Id);
    303285        }
Note: See TracChangeset for help on using the changeset viewer.