Changeset 11332


Ignore:
Timestamp:
09/02/14 15:18:51 (5 years ago)
Author:
mkommend
Message:

#2238: Removed grammar objects from trees used in symbolic data analysissolutions.

Location:
trunk/sources
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationSolution.cs

    r11171 r11332  
    2020#endregion
    2121
     22using System.Linq;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     26using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2527using HeuristicLab.Optimization;
    2628using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    6163    public SymbolicClassificationSolution(ISymbolicClassificationModel model, IClassificationProblemData problemData)
    6264      : base(model, problemData) {
     65      foreach (var node in model.SymbolicExpressionTree.Root.IterateNodesPrefix().OfType<SymbolicExpressionTreeTopLevelNode>())
     66        node.SetGrammar(null);
     67
    6368      Add(new Result(ModelLengthResultName, "Length of the symbolic classification model.", new IntValue()));
    6469      Add(new Result(ModelDepthResultName, "Depth of the symbolic classification model.", new IntValue()));
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicDiscriminantFunctionClassificationSolution.cs

    r11171 r11332  
    2424using HeuristicLab.Core;
    2525using HeuristicLab.Data;
     26using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2627using HeuristicLab.Optimization;
    2728using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    107108    public SymbolicDiscriminantFunctionClassificationSolution(ISymbolicDiscriminantFunctionClassificationModel model, IClassificationProblemData problemData)
    108109      : base(model, problemData) {
     110      foreach (var node in model.SymbolicExpressionTree.Root.IterateNodesPrefix().OfType<SymbolicExpressionTreeTopLevelNode>())
     111        node.SetGrammar(null);
     112
    109113      Add(new Result(ModelLengthResultName, "Length of the symbolic classification model.", new IntValue()));
    110114      Add(new Result(ModelDepthResultName, "Depth of the symbolic classification model.", new IntValue()));
    111 
    112115
    113116      ResultCollection estimationLimitResults = new ResultCollection();
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolution.cs

    r11171 r11332  
    2424using HeuristicLab.Core;
    2525using HeuristicLab.Data;
     26using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2627using HeuristicLab.Optimization;
    2728using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    102103    public SymbolicRegressionSolution(ISymbolicRegressionModel model, IRegressionProblemData problemData)
    103104      : base(model, problemData) {
     105      foreach (var node in model.SymbolicExpressionTree.Root.IterateNodesPrefix().OfType<SymbolicExpressionTreeTopLevelNode>())
     106        node.SetGrammar(null);
     107
    104108      Add(new Result(ModelLengthResultName, "Length of the symbolic regression model.", new IntValue()));
    105109      Add(new Result(ModelDepthResultName, "Depth of the symbolic regression model.", new IntValue()));
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicExpressionTreeChart.cs

    r11171 r11332  
    9191    }
    9292
     93
     94    private static readonly ISymbolicExpressionGrammar grammar = new TypeCoherentExpressionGrammar();
    9395    private void insertNodeToolStripMenuItem_Click(object sender, EventArgs e) {
    9496      if (currSelected == null || currSelected.Content is SymbolicExpressionTreeTerminalNode) return;
     
    9698
    9799      using (var dialog = new InsertNodeDialog()) {
    98         dialog.SetAllowedSymbols(parent.Grammar.Symbols.Where(s => !(s is ProgramRootSymbol || s is StartSymbol || s is Defun || s is GroupSymbol))); // allow everything
     100        dialog.SetAllowedSymbols(grammar.Symbols.Where(s => !(s is ProgramRootSymbol || s is StartSymbol || s is Defun || s is GroupSymbol))); // allow everything
    99101        dialog.ShowDialog(this);
    100102        if (dialog.DialogResult != DialogResult.OK) return;
Note: See TracChangeset for help on using the changeset viewer.