Changeset 2630
 Timestamp:
 01/15/10 18:12:47 (10 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/sources/HeuristicLab.GP.StructureIdentification.Networks/3.2/NetworkToFunctionTransformer.cs
r2627 r2630 87 87 return tree; 88 88 } else if (tree.Function is Flip) { 89 if (tree.SubTrees[0].Function is OpenParameter) return tree.SubTrees[0]; 90 else return InvertChain(ApplyFlips(tree.SubTrees[0])); 89 var partiallyAppliedBranch = ApplyFlips(tree.SubTrees[0]); 90 if (partiallyAppliedBranch.Function is OpenParameter) return partiallyAppliedBranch; 91 else return InvertChain(partiallyAppliedBranch); 91 92 } else { 92 93 List<IFunctionTree> subTrees = new List<IFunctionTree>(tree.SubTrees); … … 210 211 /// <returns></returns> 211 212 private static IFunctionTree TransformExpression(IFunctionTree tree, string targetVariable, IEnumerable<string> parameters) { 213 if (tree.Function is Variable  tree.Function is Constant  tree.Function is Differential) return tree; 212 214 if (tree.Function is Addition  tree.Function is Subtraction  213 215 tree.Function is Multiplication  tree.Function is Division  … … 252 254 combinator.AddSubTree(subTrees[i]); 253 255 } 254 if (subTrees[targetIndex].Function is Variable  subTrees[targetIndex].Function is Constant) return combinator;256 if (subTrees[targetIndex].Function is Variable) return combinator; 255 257 else { 256 IFunctionTree targetChain = InvertF0Chain(subTrees[targetIndex]); 257 AppendLeft(targetChain, combinator); 258 IFunctionTree bottomLeft; 259 IFunctionTree targetChain = InvertF0Chain(subTrees[targetIndex], out bottomLeft); 260 bottomLeft.InsertSubTree(0, combinator); 258 261 return targetChain; 259 262 } … … 264 267 // precondition: left bottom is a variable (the selected target variable) 265 268 // postcondition: the chain is inverted. the target variable is removed 266 private static IFunctionTree InvertF0Chain(IFunctionTree tree ) {269 private static IFunctionTree InvertF0Chain(IFunctionTree tree, out IFunctionTree bottomLeft) { 267 270 List<IFunctionTree> currentChain = IterateChain(tree).ToList(); 268 271 … … 286 289 } 287 290 } 291 bottomLeft = invParent; 288 292 return root; 289 293 }
Note: See TracChangeset
for help on using the changeset viewer.