Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9840


Ignore:
Timestamp:
08/02/13 13:13:34 (11 years ago)
Author:
mkommend
Message:

#2021: Fixed a bug node impact caluclation code and adapted the cloner to include a method to get the matching cloned object given the original one.

Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Common/3.3/Cloner.cs

    r9456 r9840  
    6767    }
    6868
     69    /// <summary>
     70    /// Returns the clone of an deeply cloned item, if it was already cloned.
     71    /// </summary>
     72    /// <param name="original">The original object.</param>
     73    /// <returns>The clone of the given object, if it was already cloned; null otherwise</returns>
     74    public IDeepCloneable GetClone(IDeepCloneable original) {
     75      IDeepCloneable clone = null;
     76      mapping.TryGetValue(original, out clone);
     77      return clone;
     78    }
     79
    6980  }
    7081}
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolutionImpactValuesCalculator.cs

    r9456 r9840  
    4949      var replacementValue = CalculateReplacementValue(regressionModel, node, regressionProblemData, rows);
    5050      var constantNode = new ConstantTreeNode(new Constant()) { Value = replacementValue };
     51
    5152      var cloner = new Cloner();
    52       cloner.RegisterClonedObject(node, constantNode);
    5353      var tempModel = cloner.Clone(regressionModel);
     54      var tempModelNode = (ISymbolicExpressionTreeNode)cloner.GetClone(node);
     55
     56      var tempModelParentNode = tempModelNode.Parent;
     57      int i = tempModelParentNode.IndexOfSubtree(tempModelNode);
     58      tempModelParentNode.RemoveSubtree(i);
     59      tempModelParentNode.InsertSubtree(i, constantNode);
    5460
    5561      var estimatedValues = tempModel.GetEstimatedValues(dataset, rows);
Note: See TracChangeset for help on using the changeset viewer.