Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/03/12 17:36:20 (12 years ago)
Author:
gkronber
Message:

#1847: fixed some bugs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GP-MoveOperators/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/ReplaceBranchMoveEvaluator.cs

    r8206 r8207  
    7878    public override IOperation Apply() {
    7979      var evaluator = EvaluatorParameter.ActualValue;
    80       var move = (ReplaceBranchMove)MoveParameter.ActualValue.Clone();
     80
     81      var move = MoveParameter.ActualValue;
    8182
    8283      // calculate linear scaling
     
    8889      move.Beta = beta;
    8990
    90       move.Parent.RemoveSubtree(move.SubtreeIndex);
    91       move.Parent.InsertSubtree(move.SubtreeIndex, Scale(move.NewBranch, alpha, beta));
     91      // clone tree and parent
     92      var cloner = new Cloner();
     93      var clonedTree = cloner.Clone(move.Tree);
     94      var clonedParent = cloner.Clone(move.Parent);
     95      var clonedBranch = cloner.Clone(move.NewBranch);
     96
     97      clonedParent.RemoveSubtree(move.SubtreeIndex);
     98      clonedParent.InsertSubtree(move.SubtreeIndex, Scale(clonedBranch, alpha, beta));
    9299
    93100      var problemData = ProblemDataParameter.ActualValue;
     
    96103      var fitnessPartition = FitnessCalculationPartitionParameter.ActualValue;
    97104      var rows = Enumerable.Range(fitnessPartition.Start, fitnessPartition.End - fitnessPartition.Start);
    98       var quality = evaluator.Evaluate(childContext, move.Tree, problemData, rows);
     105      var quality = evaluator.Evaluate(childContext, clonedTree, problemData, rows);
    99106
    100107      MoveQualityParameter.ActualValue = new DoubleValue(quality);
Note: See TracChangeset for help on using the changeset viewer.