Changeset 3873 for branches/3.2/sources
- Timestamp:
- 05/31/10 08:31:29 (15 years ago)
- Location:
- branches/3.2/sources
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/sources/HeuristicLab.GP.Interfaces/3.3/IGeneticProgrammingModel.cs
r2222 r3873 28 28 public interface IGeneticProgrammingModel : IItem { 29 29 IFunctionTree FunctionTree { get; set; } 30 int Size { get; set;}31 int Height { get; set;}30 int Size { get; } 31 int Height { get; } 32 32 } 33 33 } -
branches/3.2/sources/HeuristicLab.GP.Operators/3.3/Manipulation/ChangeNodeTypeManipulation.cs
r3823 r3873 93 93 parent.InsertSubTree(selectedChildIndex, newFunctionTree); 94 94 } 95 // update size and height96 gpModel.Size = gpModel.Size - oldChildSize + newChildSize;97 gpModel.Height = gpModel.FunctionTree.GetHeight(); // must recalculate height because we can't know wether the manipulated branch was the deepest branch98 95 // check if whole tree is ok 99 96 Debug.Assert(gardener.IsValidTree(gpModel.FunctionTree)); -
branches/3.2/sources/HeuristicLab.GP.Operators/3.3/Manipulation/CutOutNodeManipulation.cs
r2222 r3873 84 84 parent.InsertSubTree(childIndex, selectedChild); 85 85 Debug.Assert(gardener.IsValidTree(gpModel.FunctionTree)); 86 // recalculate the size and height of our tree87 gpModel.Size = gpModel.FunctionTree.GetSize();88 gpModel.Height = gpModel.FunctionTree.GetHeight();89 86 // don't need to schedule initialization operations 90 87 return null; … … 101 98 parent.InsertSubTree(childIndex, newFunctionTree); 102 99 Debug.Assert(gardener.IsValidTree(gpModel.FunctionTree)); 103 // recalculate size and height104 gpModel.Size = gpModel.FunctionTree.GetSize();105 gpModel.Height = gpModel.FunctionTree.GetHeight();106 100 // schedule an initialization operation for the new function-tree 107 101 return Util.CreateInitializationOperation(TreeGardener.GetAllSubTrees(newFunctionTree), scope); -
branches/3.2/sources/HeuristicLab.GP.Operators/3.3/Manipulation/DeleteSubTreeManipulation.cs
r2222 r3873 65 65 66 66 Debug.Assert(gardener.IsValidTree(gpModel.FunctionTree)); 67 // recalculate size and height68 gpModel.Size = gpModel.FunctionTree.GetSize();69 gpModel.Height = gpModel.FunctionTree.GetHeight();70 67 // root hasn't changed so don't need to update 'FunctionTree' variable 71 68 return null; … … 77 74 parent.InsertSubTree(childIndex, newFunctionTree); 78 75 Debug.Assert(gardener.IsValidTree(gpModel.FunctionTree)); 79 // recalculate size and height80 gpModel.Size = gpModel.FunctionTree.GetSize();81 gpModel.Height = gpModel.FunctionTree.GetHeight();82 76 // return an initialization operation for the newly created tree 83 77 return Util.CreateInitializationOperation(TreeGardener.GetAllSubTrees(newFunctionTree), scope); -
branches/3.2/sources/HeuristicLab.GP.Operators/3.3/Manipulation/SubstituteSubTreeManipulation.cs
r2222 r3873 73 73 74 74 Debug.Assert(gardener.IsValidTree(gpModel.FunctionTree)); 75 // update the values of treeSize and treeHeight76 gpModel.Size = gpModel.FunctionTree.GetSize();77 gpModel.Height = gpModel.FunctionTree.GetHeight();78 75 // the root hasn't changed so we don't need to update 79 76 // return a CompositeOperation that randomly initializes all nodes of the new subtree -
branches/3.2/sources/HeuristicLab.GP/3.3/GeneticProgrammingModel.cs
r2787 r3873 36 36 set { 37 37 functionTree = value; 38 Size = functionTree.GetSize();39 Height = functionTree.GetHeight();40 38 } 41 39 } 42 public int Size { get ; set;}43 public int Height { get ; set;}40 public int Size { get { return functionTree.GetSize(); } } 41 public int Height { get { return functionTree.GetHeight(); } } 44 42 45 43 public GeneticProgrammingModel() … … 99 97 // check if there is data for the tree node that needs to be restored and restore the data if needed 100 98 var dataNode = fNode.SelectSingleNode("Data"); 101 if (dataNode !=null) tree.Populate(dataNode, restoredObjects);99 if (dataNode != null) tree.Populate(dataNode, restoredObjects); 102 100 nodeIndex++; 103 101 for (int i = 0; i < subTrees; i++) {
Note: See TracChangeset
for help on using the changeset viewer.