Changeset 8213 for branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Crossovers
- Timestamp:
- 07/04/12 16:12:15 (12 years ago)
- Location:
- branches/HeuristicLab.EvolutionaryTracking
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionaryTracking
- Property svn:ignore
-
old new 1 *.suo 1 2 _ReSharper.HeuristicLab.Tracking 2 3 bin
-
- Property svn:ignore
-
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4
- Property svn:ignore
-
old new 1 *.user 1 2 bin 2 3 obj 3 HeuristicLabEncodingsSymbolicExpressionTreeEncodingPlugin.cs4 *.user5 *.vs10x6 Plugin.cs
-
- Property svn:ignore
-
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Crossovers/TracingSymbolicExpressionTreeCrossover.cs
r7997 r8213 21 21 22 22 using System; 23 using System.Collections.Generic;24 23 using System.Linq; 25 24 using HeuristicLab.Common; … … 117 116 118 117 // save the nodes of parent0 in a list so we can track what modifications are made by crossover 119 var nodes0 = Parents[0].IterateNodesBreadth() as List<ISymbolicExpressionTreeNode>;118 var nodes0 = Parents[0].IterateNodesBreadth().ToList(); 120 119 121 // perform crossover120 // perform crossover 122 121 Child = Crossover(Random, Parents[0], Parents[1]); 123 122 124 123 // create another list of parent0's nodes, so we can compare it with the first list to see what changed 125 var nodes1 = Child.IterateNodesBreadth() as List<ISymbolicExpressionTreeNode>;124 var nodes1 = Child.IterateNodesBreadth().ToList(); 126 125 127 126 // compare the two nodes lists and check the difference (comparing node references so we avoid false functional identity). … … 130 129 for (i = 0; i != min; ++i) 131 130 if (nodes0[i] != nodes1[i]) break; 132 if (i == min) i = 0;133 134 131 // add heredity information into the global variables 135 132 GlobalTraceMap[Child] = originalParents; // map child to its corresponding parents from the previous generation 136 GlobalFragmentMap[Child] = new GenericWrapper< ISymbolicExpressionTreeNode>(nodes1[i]); // map child to the index of its fragment133 GlobalFragmentMap[Child] = new GenericWrapper<SymbolicExpressionTreeNode>(i == min ? null : (SymbolicExpressionTreeNode)nodes1[i]); // map child to the index of its fragment 137 134 return base.Apply(); 138 135 }
Note: See TracChangeset
for help on using the changeset viewer.