Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionBeforeCrossoverOperator.cs @ 10459

Last change on this file since 10459 was 10459, checked in by bburlacu, 11 years ago

#1772: Merged uncomitted pruning code from trunk. Removed Plugin.cs file. Renamed SymbolicDataAnalysisExpressionAfterCrossoverOperator.cs and SymbolicDataAnalysisExpressionBeforeCrossoverOperator.cs

File size: 1.0 KB
RevLine 
[10459]1using System.Linq;
2using HeuristicLab.Core;
3using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
4using HeuristicLab.EvolutionTracking;
5
6namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
7  public class SymbolicDataAnalysisExpressionBeforeCrossoverOperator : BeforeCrossoverOperator<ISymbolicExpressionTree> {
8    public override IOperation Apply() {
9      var result = base.Apply();
10      var parents = ParentsParameter.ActualValue.ToList();
11      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)
12      //      var parentVertices = ExecutionContext.Scope.SubScopes.Select(s => CurrentGeneration[int.Parse(s.Name)]).ToList();
13
14      for (int i = 0; i < parents.Count; ++i) {
15        var nodes = parents[i].IterateNodesBreadth().ToList();
16        var arc = (IGenealogyGraphArc)childVertex.InArcs[i];
17        arc.Data = nodes;
18      }
19
20      return result;
21    }
22  }
23}
Note: See TracBrowser for help on using the repository browser.