Changeset 12969 for branches/gteufl/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Crossovers/SubtreeCrossover.cs
- Timestamp:
- 09/25/15 14:39:59 (9 years ago)
- Location:
- branches/gteufl
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gteufl
- Property svn:ignore
-
old new 8 8 FxCopResults.txt 9 9 Google.ProtocolBuffers-0.9.1.dll 10 Google.ProtocolBuffers-2.4.1.473.dll 10 11 HeuristicLab 3.3.5.1.ReSharper.user 11 12 HeuristicLab 3.3.6.0.ReSharper.user 12 13 HeuristicLab.4.5.resharper.user 13 14 HeuristicLab.ExtLibs.6.0.ReSharper.user 15 HeuristicLab.Scripting.Development 14 16 HeuristicLab.resharper.user 15 17 ProtoGen.exe … … 17 19 _ReSharper.HeuristicLab 18 20 _ReSharper.HeuristicLab 3.3 21 _ReSharper.HeuristicLab 3.3 Tests 19 22 _ReSharper.HeuristicLab.ExtLibs 20 23 bin 21 24 protoc.exe 22 _ReSharper.HeuristicLab 3.3 Tests 23 Google.ProtocolBuffers-2.4.1.473.dll 25 obj
-
- Property svn:mergeinfo changed
-
Property
svn:global-ignores
set to
*.nuget
packages
- Property svn:ignore
-
branches/gteufl/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding
- Property svn:mergeinfo changed
-
branches/gteufl/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Crossovers/SubtreeCrossover.cs
r9456 r12969 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 28 28 using HeuristicLab.Parameters; 29 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 using HeuristicLab.Random; 30 31 31 32 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding { … … 134 135 parent0.Root.ForEachNodePostfix((n) => { 135 136 if (n.SubtreeCount > 0 && n != parent0.Root) { 136 foreach (var child in n.Subtrees) { 137 //avoid linq to reduce memory pressure 138 for (int i = 0; i < n.SubtreeCount; i++) { 139 var child = n.GetSubtree(i); 137 140 if (child.GetLength() <= maxBranchLength && 138 141 child.GetDepth() <= maxBranchDepth) { … … 181 184 select branch).ToList(); 182 185 if (allowedInternalBranches.Count > 0) { 183 return allowedInternalBranches.SelectRandom(random); 186 return allowedInternalBranches.SampleRandom(random); 187 184 188 } else { 185 189 // no internal nodes allowed => select leaf nodes … … 187 191 where branch == null || branch.SubtreeCount == 0 188 192 select branch).ToList(); 189 return allowedLeafBranches.S electRandom(random);193 return allowedLeafBranches.SampleRandom(random); 190 194 } 191 195 } else { … … 195 199 select branch).ToList(); 196 200 if (allowedLeafBranches.Count > 0) { 197 return allowedLeafBranches.S electRandom(random);201 return allowedLeafBranches.SampleRandom(random); 198 202 } else { 199 203 allowedInternalBranches = (from branch in branches 200 204 where branch != null && branch.SubtreeCount > 0 201 205 select branch).ToList(); 202 return allowedInternalBranches.SelectRandom(random); 206 return allowedInternalBranches.SampleRandom(random); 207 203 208 } 204 209 }
Note: See TracChangeset
for help on using the changeset viewer.