- Timestamp:
- 06/18/08 16:20:26 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.StructureIdentification/Recombination/SizeFairCrossOver.cs
r238 r324 89 89 90 90 91 int newTreeSize = gardener.GetTreeSize(newTree);92 int newTreeHeight = gardener.GetTreeHeight(newTree);91 int newTreeSize = newTree.Size; 92 int newTreeHeight = newTree.Height; 93 93 child.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("FunctionTree"), newTree)); 94 94 child.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("TreeSize"), new IntData(newTreeSize))); … … 133 133 134 134 // recalculate the size and height of tree1 (the one that we want to insert) because we need to check constraints later on 135 tree1Size = gardener.GetTreeSize(tree1);136 tree1Height = gardener.GetTreeHeight(tree1);135 tree1Size = tree1.Size; 136 tree1Height = tree1.Height; 137 137 138 138 List<int> possibleChildIndices = new List<int>(); … … 143 143 // find the list of allowed indices (regarding allowed sub-trees, maxTreeSize and maxTreeHeight) 144 144 for(int i = 0; i < tree0.SubTrees.Count; i++) { 145 int subTreeSize = gardener.GetTreeSize(tree0.SubTrees[i]);145 int subTreeSize = tree0.SubTrees[i].Size; 146 146 147 147 // the index is ok when the function is allowed as sub-tree and we don't violate the maxSize and maxHeight constraints … … 170 170 // go down in node2: 171 171 tree1 = tree1.SubTrees[random.Next(tree1.SubTrees.Count)]; 172 tree1Size = gardener.GetTreeSize(tree1);173 tree1Height = gardener.GetTreeHeight(tree1);172 tree1Size = tree1.Size; 173 tree1Height = tree1.Height; 174 174 } else { 175 175 // could neither go up or down ... don't know what to do ... give up … … 180 180 possibleChildIndices.Clear(); 181 181 for(int i = 0; i < tree0.SubTrees.Count; i++) { 182 int subTreeSize = gardener.GetTreeSize(tree0.SubTrees[i]);182 int subTreeSize = tree0.SubTrees[i].Size; 183 183 184 184 // when the function is allowed as sub-tree and we don't violate the maxSize and maxHeight constraints
Note: See TracChangeset
for help on using the changeset viewer.