Changeset 11208 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/SymbolicExpressionTreeNode.cs
- Timestamp:
- 07/18/14 16:39:50 (10 years ago)
- Location:
- branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding
- Property svn:mergeinfo changed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/SymbolicExpressionTreeNode.cs
r9456 r11208 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 132 132 133 133 private static int GetBranchLevel(ISymbolicExpressionTreeNode root, ISymbolicExpressionTreeNode point) { 134 if (point == null || point.Parent == null) 135 return int.MaxValue; 136 134 137 if (root == point) 135 138 return 0; 139 140 if (root == point.Parent) 141 return 1; 142 143 var p = point.Parent; 144 int level = 1; 145 146 while (p != root) { 147 level++; 148 p = p.Parent; 149 150 if (p == null) 151 return int.MaxValue; // root is not an ancestor of point 152 } 153 154 return level; 155 } 156 157 private static int GetBranchLevelOld(ISymbolicExpressionTreeNode root, ISymbolicExpressionTreeNode point) { 136 158 foreach (var subtree in root.Subtrees) { 137 159 int branchLevel = GetBranchLevel(subtree, point);
Note: See TracChangeset
for help on using the changeset viewer.