Free cookie consent management tool by TermsFeed Policy Generator

Changeset 18099


Ignore:
Timestamp:
12/01/21 10:43:00 (3 years ago)
Author:
dpiringe
Message:

#3136

  • set the default template to f(_) when loading a new problem data
  • fixed a bug which caused the drawing of uncolored SubFunctionTreeNodes after using the window splitter
  • implemented a method to paint nodes of SubFunctionTreeNode as colored nodes for ISymbolicDataAnalysisModel
Location:
branches/3136_Structural_GP
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs

    r18095 r18099  
    206206          counter: counter);
    207207
    208         if (ConstantOptimizationRowsPercentage.Value != RelativeNumberOfEvaluatedSamplesParameter.ActualValue.Value) {
     208        if (ConstantOptimizationRowsPercentage.Value != RelativeNumberOfEvaluatedSamplesParameter.ActualValue.Value) { //TODO: remove this?
    209209          var evaluationRows = GenerateRowsToEvaluate();
    210210          quality = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(
  • branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/StructuredSymbolicRegressionSingleObjectiveProblem.cs

    r18095 r18099  
    108108        StructureTemplateDescriptionText,
    109109        structureTemplate));
    110      
     110
    111111      Parameters.Add(new ValueParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(
    112112        InterpreterParameterName,
    113113        new SymbolicDataAnalysisExpressionTreeInterpreter()) { Hidden = true });
    114      
     114
    115115      Parameters.Add(new FixedValueParameter<DoubleLimit>(
    116116        EstimationLimitsParameterName,
     
    120120
    121121      this.EvaluatorParameter.Hidden = true;
    122      
     122
    123123      Operators.Add(new SymbolicDataAnalysisVariableFrequencyAnalyzer());
    124124      Operators.Add(new MinAverageMaxSymbolicExpressionTreeLengthAnalyzer());
    125125      Operators.Add(new SymbolicExpressionSymbolFrequencyAnalyzer());
    126126
    127       StructureTemplate.Template = 
     127      StructureTemplate.Template =
    128128        "(" +
    129129          "(210000 / (210000 + h)) * ((sigma_y * t * t) / (wR * Rt * t)) + " +
     
    196196
    197197      return TreeEvaluatorParameter.Value.Evaluate(
    198         ProblemData, 
    199         tree, 
     198        ProblemData,
     199        tree,
    200200        Interpreter,
    201201        ProblemData.TrainingIndices,
    202202        StructureTemplate.ApplyLinearScaling,
    203         EstimationLimits.Lower, 
     203        EstimationLimits.Lower,
    204204        EstimationLimits.Upper);
    205205    }
     
    275275    }
    276276
    277     public void Load(IRegressionProblemData data) => ProblemData = data;
     277    public void Load(IRegressionProblemData data) {
     278      ProblemData = data;
     279      StructureTemplate.Template = "f(_)";
     280    }
    278281  }
    279282}
  • branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/GraphicalSymbolicDataAnalysisModelView.cs

    r17180 r18099  
    2020#endregion
    2121
     22using System.Drawing;
    2223using System.Windows.Forms;
    2324using HeuristicLab.MainForm;
     
    4041    protected override void OnContentChanged() {
    4142      base.OnContentChanged();
    42       symbolicExpressionTreeView.Content = null;
    43       if (Content != null)
    44         symbolicExpressionTreeView.Content = Content.SymbolicExpressionTree;
     43      symbolicExpressionTreeChart.Tree = null;
     44      if (Content != null) {
     45        symbolicExpressionTreeChart.Tree = Content.SymbolicExpressionTree;
     46        RepaintNodes();
     47      }
     48    }
     49
     50    protected void RepaintNodes() {
     51      var tree = symbolicExpressionTreeChart.Tree;
     52      if (tree != null) {
     53        foreach (var n in tree.IterateNodesPrefix()) {
     54          if (n.Symbol is SubFunctionSymbol) {
     55            var visualNode = symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(n);
     56            visualNode.FillColor = Color.LightCyan;
     57            visualNode.LineColor = Color.SlateGray;
     58          }
     59        }
     60        symbolicExpressionTreeChart.RepaintNodes();
     61      }
    4562    }
    4663  }
  • branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/GraphicalSymbolicDataAnalysisModelView.designer.cs

    r17180 r18099  
    1919 */
    2020#endregion
     21
     22using System.Drawing;
    2123
    2224namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
     
    4547    /// </summary>
    4648    private void InitializeComponent() {
    47       this.symbolicExpressionTreeView = new HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.GraphicalSymbolicExpressionTreeView();
     49      this.symbolicExpressionTreeChart = new HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart();
    4850      this.SuspendLayout();
    4951      //
    5052      // expressionTreeView
    5153      //
    52       this.symbolicExpressionTreeView.AllowDrop = true;
    53       this.symbolicExpressionTreeView.Caption = "Graphical SymbolicExpressionTree View";
    54       this.symbolicExpressionTreeView.Content = null;
    55       this.symbolicExpressionTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
    56       this.symbolicExpressionTreeView.Location = new System.Drawing.Point(0, 0);
    57       this.symbolicExpressionTreeView.Name = "expressionTreeView";
    58       this.symbolicExpressionTreeView.ReadOnly = false;
    59       this.symbolicExpressionTreeView.Size = new System.Drawing.Size(352, 413);
    60       this.symbolicExpressionTreeView.TabIndex = 0;
     54      this.symbolicExpressionTreeChart.AllowDrop = true;
     55      this.symbolicExpressionTreeChart.Tree = null;
     56      this.symbolicExpressionTreeChart.TextFont = new System.Drawing.Font(FontFamily.GenericSerif, 8F);
     57      this.symbolicExpressionTreeChart.Dock = System.Windows.Forms.DockStyle.Fill;
     58      this.symbolicExpressionTreeChart.Location = new System.Drawing.Point(0, 0);
     59      this.symbolicExpressionTreeChart.Name = "expressionTreeChart";
     60      this.symbolicExpressionTreeChart.Size = new System.Drawing.Size(352, 413);
     61      this.symbolicExpressionTreeChart.TabIndex = 0;
    6162      //
    6263      // SymbolicExpressionModelView
     
    6566      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    6667      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    67       this.Controls.Add(this.symbolicExpressionTreeView);
     68      this.Controls.Add(this.symbolicExpressionTreeChart);
    6869      this.Name = "SymbolicExpressionModelView";
    6970      this.Size = new System.Drawing.Size(352, 413);
     
    7374
    7475    #endregion
    75     private HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.GraphicalSymbolicExpressionTreeView symbolicExpressionTreeView;
     76    private HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart symbolicExpressionTreeChart;
    7677
    7778  }
  • branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/StructureTemplate/StructureTemplateView.cs

    r18075 r18099  
    1 using System;
     1 using System;
    22using System.Collections.Generic;
    33using System.Drawing;
     
    2727      infoLabel.Text = "";
    2828      this.Resize += StructureTemplateViewResize;
     29      splitContainer.SplitterMoved += SplitContainerSplitterMoved;
    2930      treeChart.SymbolicExpressionTreeNodeClicked += SymbolicExpressionTreeNodeClicked;
    3031     
     32    }
     33
     34    private void SplitContainerSplitterMoved(object sender, EventArgs e) {
     35      PaintTree();
    3136    }
    3237
     
    4853      if (Content == null) return;
    4954      expressionInput.Text = Content.Template;
    50       linearScalingCheckBox.Checked = Content.ApplyLinearScaling;
     55      linearScalingCheckBox.Checked = Content.ApplyLinearScaling; 
    5156      PaintTree();
    5257      infoLabel.Text = "";
Note: See TracChangeset for help on using the changeset viewer.