Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/24/14 23:50:17 (10 years ago)
Author:
bburlacu
Message:

#1772: Some progress on tracking fragments and building blocks, still incomplete.

Location:
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionAfterCrossoverOperator.cs

    r10650 r10654  
    99  public class SymbolicDataAnalysisExpressionAfterCrossoverOperator : AfterCrossoverOperator<ISymbolicExpressionTree> {
    1010    public override IOperation Apply() {
    11       var childVertex = GenealogyGraph[ChildParameter.ActualValue].Last();
     11      var child = ChildParameter.ActualValue;
     12      var childVertex = GenealogyGraph[child].Last();
    1213      var arc0 = (IGenealogyGraphArc)childVertex.InArcs[0];
    1314      var arc1 = (IGenealogyGraphArc)childVertex.InArcs[1];
    1415      var nodes0 = (List<ISymbolicExpressionTreeNode>)arc0.Data;
    1516      var nodes1 = (List<ISymbolicExpressionTreeNode>)arc1.Data;
    16       var childNodes = ChildParameter.ActualValue.IterateNodesBreadth().ToList();
     17      var childNodes = child.IterateNodesPrefix().ToList();
    1718      IFragment<ISymbolicExpressionTreeNode> fragment = null;
    18 
    1919      for (int i = 0; i < Math.Min(nodes0.Count, childNodes.Count); ++i) {
    2020        if (nodes0[i] == childNodes[i]) continue;
    2121        fragment = new Fragment<ISymbolicExpressionTreeNode> {
    2222          Root = childNodes[i],
    23           Index = i
     23          Index = i,
    2424        };
     25        fragment.OldIndex = nodes1.IndexOf(fragment.Root);
     26        break;
    2527      }
    2628      if (fragment == null) throw new Exception("Could not determine fragment!");
    27 
    28       for (int i = 0; i < nodes1.Count; ++i) {
    29         if (nodes1[i] != fragment.Root) continue;
    30         fragment.OldIndex = i;
    31       }
    3229
    3330      arc0.Data = null;
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionBeforeCrossoverOperator.cs

    r10459 r10654  
    77  public class SymbolicDataAnalysisExpressionBeforeCrossoverOperator : BeforeCrossoverOperator<ISymbolicExpressionTree> {
    88    public override IOperation Apply() {
    9       var result = base.Apply();
     9      var result = base.Apply(); // the child will be added to the graph before the crossover
    1010      var parents = ParentsParameter.ActualValue.ToList();
    1111      var childVertex = GenealogyGraph[parents[0]].Last(); // use the parent since it is actually the child before crossover (and the ChildParameter doesn't have a value yet)
    1212      //      var parentVertices = ExecutionContext.Scope.SubScopes.Select(s => CurrentGeneration[int.Parse(s.Name)]).ToList();
    1313
     14      // we add the breadth list of nodes of each parent as the data element of the arc from the parent to the child
    1415      for (int i = 0; i < parents.Count; ++i) {
    15         var nodes = parents[i].IterateNodesBreadth().ToList();
     16        var nodes = parents[i].IterateNodesPrefix().ToList();
    1617        var arc = (IGenealogyGraphArc)childVertex.InArcs[i];
    1718        arc.Data = nodes;
Note: See TracChangeset for help on using the changeset viewer.