Changeset 2202 for branches/GP-Refactoring-713/sources/HeuristicLab.GP/3.3/Manipulation/FullTreeShaker.cs
- Timestamp:
- 07/28/09 19:24:23 (15 years ago)
- Location:
- branches/GP-Refactoring-713
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/GP-Refactoring-713/sources/HeuristicLab.GP/3.3/Manipulation/FullTreeShaker.cs
r706 r2202 33 33 public class FullTreeShaker : DelegatingOperator { 34 34 public override string Description { 35 get { return "Manipulates all tree nodes for which a '" + FunctionBase.MANIPULATION + "' variableis defined."; }35 get { return "Manipulates all tree nodes for which a manipulator is defined."; } 36 36 } 37 37 … … 39 39 : base() { 40 40 AddVariableInfo(new VariableInfo("Random", "A random generator (uniform)", typeof(MersenneTwister), VariableKind.In)); 41 AddVariableInfo(new VariableInfo("OperatorLibrary", "Operator library that defines operator mutations", typeof( GPOperatorLibrary), VariableKind.In));41 AddVariableInfo(new VariableInfo("OperatorLibrary", "Operator library that defines operator mutations", typeof(FunctionLibrary), VariableKind.In)); 42 42 AddVariableInfo(new VariableInfo("ShakingFactor", "Variable that determines the force of the shaking operation", typeof(DoubleData), VariableKind.In)); 43 43 AddVariableInfo(new VariableInfo("FunctionTree", "The function tree that should be mutated", typeof(IFunctionTree), VariableKind.In | VariableKind.Out)); … … 45 45 46 46 public override IOperation Apply(IScope scope) { 47 GPOperatorLibrary library = GetVariableValue<GPOperatorLibrary>("OperatorLibrary", scope, true);47 FunctionLibrary library = GetVariableValue<FunctionLibrary>("OperatorLibrary", scope, true); 48 48 IFunctionTree tree = GetVariableValue<IFunctionTree>("FunctionTree", scope, false); 49 49 MersenneTwister mt = GetVariableValue<MersenneTwister>("Random", scope, true); … … 56 56 57 57 TreeGardener gardener = new TreeGardener(mt, library); 58 var parametricBranches = gardener.GetAllSubTrees(tree).Where(branch => branch. Function.GetVariable(FunctionBase.MANIPULATION)!= null);58 var parametricBranches = gardener.GetAllSubTrees(tree).Where(branch => branch.Manipulator!= null); 59 59 foreach(IFunctionTree subTree in parametricBranches) { 60 IOperator mutation = (IOperator)subTree.Function.GetVariable(FunctionBase.MANIPULATION).Value;60 IOperator mutation = subTree.Manipulator; 61 61 62 62 // store all local variables into a temporary scope
Note: See TracChangeset
for help on using the changeset viewer.