Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10890


Ignore:
Timestamp:
05/26/14 16:28:09 (11 years ago)
Author:
bburlacu
Message:

#1772: Deleted unused VisualGenealogyGraphTextLabel.cs, fixed tracking code in BeforeManipulatorOperator.cs, re-added setters for vertex in- and outArcs.

Location:
branches/HeuristicLab.EvolutionTracking
Files:
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/Vertex.cs

    r10888 r10890  
    4646    public IEnumerable<IArc> InArcs {
    4747      get { return inArcs ?? Enumerable.Empty<IArc>(); }
     48      set { inArcs = value.ToList(); }
    4849    }
    4950    [Storable]
     
    5152    public IEnumerable<IArc> OutArcs {
    5253      get { return outArcs ?? Enumerable.Empty<IArc>(); }
     54      set { outArcs = value.ToList(); }
    5355    }
    5456    [Storable]
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraphNode.cs

    r10888 r10890  
    4343    public new IEnumerable<IGenealogyGraphArc> InArcs {
    4444      get { return base.InArcs.Cast<IGenealogyGraphArc>(); }
     45      set { base.InArcs = value; }
    4546    }
    4647    public new IEnumerable<IGenealogyGraphArc> OutArcs {
    4748      get { return base.OutArcs.Cast<IGenealogyGraphArc>(); }
     49      set { base.OutArcs = value; }
    4850    }
    4951    public IEnumerable<IGenealogyGraphNode> Ancestors {
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/Interfaces/IGenealogyGraphNode.cs

    r10888 r10890  
    3333    IEnumerable<IGenealogyGraphNode> Ancestors { get; }
    3434    IEnumerable<IGenealogyGraphNode> Descendants { get; }
    35     new IEnumerable<IGenealogyGraphArc> InArcs { get; }
    36     new IEnumerable<IGenealogyGraphArc> OutArcs { get; }
     35    new IEnumerable<IGenealogyGraphArc> InArcs { get; set; }
     36    new IEnumerable<IGenealogyGraphArc> OutArcs { get; set; }
    3737  }
    3838
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/BeforeCrossoverOperator.cs

    r10888 r10890  
    8181        // but the first parent is actually the future child so we use this
    8282        Content = parents[0],
    83         //        Rank = Generations.Value + 1
    8483        Rank = parentVertices[0].Rank + 1
    8584      };
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/BeforeManipulatorOperator.cs

    r10888 r10890  
    2020#endregion
    2121
     22using System;
    2223using System.Linq;
    2324using HeuristicLab.Common;
     
    4950
    5051    public override IOperation Apply() {
    51       var vChild = (IGenealogyGraphNode<T>)GenealogyGraph[ChildParameter.ActualValue];
    52       if (vChild.Rank.IsAlmost(Generations.Value + 1)) {
    53         // if the graph already contains a vertex representing the child, it means that the child is a product of crossover
    54         // when mutation follows after crossover, some changes need to be made to the graph to maintain consistency
    55         var vClone = new GenealogyGraphNode<T> {
    56           Content = (T)ChildParameter.ActualValue.Clone(),
    57           Rank = vChild.Parents.Last().Rank + 0.5
    58         };
    59         GenealogyGraph.AddVertex(vClone);
     52      // since mutation always takes place after crossover, the vertex for the current child is already in the tree
     53      var v = (IGenealogyGraphNode<T>)GenealogyGraph[ChildParameter.ActualValue];
    6054
    61         foreach (var arc in vChild.InArcs) {
    62           arc.Target = vClone;
    63           vClone.AddReverseArc(arc);
    64         }
     55      if (!v.Rank.IsAlmost(Generations.Value + 1)) {
     56        throw new Exception("Child rank should be generations.value + 1");
     57      }
     58      var clone = (T)ChildParameter.ActualValue.Clone();
    6559
    66         vClone.InArcs.Last().Data = vChild.InArcs.Last().Data; // fragment of child becomes fragment of clone
    67         GenealogyGraph.AddArc(vClone, vChild);
     60      var c = new GenealogyGraphNode<T> {
     61        Rank = v.Rank - 0.5,
     62        Content = clone
     63      };
    6864
    69         // the following step in necessary because some mutation operators change values while the reference stays the same
    70         // so we clone in order to prevent mutations to be "shadowed" in the parent
    71         var parent = vClone.Parents.First();
    72         parent.Content = (T)parent.Content.Clone();
    73         GenealogyGraph[parent.Content] = parent;
     65      foreach (var a in v.InArcs) {
     66        a.Target = c;
     67        c.AddReverseArc(a);
     68      }
    7469
    75       } else if (vChild.Rank.IsAlmost(Generations.Value)) {
    76         var clone = (T)ChildParameter.ActualValue.Clone();
    77         GenealogyGraph.SetContent(vChild, clone);
    78         var xx = new GenealogyGraphNode<T> { Content = ChildParameter.ActualValue, Rank = Generations.Value + 1 };
    79         GenealogyGraph.AddVertex(xx);
    80         GenealogyGraph.AddArc(vChild, xx);
    81       }
     70      v.InArcs = Enumerable.Empty<IGenealogyGraphArc>();
     71
     72      GenealogyGraph.AddVertex(c);
     73      GenealogyGraph.AddArc(c, v);
     74
    8275      return base.Apply();
    8376    }
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionAfterCrossoverOperator.cs

    r10833 r10890  
    3030  public class SymbolicDataAnalysisExpressionAfterCrossoverOperator : AfterCrossoverOperator<ISymbolicExpressionTree> {
    3131    public override IOperation Apply() {
    32       var child = ChildParameter.ActualValue;
    33       var childVertex = (IGenealogyGraphNode)GenealogyGraph[child];
     32      var childVertex = (IGenealogyGraphNode<ISymbolicExpressionTree>)GenealogyGraph[ChildParameter.ActualValue];
    3433      var arcs = childVertex.InArcs.ToList();
    3534      var nodes0 = (List<ISymbolicExpressionTreeNode>)arcs[0].Data;
    3635      var nodes1 = (List<ISymbolicExpressionTreeNode>)arcs[1].Data;
    37       var childNodes = child.IterateNodesPrefix().ToList();
     36      var childNodes = childVertex.Content.IterateNodesPrefix().ToList();
    3837      IFragment<ISymbolicExpressionTreeNode> fragment = null;
    3938      for (int i = 0; i < Math.Min(nodes0.Count, childNodes.Count); ++i) {
Note: See TracChangeset for help on using the changeset viewer.