Changeset 5510 for branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Manipulators
- Timestamp:
- 02/17/11 13:51:04 (14 years ago)
- Location:
- branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Manipulators
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Manipulators/ChangeNodeTypeManipulation.cs
r5499 r5510 41 41 } 42 42 43 protected override void Manipulate(IRandom random, SymbolicExpressionTree symbolicExpressionTree) {43 protected override void Manipulate(IRandom random, ISymbolicExpressionTree symbolicExpressionTree) { 44 44 ChangeNodeType(random, symbolicExpressionTree); 45 45 } 46 46 47 public static void ChangeNodeType(IRandom random, SymbolicExpressionTree symbolicExpressionTree) {47 public static void ChangeNodeType(IRandom random, ISymbolicExpressionTree symbolicExpressionTree) { 48 48 49 49 // select any node as parent (except the root node) -
branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Manipulators/FullTreeShaker.cs
r5499 r5510 54 54 } 55 55 56 protected override void Manipulate(IRandom random, SymbolicExpressionTree tree) {56 protected override void Manipulate(IRandom random, ISymbolicExpressionTree tree) { 57 57 tree.Root.ForEachNodePostfix(node => { 58 58 if (node.HasLocalParameters) { -
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 } -
branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Manipulators/SymbolicExpressionTreeManipulator.cs
r5499 r5510 36 36 37 37 #region Parameter Properties 38 public ILookupParameter< SymbolicExpressionTree> SymbolicExpressionTreeParameter {39 get { return (ILookupParameter< SymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }38 public ILookupParameter<ISymbolicExpressionTree> SymbolicExpressionTreeParameter { 39 get { return (ILookupParameter<ISymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; } 40 40 } 41 41 #endregion 42 42 43 43 #region Properties 44 public SymbolicExpressionTree SymbolicExpressionTree {44 public ISymbolicExpressionTree SymbolicExpressionTree { 45 45 get { return SymbolicExpressionTreeParameter.ActualValue; } 46 46 } … … 52 52 public SymbolicExpressionTreeManipulator() 53 53 : base() { 54 Parameters.Add(new LookupParameter< SymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression tree on which the operator should be applied."));54 Parameters.Add(new LookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression tree on which the operator should be applied.")); 55 55 } 56 56 57 57 public sealed override IOperation Apply() { 58 SymbolicExpressionTree tree = SymbolicExpressionTreeParameter.ActualValue;58 ISymbolicExpressionTree tree = SymbolicExpressionTreeParameter.ActualValue; 59 59 Manipulate(RandomParameter.ActualValue, tree); 60 60 … … 62 62 } 63 63 64 protected abstract void Manipulate(IRandom random, SymbolicExpressionTree symbolicExpressionTree);64 protected abstract void Manipulate(IRandom random, ISymbolicExpressionTree symbolicExpressionTree); 65 65 } 66 66 }
Note: See TracChangeset
for help on using the changeset viewer.