Changeset 8206 for branches/GP-MoveOperators/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/ReplaceBranchMoveEvaluator.cs
- Timestamp:
- 07/03/12 16:46:35 (12 years ago)
- Location:
- branches/GP-MoveOperators
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GP-MoveOperators
- Property svn:mergeinfo changed
/trunk/sources merged: 8084,8088-8090,8092-8100,8102-8113,8115,8117-8132,8134-8146,8148-8156,8158-8160,8163-8170,8173-8176,8178-8190,8192-8205
- Property svn:mergeinfo changed
-
branches/GP-MoveOperators/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/ReplaceBranchMoveEvaluator.cs
r7832 r8206 80 80 var move = (ReplaceBranchMove)MoveParameter.ActualValue.Clone(); 81 81 82 // calculate linear scaling 83 OnlineCalculatorError errorState; 84 double alpha, beta; 85 OnlineLinearScalingParameterCalculator.Calculate(move.NewOutput, move.OriginalOutput, out alpha, out beta, out errorState); 86 87 move.Alpha = alpha; 88 move.Beta = beta; 89 82 90 move.Parent.RemoveSubtree(move.SubtreeIndex); 83 move.Parent.InsertSubtree(move.SubtreeIndex, move.NewBranch);91 move.Parent.InsertSubtree(move.SubtreeIndex, Scale(move.NewBranch, alpha, beta)); 84 92 85 93 var problemData = ProblemDataParameter.ActualValue; … … 94 102 } 95 103 104 private Addition add = new Addition(); 105 private Multiplication mul = new Multiplication(); 106 private Constant constant = new Constant(); 107 108 private ISymbolicExpressionTreeNode Scale(ISymbolicExpressionTreeNode node, double alpha, double beta) { 109 var constAlpha = (ConstantTreeNode)constant.CreateTreeNode(); 110 var constBeta = (ConstantTreeNode)constant.CreateTreeNode(); 111 constAlpha.Value = alpha; 112 constBeta.Value = beta; 113 var sum = add.CreateTreeNode(); 114 var prod = mul.CreateTreeNode(); 115 prod.AddSubtree(node); prod.AddSubtree(constBeta); 116 sum.AddSubtree(prod); sum.AddSubtree(constAlpha); 117 return sum; 118 } 119 96 120 public override IDeepCloneable Clone(Cloner cloner) { 97 121 return new ReplaceBranchMoveEvaluator(this, cloner);
Note: See TracChangeset
for help on using the changeset viewer.