Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/17/11 11:51:09 (12 years ago)
Author:
bburlacu
Message:

#1654: Updated Full-, Grow- and RampedHalfAndHalf tree creators so that the Create call has the exact same signature for all of them (including the probabilistic tree creator); adjusted tests. Added CreateTree interface method and tree creator selection mechanism in the Sample Tree View.

Location:
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionGrammarSampleExpressionTreeView.Designer.cs

    r6803 r7012  
    5252      this.maxTreeDepthTextBox = new System.Windows.Forms.TextBox();
    5353      this.generateSampleTreeButton = new System.Windows.Forms.Button();
     54      this.treeCreatorComboBox = new System.Windows.Forms.ComboBox();
     55      this.treeCreatorLabel = new System.Windows.Forms.Label();
    5456      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    5557      this.sampleTreeGroupBox.SuspendLayout();
     
    6971      // sampleTreeGroupBox
    7072      //
    71       this.sampleTreeGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    72             | System.Windows.Forms.AnchorStyles.Left)
    73             | System.Windows.Forms.AnchorStyles.Right)));
     73      this.sampleTreeGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     74                  | System.Windows.Forms.AnchorStyles.Left)
     75                  | System.Windows.Forms.AnchorStyles.Right)));
    7476      this.sampleTreeGroupBox.Controls.Add(this.sampleTreeView);
    75       this.sampleTreeGroupBox.Location = new System.Drawing.Point(3, 107);
     77      this.sampleTreeGroupBox.Location = new System.Drawing.Point(3, 134);
    7678      this.sampleTreeGroupBox.Name = "sampleTreeGroupBox";
    77       this.sampleTreeGroupBox.Size = new System.Drawing.Size(431, 292);
     79      this.sampleTreeGroupBox.Size = new System.Drawing.Size(431, 265);
    7880      this.sampleTreeGroupBox.TabIndex = 3;
    7981      this.sampleTreeGroupBox.TabStop = false;
     
    8991      this.sampleTreeView.Name = "sampleTreeView";
    9092      this.sampleTreeView.ReadOnly = false;
    91       this.sampleTreeView.Size = new System.Drawing.Size(425, 273);
     93      this.sampleTreeView.Size = new System.Drawing.Size(425, 246);
    9294      this.sampleTreeView.TabIndex = 0;
    9395      //
     
    112114      // maxTreeLengthTextBox
    113115      //
    114       this.maxTreeLengthTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    115             | System.Windows.Forms.AnchorStyles.Right)));
     116      this.maxTreeLengthTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     117                  | System.Windows.Forms.AnchorStyles.Right)));
    116118      this.maxTreeLengthTextBox.Location = new System.Drawing.Point(93, 26);
    117119      this.maxTreeLengthTextBox.Name = "maxTreeLengthTextBox";
     
    124126      // maxTreeDepthTextBox
    125127      //
    126       this.maxTreeDepthTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    127             | System.Windows.Forms.AnchorStyles.Right)));
     128      this.maxTreeDepthTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     129                  | System.Windows.Forms.AnchorStyles.Right)));
    128130      this.maxTreeDepthTextBox.Location = new System.Drawing.Point(93, 52);
    129131      this.maxTreeDepthTextBox.Name = "maxTreeDepthTextBox";
     
    136138      // generateSampleTreeButton
    137139      //
    138       this.generateSampleTreeButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    139             | System.Windows.Forms.AnchorStyles.Right)));
    140       this.generateSampleTreeButton.Location = new System.Drawing.Point(3, 78);
     140      this.generateSampleTreeButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     141                  | System.Windows.Forms.AnchorStyles.Right)));
     142      this.generateSampleTreeButton.Location = new System.Drawing.Point(6, 105);
    141143      this.generateSampleTreeButton.Name = "generateSampleTreeButton";
    142144      this.generateSampleTreeButton.Size = new System.Drawing.Size(431, 23);
     
    146148      this.generateSampleTreeButton.Click += new System.EventHandler(this.generateSampleTreeButton_Click);
    147149      //
     150      // treeCreatorComboBox
     151      //
     152      this.treeCreatorComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     153                  | System.Windows.Forms.AnchorStyles.Right)));
     154      this.treeCreatorComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     155      this.treeCreatorComboBox.FormattingEnabled = true;
     156      this.treeCreatorComboBox.Location = new System.Drawing.Point(93, 78);
     157      this.treeCreatorComboBox.Name = "treeCreatorComboBox";
     158      this.treeCreatorComboBox.Size = new System.Drawing.Size(341, 21);
     159      this.treeCreatorComboBox.TabIndex = 9;
     160      this.treeCreatorComboBox.SelectedIndexChanged += new System.EventHandler(this.treeCreatorComboBox_SelectedIndexChanged);
     161      //
     162      // treeCreatorLabel
     163      //
     164      this.treeCreatorLabel.AutoSize = true;
     165      this.treeCreatorLabel.Location = new System.Drawing.Point(3, 81);
     166      this.treeCreatorLabel.Name = "treeCreatorLabel";
     167      this.treeCreatorLabel.Size = new System.Drawing.Size(69, 13);
     168      this.treeCreatorLabel.TabIndex = 10;
     169      this.treeCreatorLabel.Text = "Tree Creator:";
     170      //
    148171      // SymbolicExpressionGrammarSampleExpressionTreeView
    149172      //
    150173      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    151174      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     175      this.Controls.Add(this.treeCreatorLabel);
    152176      this.Controls.Add(this.sampleTreeGroupBox);
    153177      this.Controls.Add(this.maxTreeDepthLabel);
    154178      this.Controls.Add(this.maxTreeLengthTextBox);
     179      this.Controls.Add(this.treeCreatorComboBox);
    155180      this.Controls.Add(this.maxTreeLengthLabel);
    156181      this.Controls.Add(this.maxTreeDepthTextBox);
     
    161186      this.Controls.SetChildIndex(this.maxTreeDepthTextBox, 0);
    162187      this.Controls.SetChildIndex(this.maxTreeLengthLabel, 0);
     188      this.Controls.SetChildIndex(this.treeCreatorComboBox, 0);
    163189      this.Controls.SetChildIndex(this.maxTreeLengthTextBox, 0);
    164190      this.Controls.SetChildIndex(this.maxTreeDepthLabel, 0);
    165191      this.Controls.SetChildIndex(this.sampleTreeGroupBox, 0);
     192      this.Controls.SetChildIndex(this.treeCreatorLabel, 0);
    166193      this.Controls.SetChildIndex(this.nameTextBox, 0);
    167194      this.Controls.SetChildIndex(this.infoLabel, 0);
     
    183210    private System.Windows.Forms.Button generateSampleTreeButton;
    184211    private GraphicalSymbolicExpressionTreeView sampleTreeView;
     212    private System.Windows.Forms.ComboBox treeCreatorComboBox;
     213    private System.Windows.Forms.Label treeCreatorLabel;
    185214  }
    186215}
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionGrammarSampleExpressionTreeView.cs

    r6803 r7012  
    3636    public SymbolicExpressionGrammarSampleExpressionTreeView() {
    3737      InitializeComponent();
    38       random = new MersenneTwister();
     38      random = new MersenneTwister();   
    3939      maxSampleTreeLength = int.Parse(maxTreeLengthTextBox.Text);
    4040      maxSampleTreeDepth = int.Parse(maxTreeDepthTextBox.Text);
     41      foreach (var treeCreator in ApplicationManager.Manager.GetInstances<ISymbolicExpressionTreeCreator>()) {
     42        treeCreatorComboBox.Items.Add(treeCreator);
     43      }
     44      treeCreatorComboBox.SelectedIndex = 0;
    4145    }
    4246
     
    97101    private void UpdateSampleTreeView() {
    98102      try {
    99         ISymbolicExpressionTree tree = ProbabilisticTreeCreator.Create(random, Content, MaxSampleTreeLength, MaxSampleTreeDepth);
     103        ISymbolicExpressionTreeCreator creator = (SymbolicExpressionTreeCreator)treeCreatorComboBox.SelectedItem;
     104        ISymbolicExpressionTree tree = creator.CreateTree(random, Content, MaxSampleTreeLength, MaxSampleTreeDepth);
    100105        foreach (var node in tree.Root.IterateNodesPrefix().OfType<SymbolicExpressionTreeTopLevelNode>())
    101106          node.SetGrammar(null);
     
    147152    }
    148153    #endregion
     154
     155    private void treeCreatorComboBox_SelectedIndexChanged(object sender, EventArgs e) {
     156    }
    149157  }
    150158}
Note: See TracChangeset for help on using the changeset viewer.