Changeset 2625 for trunk/sources/HeuristicLab.GP.StructureIdentification.Networks/3.2/NetworkToFunctionTransformer.cs
- Timestamp:
- 01/13/10 19:31:02 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.GP.StructureIdentification.Networks/3.2/NetworkToFunctionTransformer.cs
r2624 r2625 94 94 return tree; 95 95 } else if (tree.Function is Flip) { 96 return InvertChain(tree.SubTrees[0]); 96 if (tree.SubTrees[0].Function is OpenParameter) return tree.SubTrees[0]; 97 else return ApplyFlips(InvertChain(tree.SubTrees[0])); 97 98 } else { 98 99 IFunctionTree tmp = ApplyFlips(tree.SubTrees[0]); … … 134 135 } 135 136 // append open param at the end 136 invParent. AddSubTree(openParam);137 invParent.InsertSubTree(0, openParam); 137 138 return root; 138 139 } … … 194 195 private static IFunctionTree AppendLeft(IFunctionTree tree, IFunctionTree node) { 195 196 IFunctionTree originalTree = tree; 196 while ( tree.SubTrees[0].SubTrees.Count > 0) tree = tree.SubTrees[0];197 while (!IsBottomLeft(tree)) tree = tree.SubTrees[0]; 197 198 tree.InsertSubTree(0, node); 198 199 return originalTree; 200 } 201 202 private static bool IsBottomLeft(IFunctionTree tree) { 203 if(tree.SubTrees.Count==0) return true; 204 else if(tree.SubTrees[0].Function is Variable) return true; 205 else if(tree.SubTrees[0].Function is Constant) return true; 206 else return false; 199 207 } 200 208
Note: See TracChangeset
for help on using the changeset viewer.