Changeset 23 for trunk/sources/HeuristicLab.StructureIdentification/Manipulation/CutOutNodeManipulation.cs
- Timestamp:
- 02/21/08 11:45:52 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.StructureIdentification/Manipulation/CutOutNodeManipulation.cs
r2 r23 52 52 AddVariableInfo(new VariableInfo("MaxTreeHeight", "The maximal allowed height of the tree", typeof(IntData), VariableKind.In)); 53 53 AddVariableInfo(new VariableInfo("MaxTreeSize", "The maximal allowed size (number of nodes) of the tree", typeof(IntData), VariableKind.In)); 54 AddVariableInfo(new VariableInfo("Balance Trees", "Determines if the trees should be balanced", typeof(BoolData), VariableKind.In));54 AddVariableInfo(new VariableInfo("BalancedTreesRate", "Determines how many trees should be balanced", typeof(DoubleData), VariableKind.In)); 55 55 AddVariableInfo(new VariableInfo("OperatorTree", "The tree to mutate", typeof(IOperator), VariableKind.In)); 56 56 AddVariableInfo(new VariableInfo("TreeSize", "The size (number of nodes) of the tree", typeof(IntData), VariableKind.In)); … … 65 65 int maxTreeHeight = GetVariableValue<IntData>("MaxTreeHeight", scope, true).Data; 66 66 int maxTreeSize = GetVariableValue<IntData>("MaxTreeSize", scope, true).Data; 67 bool balanceTrees = GetVariableValue<BoolData>("BalanceTrees", scope, true).Data;67 double balancedTreesRate = GetVariableValue<DoubleData>("BalancedTreesRate", scope, true).Data; 68 68 69 69 TreeGardener gardener = new TreeGardener(random, library); … … 95 95 } else { 96 96 // create a new random tree 97 IOperator newOperator = gardener.CreateRandomTree(gardener.AllOperators, maxTreeSize, maxTreeHeight, balanceTrees); 97 IOperator newOperator; 98 if(random.NextDouble() <= balancedTreesRate) { 99 newOperator = gardener.CreateRandomTree(gardener.AllOperators, maxTreeSize, maxTreeHeight, true); 100 } else { 101 newOperator = gardener.CreateRandomTree(gardener.AllOperators, maxTreeSize, maxTreeHeight, false); 102 } 98 103 99 104 GetVariableValue<IntData>("TreeSize", scope, true).Data = gardener.GetTreeSize(newOperator);
Note: See TracChangeset
for help on using the changeset viewer.