Changeset 12422 for trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Crossovers/SubtreeCrossover.cs
- Timestamp:
- 06/10/15 11:29:34 (9 years ago)
- Location:
- trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding
-
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Crossovers/SubtreeCrossover.cs
r12012 r12422 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.