Changeset 12495 for branches/GBT/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Crossovers/SubtreeCrossover.cs
- Timestamp:
- 06/23/15 12:50:05 (9 years ago)
- Location:
- branches/GBT
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GBT
- Property svn:mergeinfo changed
/trunk/sources merged: 12392-12393,12397-12401,12422,12424,12428-12435,12442-12443,12445,12455-12458,12461,12463-12465,12470-12476,12478-12482,12485,12488,12490-12494 -
Property
svn:global-ignores
set to
*.nuget
packages
- Property svn:mergeinfo changed
-
branches/GBT/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding
- Property svn:mergeinfo changed
-
branches/GBT/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Crossovers/SubtreeCrossover.cs
r12012 r12495 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 { … … 181 182 select branch).ToList(); 182 183 if (allowedInternalBranches.Count > 0) { 183 return allowedInternalBranches.SelectRandom(random); 184 return allowedInternalBranches.SampleRandom(random); 185 184 186 } else { 185 187 // no internal nodes allowed => select leaf nodes … … 187 189 where branch == null || branch.SubtreeCount == 0 188 190 select branch).ToList(); 189 return allowedLeafBranches.S electRandom(random);191 return allowedLeafBranches.SampleRandom(random); 190 192 } 191 193 } else { … … 195 197 select branch).ToList(); 196 198 if (allowedLeafBranches.Count > 0) { 197 return allowedLeafBranches.S electRandom(random);199 return allowedLeafBranches.SampleRandom(random); 198 200 } else { 199 201 allowedInternalBranches = (from branch in branches 200 202 where branch != null && branch.SubtreeCount > 0 201 203 select branch).ToList(); 202 return allowedInternalBranches.SelectRandom(random); 204 return allowedInternalBranches.SampleRandom(random); 205 203 206 } 204 207 }
Note: See TracChangeset
for help on using the changeset viewer.