Changeset 5510 for branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Manipulators/OnePointShaker.cs
- Timestamp:
- 02/17/11 13:51:04 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Manipulators/OnePointShaker.cs
r5499 r5510 26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 27 using HeuristicLab.Parameters; 28 using System.Collections.Generic; 28 29 29 30 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding { … … 54 55 } 55 56 56 protected override void Manipulate(IRandom random, SymbolicExpressionTree tree) { 57 var parametricNodes = from node in tree.IterateNodesPrefix() 58 where node.HasLocalParameters 59 select node; 60 if (parametricNodes.Count() > 0) { 57 protected override void Manipulate(IRandom random, ISymbolicExpressionTree tree) { 58 List<ISymbolicExpressionTreeNode> parametricNodes = new List<ISymbolicExpressionTreeNode>(); 59 tree.Root.ForEachNodePostfix(n => { 60 if (n.HasLocalParameters) parametricNodes.Add(n); 61 }); 62 if (parametricNodes.Count > 0) { 61 63 var selectedPoint = parametricNodes.SelectRandom(random); 62 63 64 selectedPoint.ShakeLocalParameters(random, ShakingFactor.Value); 64 65 }
Note: See TracChangeset
for help on using the changeset viewer.