- Timestamp:
- 06/16/15 12:23:18 (9 years ago)
- Location:
- branches/HeuristicLab.DatasetRefactor/sources
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Crossovers/SubtreeCrossover.cs
r12438 r12453 135 135 parent0.Root.ForEachNodePostfix((n) => { 136 136 if (n.SubtreeCount > 0 && n != parent0.Root) { 137 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); 138 140 if (child.GetLength() <= maxBranchLength && 139 141 child.GetDepth() <= maxBranchDepth) { -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Grammars/SymbolicExpressionGrammarBase.cs
r12438 r12453 338 338 List<string> temp; 339 339 if (allowedChildSymbols.TryGetValue(parent.Name, out temp)) { 340 if (temp.SelectMany(s => GetSymbol(s).Flatten()).Any(s => s.Name == child.Name)) { 341 cachedIsAllowedChildSymbol.Add(key, true); 342 return true; 340 for (int i = 0; i < temp.Count; i++) { 341 var symbol = GetSymbol(temp[i]); 342 foreach (var s in symbol.Flatten()) 343 if (s.Name == child.Name) { 344 cachedIsAllowedChildSymbol.Add(key, true); 345 return true; 346 } 343 347 } 344 348 } … … 365 369 List<string> temp; 366 370 if (allowedChildSymbolsPerIndex.TryGetValue(Tuple.Create(parent.Name, argumentIndex), out temp)) { 367 if (temp.SelectMany(s => GetSymbol(s).Flatten()).Any(s => s.Name == child.Name)) { 368 cachedIsAllowedChildSymbolIndex.Add(key, true); 369 return true; 371 for (int i = 0; i < temp.Count; i++) { 372 var symbol = GetSymbol(temp[i]); 373 foreach (var s in symbol.Flatten()) 374 if (s.Name == child.Name) { 375 cachedIsAllowedChildSymbolIndex.Add(key, true); 376 return true; 377 } 370 378 } 371 379 } -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/SymbolicExpressionTreeNode.cs
r12031 r12453 175 175 176 176 public IEnumerable<ISymbolicExpressionTreeNode> IterateNodesBreadth() { 177 var list = new List<ISymbolicExpressionTreeNode>( ) { this };177 var list = new List<ISymbolicExpressionTreeNode>(GetLength()) { this }; 178 178 int i = 0; 179 179 while (i != list.Count) { … … 193 193 public void ForEachNodePrefix(Action<ISymbolicExpressionTreeNode> a) { 194 194 a(this); 195 if (Subtrees != null) { 196 foreach (var subtree in Subtrees) { 197 subtree.ForEachNodePrefix(a); 195 if (subtrees != null) { 196 //avoid linq to reduce memory pressure 197 for (int i = 0; i < subtrees.Count; i++) { 198 subtrees[i].ForEachNodePrefix(a); 198 199 } 199 200 } … … 207 208 208 209 public void ForEachNodePostfix(Action<ISymbolicExpressionTreeNode> a) { 209 if (Subtrees != null) { 210 foreach (var subtree in Subtrees) { 211 subtree.ForEachNodePostfix(a); 210 if (subtrees != null) { 211 //avoid linq to reduce memory pressure 212 for (int i = 0; i < subtrees.Count; i++) { 213 subtrees[i].ForEachNodePostfix(a); 212 214 } 213 215 } -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/SymbolicExpressionTreeTopLevelNode.cs
r12031 r12453 39 39 protected SymbolicExpressionTreeTopLevelNode(SymbolicExpressionTreeTopLevelNode original, Cloner cloner) 40 40 : base(original, cloner) { 41 // grammar = cloner.Clone(original.Grammar); 42 grammar = original.Grammar; 41 grammar = cloner.Clone(original.Grammar); 43 42 } 44 43 public SymbolicExpressionTreeTopLevelNode() : base() { } -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionSolution.cs
r12031 r12453 60 60 61 61 public override IEnumerable<double> GetEstimatedValues(IEnumerable<int> rows) { 62 var rowsToEvaluate = rows. Except(evaluationCache.Keys);62 var rowsToEvaluate = rows.Where(row => !evaluationCache.ContainsKey(row)); 63 63 var rowsEnumerator = rowsToEvaluate.GetEnumerator(); 64 64 var valuesEnumerator = Model.GetEstimatedValues(ProblemData.Dataset, rowsToEvaluate).GetEnumerator();
Note: See TracChangeset
for help on using the changeset viewer.