Changeset 10654 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking
- Timestamp:
- 03/24/14 23:50:17 (10 years ago)
- 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 9 9 public class SymbolicDataAnalysisExpressionAfterCrossoverOperator : AfterCrossoverOperator<ISymbolicExpressionTree> { 10 10 public override IOperation Apply() { 11 var childVertex = GenealogyGraph[ChildParameter.ActualValue].Last(); 11 var child = ChildParameter.ActualValue; 12 var childVertex = GenealogyGraph[child].Last(); 12 13 var arc0 = (IGenealogyGraphArc)childVertex.InArcs[0]; 13 14 var arc1 = (IGenealogyGraphArc)childVertex.InArcs[1]; 14 15 var nodes0 = (List<ISymbolicExpressionTreeNode>)arc0.Data; 15 16 var nodes1 = (List<ISymbolicExpressionTreeNode>)arc1.Data; 16 var childNodes = ChildParameter.ActualValue.IterateNodesBreadth().ToList();17 var childNodes = child.IterateNodesPrefix().ToList(); 17 18 IFragment<ISymbolicExpressionTreeNode> fragment = null; 18 19 19 for (int i = 0; i < Math.Min(nodes0.Count, childNodes.Count); ++i) { 20 20 if (nodes0[i] == childNodes[i]) continue; 21 21 fragment = new Fragment<ISymbolicExpressionTreeNode> { 22 22 Root = childNodes[i], 23 Index = i 23 Index = i, 24 24 }; 25 fragment.OldIndex = nodes1.IndexOf(fragment.Root); 26 break; 25 27 } 26 28 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 }32 29 33 30 arc0.Data = null; -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionBeforeCrossoverOperator.cs
r10459 r10654 7 7 public class SymbolicDataAnalysisExpressionBeforeCrossoverOperator : BeforeCrossoverOperator<ISymbolicExpressionTree> { 8 8 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 10 10 var parents = ParentsParameter.ActualValue.ToList(); 11 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 12 // var parentVertices = ExecutionContext.Scope.SubScopes.Select(s => CurrentGeneration[int.Parse(s.Name)]).ToList(); 13 13 14 // we add the breadth list of nodes of each parent as the data element of the arc from the parent to the child 14 15 for (int i = 0; i < parents.Count; ++i) { 15 var nodes = parents[i].IterateNodes Breadth().ToList();16 var nodes = parents[i].IterateNodesPrefix().ToList(); 16 17 var arc = (IGenealogyGraphArc)childVertex.InArcs[i]; 17 18 arc.Data = nodes;
Note: See TracChangeset
for help on using the changeset viewer.