Changeset 7514 for branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Crossovers
- Timestamp:
- 02/24/12 10:58:22 (13 years ago)
- Location:
- branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding
-
Property
svn:ignore
set to
bin
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
/trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding merged eligible /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTree 3219-3222
-
Property
svn:ignore
set to
-
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4
-
Property
svn:ignore
set to
bin
obj
HeuristicLabEncodingsSymbolicExpressionTreeEncodingPlugin.cs
*.user
*.vs10x
Plugin.cs
-
Property
svn:ignore
set to
-
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Crossovers/TracingSymbolicExpressionTreeCrossover.cs
r7479 r7514 27 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 28 29 using TreeCacheType = HeuristicLab.Core.ItemList<HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ISymbolicExpressionTree>; 30 using CloneMapType = HeuristicLab.Core.ItemDictionary<HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ISymbolicExpressionTree, 31 HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ISymbolicExpressionTree>; 32 using TraceMapType = HeuristicLab.Core.ItemDictionary<HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ISymbolicExpressionTree, 33 HeuristicLab.Core.IItemArray<HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ISymbolicExpressionTree>>; 29 using CloneMapType = HeuristicLab.Core.ItemDictionary<HeuristicLab.Core.IItem, HeuristicLab.Core.IItem>; 30 using TraceMapType = HeuristicLab.Core.ItemDictionary<HeuristicLab.Core.IItem, HeuristicLab.Core.IItemList<HeuristicLab.Core.IItem>>; 34 31 35 32 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding { … … 80 77 Parameters.Add(new ScopeTreeLookupParameter<ISymbolicExpressionTree>(ParentsParameterName, "The parent symbolic expression trees which should be crossed.")); 81 78 Parameters.Add(new LookupParameter<ISymbolicExpressionTree>(ChildParameterName, "The child symbolic expression tree resulting from the crossover.")); 82 Parameters.Add(new LookupParameter< ItemDictionary<ISymbolicExpressionTree, ISymbolicExpressionTree>>(GlobalCloneMapParameterName, "A global map keeping track of trees and their clones (made during selection)."));83 Parameters.Add(new LookupParameter< ItemDictionary<ISymbolicExpressionTree, IItemArray<ISymbolicExpressionTree>>>(GlobalTraceMapParameterName, "A global cache containing tracing info."));79 Parameters.Add(new LookupParameter<CloneMapType>(GlobalCloneMapParameterName, "A global map keeping track of trees and their clones (made during selection).")); 80 Parameters.Add(new LookupParameter<TraceMapType>(GlobalTraceMapParameterName, "A global cache containing tracing info.")); 84 81 } 85 82 … … 91 88 var gScope = ExecutionContext.Scope; 92 89 while (gScope.Parent != null) gScope = gScope.Parent; 93 gScope.Variables.Add(new Variable(GlobalTraceMapParameterName, new ItemDictionary<ISymbolicExpressionTree, IItemArray<ISymbolicExpressionTree>>()));90 gScope.Variables.Add(new Variable(GlobalTraceMapParameterName, new TraceMapType())); 94 91 } 95 var originalParents = new ItemArray<ISymbolicExpressionTree>(Parents.Select(x => GlobalCloneMap[x])); 96 // prevent incestuous crossover (an individual mating with itself) 97 if (originalParents[0] == originalParents[1]) { 98 Child = Parents[0]; 99 return base.Apply(); 100 } 92 var originalParents = new ItemList<IItem>(Parents.Select(x => GlobalCloneMap[x])); 101 93 ISymbolicExpressionTree result = Cross(Random, Parents[0], Parents[1]); 102 103 94 Child = result; 104 95 GlobalTraceMap.Add(Child, originalParents);
Note: See TracChangeset
for help on using the changeset viewer.