Changeset 8206 for branches/GP-MoveOperators/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/ReplaceBranchMoveMaker.cs
- Timestamp:
- 07/03/12 16:46:35 (12 years ago)
- Location:
- branches/GP-MoveOperators
- Files:
-
- 1 edited
- 1 moved
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/ReplaceBranchMoveMaker.cs
r8083 r8206 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Data; 25 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 25 26 using HeuristicLab.Operators; 26 27 using HeuristicLab.Optimization; … … 28 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 30 30 namespace HeuristicLab. Encodings.SymbolicExpressionTreeEncoding{31 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression { 31 32 [Item("ReplaceBranchMoveMaker", "")] 32 33 [StorableClass] … … 65 66 public override IOperation Apply() { 66 67 var move = ReplaceBranchMoveParameter.ActualValue; 67 var tree = SymbolicExpressionTreeParameter.ActualValue;68 68 DoubleValue moveQuality = MoveQualityParameter.ActualValue; 69 69 DoubleValue quality = QualityParameter.ActualValue; … … 71 71 var newNode = (ISymbolicExpressionTreeNode)move.NewBranch.Clone(); 72 72 move.Parent.RemoveSubtree(move.SubtreeIndex); 73 move.Parent.InsertSubtree(move.SubtreeIndex, newNode);73 move.Parent.InsertSubtree(move.SubtreeIndex, Scale(newNode, move.Alpha, move.Beta)); 74 74 75 75 quality.Value = moveQuality.Value; … … 77 77 return base.Apply(); 78 78 } 79 80 81 private Addition add = new Addition(); 82 private Multiplication mul = new Multiplication(); 83 private Constant constant = new Constant(); 84 85 private ISymbolicExpressionTreeNode Scale(ISymbolicExpressionTreeNode node, double alpha, double beta) { 86 var constAlpha = (ConstantTreeNode)constant.CreateTreeNode(); 87 var constBeta = (ConstantTreeNode)constant.CreateTreeNode(); 88 constAlpha.Value = alpha; 89 constBeta.Value = beta; 90 var sum = add.CreateTreeNode(); 91 var prod = mul.CreateTreeNode(); 92 prod.AddSubtree(node); prod.AddSubtree(constBeta); 93 sum.AddSubtree(prod); sum.AddSubtree(constAlpha); 94 return sum; 95 } 79 96 } 80 97 }
Note: See TracChangeset
for help on using the changeset viewer.