Changeset 8292 for branches/GP-MoveOperators/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/ReplaceBranchMoveMaker.cs
- Timestamp:
- 07/16/12 09:06:27 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GP-MoveOperators/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/ReplaceBranchMoveMaker.cs
r8214 r8292 48 48 get { return (ILookupParameter<ISymbolicExpressionTree>)Parameters["SymbolicExpressionTree"]; } 49 49 } 50 public ILookupParameter<ItemList<ISymbolicExpressionTree>> FragmentsParameter { 51 get { return (ILookupParameter<ItemList<ISymbolicExpressionTree>>)Parameters["Fragments"]; } 52 } 53 public ILookupParameter<ItemList<DoubleArray>> FragmentOutputsParameter { 54 get { return (ILookupParameter<ItemList<DoubleArray>>)Parameters["FragmentOutputs"]; } 55 } 50 56 51 57 [StorableConstructor] … … 58 64 Parameters.Add(new LookupParameter<DoubleValue>("MoveQuality", "The relative quality of the move.")); 59 65 Parameters.Add(new LookupParameter<ISymbolicExpressionTree>("SymbolicExpressionTree", "The symbolic expression tree on which the move should be applied.")); 66 Parameters.Add(new LookupParameter<ItemList<ISymbolicExpressionTree>>("Fragments")); 67 Parameters.Add(new LookupParameter<ItemList<DoubleArray>>("FragmentOutputs")); 60 68 } 61 69 … … 65 73 66 74 public override IOperation Apply() { 75 var fragments = FragmentsParameter.ActualValue; 76 var fragmentOutputs = FragmentOutputsParameter.ActualValue; 77 67 78 var move = ReplaceBranchMoveParameter.ActualValue; 68 79 DoubleValue moveQuality = MoveQualityParameter.ActualValue; … … 70 81 71 82 var newNode = (ISymbolicExpressionTreeNode)move.NewBranch.Clone(); 83 var oldBranch = move.Parent.GetSubtree(move.SubtreeIndex); 84 72 85 move.Parent.RemoveSubtree(move.SubtreeIndex); 73 86 move.Parent.InsertSubtree(move.SubtreeIndex, Scale(newNode, move.Alpha, move.Beta)); 74 87 88 // move oldBranch into pool 89 var fragmentStart = fragments[move.FragmentIndex].Root.GetSubtree(0); 90 fragmentStart.RemoveSubtree(0); 91 fragmentStart.AddSubtree(oldBranch); 92 fragmentOutputs[move.FragmentIndex] = new DoubleArray(move.NewOutput); 75 93 quality.Value = moveQuality.Value; 76 94 // update solution
Note: See TracChangeset
for help on using the changeset viewer.