Changeset 5529 for branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators
- Timestamp:
- 02/21/11 17:49:23 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/ProbabilisticTreeCreator.cs
r5521 r5529 216 216 int argumentIndex, int maxFunctionDefinitions, int maxFunctionArguments) { 217 217 // determine possible symbols that will lead to the smallest possible tree 218 var possibleSymbols = (from s in parent.G etAllowedSymbols(argumentIndex)218 var possibleSymbols = (from s in parent.Grammar.GetAllowedSymbols(parent.Symbol, argumentIndex) 219 219 group s by parent.Grammar.GetMinExpressionLength(s) into g 220 220 orderby g.Key … … 227 227 parent.InsertSubTree(argumentIndex, tree); 228 228 InitializeNewTreeNode(random, root, tree, maxFunctionDefinitions, maxFunctionArguments); 229 for (int i = 0; i < tree.G etMinSubtreeCount(); i++) {229 for (int i = 0; i < tree.Grammar.GetMinSubtreeCount(tree.Symbol); i++) { 230 230 // insert a dummy sub-tree and add the pending extension to the list 231 231 var dummy = new SymbolicExpressionTreeNode(); … … 285 285 private static int SampleArity(IRandom random, ISymbolicExpressionTreeNode node, int targetSize) { 286 286 // select actualArity randomly with the constraint that the sub-trees in the minimal arity can become large enough 287 int minArity = node.G etMinSubtreeCount();288 int maxArity = node.G etMaxSubtreeCount();287 int minArity = node.Grammar.GetMinSubtreeCount(node.Symbol); 288 int maxArity = node.Grammar.GetMaxSubtreeCount(node.Symbol); 289 289 if (maxArity > targetSize) { 290 290 maxArity = targetSize; … … 294 294 long aggregatedLongestExpressionLength = 0; 295 295 for (int i = 0; i < maxArity; i++) { 296 aggregatedLongestExpressionLength += (from s in node.G etAllowedSymbols(i)296 aggregatedLongestExpressionLength += (from s in node.Grammar.GetAllowedSymbols(node.Symbol, i) 297 297 select node.Grammar.GetMaxExpressionLength(s)).Max(); 298 298 if (aggregatedLongestExpressionLength < targetSize) minArity = i; … … 304 304 long aggregatedShortestExpressionLength = 0; 305 305 for (int i = 0; i < maxArity; i++) { 306 aggregatedShortestExpressionLength += (from s in node.G etAllowedSymbols(i)306 aggregatedShortestExpressionLength += (from s in node.Grammar.GetAllowedSymbols(node.Symbol, i) 307 307 select node.Grammar.GetMinExpressionLength(s)).Min(); 308 308 if (aggregatedShortestExpressionLength > targetSize) {
Note: See TracChangeset
for help on using the changeset viewer.