Changeset 11383
- Timestamp:
- 09/23/14 14:11:37 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/BeforeManipulatorOperator.cs
r11288 r11383 53 53 public override IOperation Apply() { 54 54 // since mutation always takes place after crossover, the vertex for the current child is already in the tree 55 var v= (IGenealogyGraphNode<T>)GenealogyGraph.GetByContent(ChildParameter.ActualValue);56 var c = (IGenealogyGraphNode<T>)v.Clone();57 c .Rank = v.Rank - 0.5;58 GenealogyGraph.AddVertex(c );55 var childVertex = (IGenealogyGraphNode<T>)GenealogyGraph.GetByContent(ChildParameter.ActualValue); 56 var clonedVertex = (IGenealogyGraphNode<T>)childVertex.Clone(); 57 clonedVertex.Rank = childVertex.Rank - 0.5; 58 GenealogyGraph.AddVertex(clonedVertex); 59 59 60 var arcs = v.InArcs.ToList();60 var arcs = childVertex.InArcs.ToList(); 61 61 foreach (var arc in arcs) { 62 62 var p = arc.Source; 63 63 GenealogyGraph.RemoveArc(arc); 64 GenealogyGraph.AddArc(new GenealogyGraphArc(p, c ));64 GenealogyGraph.AddArc(new GenealogyGraphArc(p, clonedVertex)); 65 65 } 66 67 GenealogyGraph.AddArc( c, v);66 clonedVertex.InArcs.Last().Data = arcs.Last().Data; // preserve fragment data 67 GenealogyGraph.AddArc(new GenealogyGraphArc(clonedVertex, childVertex)); 68 68 69 69 return base.Apply();
Note: See TracChangeset
for help on using the changeset viewer.