Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/19/11 13:52:12 (13 years ago)
Author:
mkommend
Message:

#1532:

  • Enabled renaming of symbols
  • Fixed cloning of grammers
  • Added readonly attribute in grammars to lock grammars during the algorithm run
  • Removed useless clone method in cloner
  • Changed CheckedItemCollectionViews to enable scrolling during the locked state
Location:
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionModel.cs

    r5942 r6233  
    2121
    2222using System.Collections.Generic;
     23using System.Linq;
    2324using HeuristicLab.Common;
    2425using HeuristicLab.Core;
     
    9495      } else {
    9596        var mainBranch = startNode.GetSubtree(0);
     97        var product = MakeProduct(mainBranch, beta);
    9698        startNode.RemoveSubtree(0);
    97         var scaledMainBranch = MakeSum(MakeProduct(beta, mainBranch), alpha);
     99        startNode.AddSubtree(product);
     100
     101        var scaledMainBranch = MakeSum(product, alpha);
     102        startNode.RemoveSubtree(0);
    98103        startNode.AddSubtree(scaledMainBranch);
    99104      }
     
    104109        return treeNode;
    105110      } else {
    106         var node = (new Addition()).CreateTreeNode();
     111        var addition = treeNode.Grammar.Symbols.OfType<Addition>().FirstOrDefault();
     112        if (addition == null) addition = new Addition();
     113        var node = addition.CreateTreeNode();
    107114        var alphaConst = MakeConstant(alpha);
    108115        node.AddSubtree(treeNode);
     
    112119    }
    113120
    114     private static ISymbolicExpressionTreeNode MakeProduct(double beta, ISymbolicExpressionTreeNode treeNode) {
     121    private static ISymbolicExpressionTreeNode MakeProduct(ISymbolicExpressionTreeNode treeNode, double beta) {
    115122      if (beta.IsAlmost(1.0)) {
    116123        return treeNode;
    117124      } else {
    118         var node = (new Multiplication()).CreateTreeNode();
     125        var multipliciation = treeNode.Grammar.Symbols.OfType<Multiplication>().FirstOrDefault();
     126        if (multipliciation == null) multipliciation = new Multiplication();
     127        var node = multipliciation.CreateTreeNode();
    119128        var betaConst = MakeConstant(beta);
    120129        node.AddSubtree(treeNode);
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolution.cs

    r5975 r6233  
    7575    }
    7676
    77     private new void RecalculateResults() {
     77    private void RecalculateResults() {
    7878      ModelLength = Model.SymbolicExpressionTree.Length;
    7979      ModelDepth = Model.SymbolicExpressionTree.Depth;
Note: See TracChangeset for help on using the changeset viewer.