Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17573


Ignore:
Timestamp:
05/29/20 12:48:39 (4 years ago)
Author:
pfleck
Message:

#3040 Added first draft for WindowedSymbol.

Location:
branches/3040_VectorBasedGP
Files:
4 edited
6 copied

Legend:

Unmodified
Added
Removed
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj

    r17475 r17573  
    4747    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
    4848    <Prefer32Bit>false</Prefer32Bit>
     49    <LangVersion>latest</LangVersion>
    4950  </PropertyGroup>
    5051  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     
    5758    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
    5859    <Prefer32Bit>false</Prefer32Bit>
     60    <LangVersion>latest</LangVersion>
    5961  </PropertyGroup>
    6062  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
     
    6769    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
    6870    <Prefer32Bit>false</Prefer32Bit>
     71    <LangVersion>latest</LangVersion>
    6972  </PropertyGroup>
    7073  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
     
    7780    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
    7881    <Prefer32Bit>false</Prefer32Bit>
     82    <LangVersion>latest</LangVersion>
    7983  </PropertyGroup>
    8084  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
     
    8791    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
    8892    <Prefer32Bit>false</Prefer32Bit>
     93    <LangVersion>latest</LangVersion>
    8994  </PropertyGroup>
    9095  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
     
    97102    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
    98103    <Prefer32Bit>false</Prefer32Bit>
     104    <LangVersion>latest</LangVersion>
    99105  </PropertyGroup>
    100106  <ItemGroup>
     
    128134    </Compile>
    129135    <Compile Include="Plugin.cs" />
     136    <Compile Include="Symbols\WindowedSymbolView.cs">
     137      <SubType>UserControl</SubType>
     138    </Compile>
     139    <Compile Include="Symbols\WindowedSymbolView.Designer.cs">
     140      <DependentUpon>WindowedSymbolView.cs</DependentUpon>
     141    </Compile>
    130142    <Compile Include="TextualSymbolicDataAnalysisModelView.cs">
    131143      <SubType>UserControl</SubType>
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/WindowedSymbolView.Designer.cs

    r17551 r17573  
    2121
    2222namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
    23   partial class ConstantView {
     23  partial class WindowedSymbolView {
    2424    /// <summary>
    2525    /// Required designer variable.
     
    4545    /// </summary>
    4646    private void InitializeComponent() {
    47       this.weightNuLabel = new System.Windows.Forms.Label();
    48       this.minValueTextBox = new System.Windows.Forms.TextBox();
     47      this.initOffsetLabel = new System.Windows.Forms.Label();
     48      this.initOffsetSigTextBox = new System.Windows.Forms.TextBox();
    4949      this.initializationGroupBox = new System.Windows.Forms.GroupBox();
    50       this.weightSigmaLabel = new System.Windows.Forms.Label();
    51       this.maxValueTextBox = new System.Windows.Forms.TextBox();
     50      this.initLengthMuTextBox = new System.Windows.Forms.TextBox();
     51      this.initOffsetMuTextBox = new System.Windows.Forms.TextBox();
     52      this.initLengthLabel = new System.Windows.Forms.Label();
     53      this.initLengthSigTextBox = new System.Windows.Forms.TextBox();
    5254      this.mutationGroupBox = new System.Windows.Forms.GroupBox();
    53       this.multiplicativeChangeLabel = new System.Windows.Forms.Label();
    54       this.multiplicativeChangeSigmaTextBox = new System.Windows.Forms.TextBox();
    55       this.additiveChangeLabel = new System.Windows.Forms.Label();
    56       this.additiveChangeSigmaTextBox = new System.Windows.Forms.TextBox();
     55      this.mutLengthMuTextBox = new System.Windows.Forms.TextBox();
     56      this.mutOffsetMuTextBox = new System.Windows.Forms.TextBox();
     57      this.mutLengthLabel = new System.Windows.Forms.Label();
     58      this.mutLengthSigTextBox = new System.Windows.Forms.TextBox();
     59      this.mutOffsetLabel = new System.Windows.Forms.Label();
     60      this.mutOffsetSigTextBox = new System.Windows.Forms.TextBox();
     61      this.enableWindowedCheckBox = new System.Windows.Forms.CheckBox();
    5762      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    5863      this.initializationGroupBox.SuspendLayout();
     
    6772      //
    6873      this.errorProvider.SetIconAlignment(this.initialFrequencyTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    69       this.initialFrequencyTextBox.Size = new System.Drawing.Size(280, 20);
     74      this.initialFrequencyTextBox.Size = new System.Drawing.Size(280, 26);
     75      //
     76      // minimumArityLabel
     77      //
     78      this.toolTip.SetToolTip(this.minimumArityLabel, "The minimum arity of the symbol");
     79      //
     80      // maximumArityLabel
     81      //
     82      this.toolTip.SetToolTip(this.maximumArityLabel, "The maximum arity of the symbol");
    7083      //
    7184      // minimumArityTextBox
    7285      //
    7386      this.errorProvider.SetIconAlignment(this.minimumArityTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    74       this.minimumArityTextBox.Size = new System.Drawing.Size(280, 20);
     87      this.minimumArityTextBox.Size = new System.Drawing.Size(280, 26);
    7588      //
    7689      // maximumArityTextBox
    7790      //
    7891      this.errorProvider.SetIconAlignment(this.maximumArityTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    79       this.maximumArityTextBox.Size = new System.Drawing.Size(280, 20);
     92      this.maximumArityTextBox.Size = new System.Drawing.Size(280, 26);
    8093      //
    8194      // nameTextBox
     
    8396      this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    8497      this.errorProvider.SetIconPadding(this.nameTextBox, 2);
    85       this.nameTextBox.Size = new System.Drawing.Size(280, 20);
     98      this.nameTextBox.Size = new System.Drawing.Size(280, 26);
    8699      //
    87100      // infoLabel
     
    89102      this.infoLabel.Location = new System.Drawing.Point(379, 3);
    90103      //
    91       // weightNuLabel
    92       //
    93       this.weightNuLabel.AutoSize = true;
    94       this.weightNuLabel.Location = new System.Drawing.Point(6, 22);
    95       this.weightNuLabel.Name = "weightNuLabel";
    96       this.weightNuLabel.Size = new System.Drawing.Size(56, 13);
    97       this.weightNuLabel.TabIndex = 0;
    98       this.weightNuLabel.Text = "Min value:";
    99       this.toolTip.SetToolTip(this.weightNuLabel, "The minimal value to use for random initialization of constants.");
    100       //
    101       // minValueTextBox
    102       //
    103       this.minValueTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     104      // initOffsetLabel
     105      //
     106      this.initOffsetLabel.AutoSize = true;
     107      this.initOffsetLabel.Location = new System.Drawing.Point(6, 22);
     108      this.initOffsetLabel.Name = "initOffsetLabel";
     109      this.initOffsetLabel.Size = new System.Drawing.Size(121, 20);
     110      this.initOffsetLabel.TabIndex = 0;
     111      this.initOffsetLabel.Text = "Offset (mu, sig):";
     112      this.toolTip.SetToolTip(this.initOffsetLabel, "The minimal value to use for random initialization of constants.");
     113      //
     114      // initOffsetSigTextBox
     115      //
     116      this.errorProvider.SetIconAlignment(this.initOffsetSigTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
     117      this.initOffsetSigTextBox.Location = new System.Drawing.Point(268, 19);
     118      this.initOffsetSigTextBox.Name = "initOffsetSigTextBox";
     119      this.initOffsetSigTextBox.Size = new System.Drawing.Size(124, 26);
     120      this.initOffsetSigTextBox.TabIndex = 1;
     121      this.toolTip.SetToolTip(this.initOffsetSigTextBox, "The minimal value to use for random initialization of constants.");
     122      this.initOffsetSigTextBox.TextChanged += new System.EventHandler(this.initOffsetSigTextBox_TextChanged);
     123      //
     124      // initializationGroupBox
     125      //
     126      this.initializationGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    104127            | System.Windows.Forms.AnchorStyles.Right)));
    105       this.errorProvider.SetIconAlignment(this.minValueTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    106       this.minValueTextBox.Location = new System.Drawing.Point(92, 19);
    107       this.minValueTextBox.Name = "minValueTextBox";
    108       this.minValueTextBox.Size = new System.Drawing.Size(300, 20);
    109       this.minValueTextBox.TabIndex = 1;
    110       this.toolTip.SetToolTip(this.minValueTextBox, "The minimal value to use for random initialization of constants.");
    111       this.minValueTextBox.TextChanged += new System.EventHandler(this.minValueTextBox_TextChanged);
    112       //
    113       // initializationGroupBox
    114       //
    115       this.initializationGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    116             | System.Windows.Forms.AnchorStyles.Right)));
    117       this.initializationGroupBox.Controls.Add(this.weightSigmaLabel);
    118       this.initializationGroupBox.Controls.Add(this.maxValueTextBox);
    119       this.initializationGroupBox.Controls.Add(this.weightNuLabel);
    120       this.initializationGroupBox.Controls.Add(this.minValueTextBox);
    121       this.initializationGroupBox.Location = new System.Drawing.Point(0, 127);
     128      this.initializationGroupBox.Controls.Add(this.initLengthMuTextBox);
     129      this.initializationGroupBox.Controls.Add(this.initOffsetMuTextBox);
     130      this.initializationGroupBox.Controls.Add(this.initLengthLabel);
     131      this.initializationGroupBox.Controls.Add(this.initLengthSigTextBox);
     132      this.initializationGroupBox.Controls.Add(this.initOffsetLabel);
     133      this.initializationGroupBox.Controls.Add(this.initOffsetSigTextBox);
     134      this.initializationGroupBox.Location = new System.Drawing.Point(0, 164);
    122135      this.initializationGroupBox.Name = "initializationGroupBox";
    123       this.initializationGroupBox.Size = new System.Drawing.Size(398, 73);
     136      this.initializationGroupBox.Size = new System.Drawing.Size(398, 84);
    124137      this.initializationGroupBox.TabIndex = 5;
    125138      this.initializationGroupBox.TabStop = false;
    126139      this.initializationGroupBox.Text = "Initialization";
    127140      //
    128       // weightSigmaLabel
    129       //
    130       this.weightSigmaLabel.AutoSize = true;
    131       this.weightSigmaLabel.Location = new System.Drawing.Point(6, 48);
    132       this.weightSigmaLabel.Name = "weightSigmaLabel";
    133       this.weightSigmaLabel.Size = new System.Drawing.Size(59, 13);
    134       this.weightSigmaLabel.TabIndex = 2;
    135       this.weightSigmaLabel.Text = "Max value:";
    136       this.toolTip.SetToolTip(this.weightSigmaLabel, "The maximal value to use for random initialization of constants.");
    137       //
    138       // maxValueTextBox
    139       //
    140       this.maxValueTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     141      // initLengthMuTextBox
     142      //
     143      this.errorProvider.SetIconAlignment(this.initLengthMuTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
     144      this.initLengthMuTextBox.Location = new System.Drawing.Point(138, 45);
     145      this.initLengthMuTextBox.Name = "initLengthMuTextBox";
     146      this.initLengthMuTextBox.Size = new System.Drawing.Size(124, 26);
     147      this.initLengthMuTextBox.TabIndex = 5;
     148      this.toolTip.SetToolTip(this.initLengthMuTextBox, "The maximal value to use for random initialization of constants.");
     149      this.initLengthMuTextBox.TextChanged += new System.EventHandler(this.initLengthMuTextBox_TextChanged);
     150      //
     151      // initOffsetMuTextBox
     152      //
     153      this.errorProvider.SetIconAlignment(this.initOffsetMuTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
     154      this.initOffsetMuTextBox.Location = new System.Drawing.Point(138, 19);
     155      this.initOffsetMuTextBox.Name = "initOffsetMuTextBox";
     156      this.initOffsetMuTextBox.Size = new System.Drawing.Size(124, 26);
     157      this.initOffsetMuTextBox.TabIndex = 4;
     158      this.toolTip.SetToolTip(this.initOffsetMuTextBox, "The minimal value to use for random initialization of constants.");
     159      this.initOffsetMuTextBox.TextChanged += new System.EventHandler(this.initOffsetMuTextBox_TextChanged);
     160      //
     161      // initLengthLabel
     162      //
     163      this.initLengthLabel.AutoSize = true;
     164      this.initLengthLabel.Location = new System.Drawing.Point(6, 48);
     165      this.initLengthLabel.Name = "initLengthLabel";
     166      this.initLengthLabel.Size = new System.Drawing.Size(127, 20);
     167      this.initLengthLabel.TabIndex = 2;
     168      this.initLengthLabel.Text = "Length (mu, sig):";
     169      this.toolTip.SetToolTip(this.initLengthLabel, "The maximal value to use for random initialization of constants.");
     170      //
     171      // initLengthSigTextBox
     172      //
     173      this.errorProvider.SetIconAlignment(this.initLengthSigTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
     174      this.initLengthSigTextBox.Location = new System.Drawing.Point(268, 45);
     175      this.initLengthSigTextBox.Name = "initLengthSigTextBox";
     176      this.initLengthSigTextBox.Size = new System.Drawing.Size(124, 26);
     177      this.initLengthSigTextBox.TabIndex = 3;
     178      this.toolTip.SetToolTip(this.initLengthSigTextBox, "The maximal value to use for random initialization of constants.");
     179      this.initLengthSigTextBox.TextChanged += new System.EventHandler(this.initLengthSigTextBox_TextChanged);
     180      //
     181      // mutationGroupBox
     182      //
     183      this.mutationGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    141184            | System.Windows.Forms.AnchorStyles.Right)));
    142       this.errorProvider.SetIconAlignment(this.maxValueTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    143       this.maxValueTextBox.Location = new System.Drawing.Point(92, 45);
    144       this.maxValueTextBox.Name = "maxValueTextBox";
    145       this.maxValueTextBox.Size = new System.Drawing.Size(300, 20);
    146       this.maxValueTextBox.TabIndex = 3;
    147       this.toolTip.SetToolTip(this.maxValueTextBox, "The maximal value to use for random initialization of constants.");
    148       this.maxValueTextBox.TextChanged += new System.EventHandler(this.maxValueTextBox_TextChanged);
    149       //
    150       // mutationGroupBox
    151       //
    152       this.mutationGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    153             | System.Windows.Forms.AnchorStyles.Right)));
    154       this.mutationGroupBox.Controls.Add(this.multiplicativeChangeLabel);
    155       this.mutationGroupBox.Controls.Add(this.multiplicativeChangeSigmaTextBox);
    156       this.mutationGroupBox.Controls.Add(this.additiveChangeLabel);
    157       this.mutationGroupBox.Controls.Add(this.additiveChangeSigmaTextBox);
    158       this.mutationGroupBox.Location = new System.Drawing.Point(0, 206);
     185      this.mutationGroupBox.Controls.Add(this.mutLengthMuTextBox);
     186      this.mutationGroupBox.Controls.Add(this.mutOffsetMuTextBox);
     187      this.mutationGroupBox.Controls.Add(this.mutLengthLabel);
     188      this.mutationGroupBox.Controls.Add(this.mutLengthSigTextBox);
     189      this.mutationGroupBox.Controls.Add(this.mutOffsetLabel);
     190      this.mutationGroupBox.Controls.Add(this.mutOffsetSigTextBox);
     191      this.mutationGroupBox.Location = new System.Drawing.Point(0, 254);
    159192      this.mutationGroupBox.Name = "mutationGroupBox";
    160       this.mutationGroupBox.Size = new System.Drawing.Size(398, 73);
     193      this.mutationGroupBox.Size = new System.Drawing.Size(398, 82);
    161194      this.mutationGroupBox.TabIndex = 6;
    162195      this.mutationGroupBox.TabStop = false;
    163196      this.mutationGroupBox.Text = "Mutation";
    164197      //
    165       // multiplicativeChangeLabel
    166       //
    167       this.multiplicativeChangeLabel.AutoSize = true;
    168       this.multiplicativeChangeLabel.Location = new System.Drawing.Point(6, 48);
    169       this.multiplicativeChangeLabel.Name = "multiplicativeChangeLabel";
    170       this.multiplicativeChangeLabel.Size = new System.Drawing.Size(146, 13);
    171       this.multiplicativeChangeLabel.TabIndex = 2;
    172       this.multiplicativeChangeLabel.Text = "Multiplicative change (sigma):";
    173       this.toolTip.SetToolTip(this.multiplicativeChangeLabel, "The sigma (std. dev.) parameter for the normal distribution to use to sample the " +
     198      // mutLengthMuTextBox
     199      //
     200      this.errorProvider.SetIconAlignment(this.mutLengthMuTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
     201      this.mutLengthMuTextBox.Location = new System.Drawing.Point(138, 45);
     202      this.mutLengthMuTextBox.Name = "mutLengthMuTextBox";
     203      this.mutLengthMuTextBox.Size = new System.Drawing.Size(124, 26);
     204      this.mutLengthMuTextBox.TabIndex = 5;
     205      this.toolTip.SetToolTip(this.mutLengthMuTextBox, "The sigma (std. dev.) parameter for the normal distribution to use to sample a mu" +
     206        "ltiplicative change.");
     207      this.mutLengthMuTextBox.TextChanged += new System.EventHandler(this.mutLengthMuTextBox_TextChanged);
     208      //
     209      // mutOffsetMuTextBox
     210      //
     211      this.errorProvider.SetIconAlignment(this.mutOffsetMuTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
     212      this.mutOffsetMuTextBox.Location = new System.Drawing.Point(138, 19);
     213      this.mutOffsetMuTextBox.Name = "mutOffsetMuTextBox";
     214      this.mutOffsetMuTextBox.Size = new System.Drawing.Size(124, 26);
     215      this.mutOffsetMuTextBox.TabIndex = 4;
     216      this.toolTip.SetToolTip(this.mutOffsetMuTextBox, "The sigma (std. dev.) parameter for the normal distribution to use to sample an a" +
     217        "dditive change.");
     218      this.mutOffsetMuTextBox.TextChanged += new System.EventHandler(this.mutOffsetMuTextBox_TextChanged);
     219      //
     220      // mutLengthLabel
     221      //
     222      this.mutLengthLabel.AutoSize = true;
     223      this.mutLengthLabel.Location = new System.Drawing.Point(6, 48);
     224      this.mutLengthLabel.Name = "mutLengthLabel";
     225      this.mutLengthLabel.Size = new System.Drawing.Size(127, 20);
     226      this.mutLengthLabel.TabIndex = 2;
     227      this.mutLengthLabel.Text = "Length (mu, sig):";
     228      this.toolTip.SetToolTip(this.mutLengthLabel, "The sigma (std. dev.) parameter for the normal distribution to use to sample the " +
    174229        "multiplicative change.");
    175230      //
    176       // multiplicativeChangeSigmaTextBox
    177       //
    178       this.multiplicativeChangeSigmaTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    179             | System.Windows.Forms.AnchorStyles.Right)));
    180       this.errorProvider.SetIconAlignment(this.multiplicativeChangeSigmaTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    181       this.multiplicativeChangeSigmaTextBox.Location = new System.Drawing.Point(168, 45);
    182       this.multiplicativeChangeSigmaTextBox.Name = "multiplicativeChangeSigmaTextBox";
    183       this.multiplicativeChangeSigmaTextBox.Size = new System.Drawing.Size(224, 20);
    184       this.multiplicativeChangeSigmaTextBox.TabIndex = 3;
    185       this.toolTip.SetToolTip(this.multiplicativeChangeSigmaTextBox, "The sigma (std. dev.) parameter for the normal distribution to use to sample a mu" +
     231      // mutLengthSigTextBox
     232      //
     233      this.errorProvider.SetIconAlignment(this.mutLengthSigTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
     234      this.mutLengthSigTextBox.Location = new System.Drawing.Point(268, 45);
     235      this.mutLengthSigTextBox.Name = "mutLengthSigTextBox";
     236      this.mutLengthSigTextBox.Size = new System.Drawing.Size(124, 26);
     237      this.mutLengthSigTextBox.TabIndex = 3;
     238      this.toolTip.SetToolTip(this.mutLengthSigTextBox, "The sigma (std. dev.) parameter for the normal distribution to use to sample a mu" +
    186239        "ltiplicative change.");
    187       this.multiplicativeChangeSigmaTextBox.TextChanged += new System.EventHandler(this.multiplicativeChangeSigmaTextBox_TextChanged);
    188       //
    189       // additiveChangeLabel
    190       //
    191       this.additiveChangeLabel.AutoSize = true;
    192       this.additiveChangeLabel.Location = new System.Drawing.Point(6, 22);
    193       this.additiveChangeLabel.Name = "additiveChangeLabel";
    194       this.additiveChangeLabel.Size = new System.Drawing.Size(123, 13);
    195       this.additiveChangeLabel.TabIndex = 0;
    196       this.additiveChangeLabel.Text = "Additive change (sigma):";
    197       this.toolTip.SetToolTip(this.additiveChangeLabel, "The sigma (std. dev.) parameter for the normal distribution to sample the additiv" +
     240      this.mutLengthSigTextBox.TextChanged += new System.EventHandler(this.mutLengthSigTextBox_TextChanged);
     241      //
     242      // mutOffsetLabel
     243      //
     244      this.mutOffsetLabel.AutoSize = true;
     245      this.mutOffsetLabel.Location = new System.Drawing.Point(6, 22);
     246      this.mutOffsetLabel.Name = "mutOffsetLabel";
     247      this.mutOffsetLabel.Size = new System.Drawing.Size(121, 20);
     248      this.mutOffsetLabel.TabIndex = 0;
     249      this.mutOffsetLabel.Text = "Offset (mu, sig):";
     250      this.toolTip.SetToolTip(this.mutOffsetLabel, "The sigma (std. dev.) parameter for the normal distribution to sample the additiv" +
    198251        "e change.");
    199252      //
    200       // additiveChangeSigmaTextBox
    201       //
    202       this.additiveChangeSigmaTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    203             | System.Windows.Forms.AnchorStyles.Right)));
    204       this.errorProvider.SetIconAlignment(this.additiveChangeSigmaTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    205       this.additiveChangeSigmaTextBox.Location = new System.Drawing.Point(168, 19);
    206       this.additiveChangeSigmaTextBox.Name = "additiveChangeSigmaTextBox";
    207       this.additiveChangeSigmaTextBox.Size = new System.Drawing.Size(224, 20);
    208       this.additiveChangeSigmaTextBox.TabIndex = 1;
    209       this.toolTip.SetToolTip(this.additiveChangeSigmaTextBox, "The sigma (std. dev.) parameter for the normal distribution to use to sample an a" +
     253      // mutOffsetSigTextBox
     254      //
     255      this.errorProvider.SetIconAlignment(this.mutOffsetSigTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
     256      this.mutOffsetSigTextBox.Location = new System.Drawing.Point(268, 19);
     257      this.mutOffsetSigTextBox.Name = "mutOffsetSigTextBox";
     258      this.mutOffsetSigTextBox.Size = new System.Drawing.Size(124, 26);
     259      this.mutOffsetSigTextBox.TabIndex = 1;
     260      this.toolTip.SetToolTip(this.mutOffsetSigTextBox, "The sigma (std. dev.) parameter for the normal distribution to use to sample an a" +
    210261        "dditive change.");
    211       this.additiveChangeSigmaTextBox.TextChanged += new System.EventHandler(this.additiveChangeSigmaTextBox_TextChanged);
    212       //
    213       // ConstantView
    214       //
    215       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     262      this.mutOffsetSigTextBox.TextChanged += new System.EventHandler(this.mutOffsetSigTextBox_TextChanged);
     263      //
     264      // enableWindowedCheckBox
     265      //
     266      this.enableWindowedCheckBox.AutoSize = true;
     267      this.enableWindowedCheckBox.Location = new System.Drawing.Point(3, 134);
     268      this.enableWindowedCheckBox.Name = "enableWindowedCheckBox";
     269      this.enableWindowedCheckBox.Size = new System.Drawing.Size(175, 24);
     270      this.enableWindowedCheckBox.TabIndex = 10;
     271      this.enableWindowedCheckBox.Text = "Windowing Enabled";
     272      this.enableWindowedCheckBox.UseVisualStyleBackColor = true;
     273      this.enableWindowedCheckBox.CheckedChanged += new System.EventHandler(this.enableWindowedCheckBox_CheckedChanged);
     274      //
     275      // WindowedSymbolView
     276      //
    216277      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
     278      this.Controls.Add(this.enableWindowedCheckBox);
    217279      this.Controls.Add(this.mutationGroupBox);
    218280      this.Controls.Add(this.initializationGroupBox);
    219       this.Name = "ConstantView";
    220       this.Size = new System.Drawing.Size(398, 284);
     281      this.Name = "WindowedSymbolView";
     282      this.Size = new System.Drawing.Size(398, 340);
     283      this.Controls.SetChildIndex(this.enabledCheckBox, 0);
    221284      this.Controls.SetChildIndex(this.maximumArityLabel, 0);
    222285      this.Controls.SetChildIndex(this.maximumArityTextBox, 0);
     
    230293      this.Controls.SetChildIndex(this.nameTextBox, 0);
    231294      this.Controls.SetChildIndex(this.mutationGroupBox, 0);
     295      this.Controls.SetChildIndex(this.enableWindowedCheckBox, 0);
    232296      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    233297      this.initializationGroupBox.ResumeLayout(false);
     
    242306    #endregion
    243307
    244     private System.Windows.Forms.Label weightNuLabel;
    245     private System.Windows.Forms.TextBox minValueTextBox;
     308    private System.Windows.Forms.Label initOffsetLabel;
     309    private System.Windows.Forms.TextBox initOffsetSigTextBox;
    246310    protected System.Windows.Forms.GroupBox initializationGroupBox;
    247     private System.Windows.Forms.Label weightSigmaLabel;
    248     private System.Windows.Forms.TextBox maxValueTextBox;
     311    private System.Windows.Forms.Label initLengthLabel;
     312    private System.Windows.Forms.TextBox initLengthSigTextBox;
    249313    protected System.Windows.Forms.GroupBox mutationGroupBox;
    250     private System.Windows.Forms.Label multiplicativeChangeLabel;
    251     private System.Windows.Forms.TextBox multiplicativeChangeSigmaTextBox;
    252     private System.Windows.Forms.Label additiveChangeLabel;
    253     private System.Windows.Forms.TextBox additiveChangeSigmaTextBox;
    254 
     314    private System.Windows.Forms.Label mutLengthLabel;
     315    private System.Windows.Forms.TextBox mutLengthSigTextBox;
     316    private System.Windows.Forms.Label mutOffsetLabel;
     317    private System.Windows.Forms.TextBox mutOffsetSigTextBox;
     318    private System.Windows.Forms.TextBox initLengthMuTextBox;
     319    private System.Windows.Forms.TextBox initOffsetMuTextBox;
     320    private System.Windows.Forms.TextBox mutLengthMuTextBox;
     321    private System.Windows.Forms.TextBox mutOffsetMuTextBox;
     322    private System.Windows.Forms.CheckBox enableWindowedCheckBox;
    255323  }
    256324}
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/WindowedSymbolView.cs

    r17551 r17573  
    2727
    2828namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
    29   [View("Constant View")]
    30   [Content(typeof(Constant), true)]
    31   public partial class ConstantView : SymbolView {
    32     public new Constant Content {
    33       get { return (Constant)base.Content; }
     29  [View("WindowedSymbol View")]
     30  [Content(typeof(WindowedSymbol), true)]
     31  public partial class WindowedSymbolView : SymbolView {
     32    public new WindowedSymbol Content {
     33      get { return (WindowedSymbol)base.Content; }
    3434      set { base.Content = value; }
    3535    }
    3636
    37     public ConstantView() {
     37    public WindowedSymbolView() {
    3838      InitializeComponent();
    3939    }
     
    5656    protected override void SetEnabledStateOfControls() {
    5757      base.SetEnabledStateOfControls();
    58       minValueTextBox.Enabled = Content != null;
    59       minValueTextBox.ReadOnly = ReadOnly;
    60       maxValueTextBox.Enabled = Content != null;
    61       maxValueTextBox.ReadOnly = ReadOnly;
    62       additiveChangeSigmaTextBox.Enabled = Content != null;
    63       additiveChangeSigmaTextBox.ReadOnly = ReadOnly;
    64       multiplicativeChangeSigmaTextBox.Enabled = Content != null;
    65       multiplicativeChangeSigmaTextBox.ReadOnly = ReadOnly;
     58
     59      initializationGroupBox.Enabled = Content != null && Content.EnableWindowing;
     60      mutationGroupBox.Enabled = Content != null && Content.EnableWindowing;
     61
     62      initOffsetMuTextBox.ReadOnly = ReadOnly;
     63      initOffsetSigTextBox.ReadOnly = ReadOnly;
     64      initLengthMuTextBox.ReadOnly = ReadOnly;
     65      initLengthSigTextBox.ReadOnly = ReadOnly;
     66      mutOffsetMuTextBox.ReadOnly = ReadOnly;
     67      mutOffsetSigTextBox.ReadOnly = ReadOnly;
     68      mutLengthMuTextBox.ReadOnly = ReadOnly;
     69      mutLengthSigTextBox.ReadOnly = ReadOnly;
    6670    }
    6771
     
    7377
    7478    #region control event handlers
    75     private void minValueTextBox_TextChanged(object sender, EventArgs e) {
    76       double min;
    77       if (double.TryParse(minValueTextBox.Text, out min)) {
    78         Content.MinValue = min;
    79         errorProvider.SetError(minValueTextBox, string.Empty);
     79    private void enableWindowedCheckBox_CheckedChanged(object sender, EventArgs e) {
     80      if (Content == null) return;
     81      Content.EnableWindowing = enableWindowedCheckBox.Checked;
     82    }
     83
     84    private void initOffsetMuTextBox_TextChanged(object sender, EventArgs e) {
     85      if (Content == null) return;
     86      if (double.TryParse(initOffsetMuTextBox.Text, out double initOffsetMu)) {
     87        Content.OffsetMu = initOffsetMu;
     88        errorProvider.SetError(initOffsetMuTextBox, string.Empty);
    8089      } else {
    81         errorProvider.SetError(minValueTextBox, "Invalid value");
     90        errorProvider.SetError(initOffsetMuTextBox, "Invalid value");
    8291      }
    8392    }
    84     private void maxValueTextBox_TextChanged(object sender, EventArgs e) {
    85       double max;
    86       if (double.TryParse(maxValueTextBox.Text, out max)) {
    87         Content.MaxValue = max;
    88         errorProvider.SetError(maxValueTextBox, string.Empty);
     93    private void initOffsetSigTextBox_TextChanged(object sender, EventArgs e) {
     94      if (Content == null) return;
     95      if (double.TryParse(initOffsetSigTextBox.Text, out double initOffsetSig)) {
     96        Content.OffsetSigma = initOffsetSig;
     97        errorProvider.SetError(initOffsetSigTextBox, string.Empty);
    8998      } else {
    90         errorProvider.SetError(maxValueTextBox, "Invalid value");
     99        errorProvider.SetError(initOffsetSigTextBox, "Invalid value");
     100      }
     101    }
     102    private void initLengthMuTextBox_TextChanged(object sender, EventArgs e) {
     103      if (Content == null) return;
     104      if (double.TryParse(initLengthMuTextBox.Text, out double initLengthMu)) {
     105        Content.LengthMu = initLengthMu;
     106        errorProvider.SetError(initLengthMuTextBox, string.Empty);
     107      } else {
     108        errorProvider.SetError(initLengthMuTextBox, "Invalid value");
     109      }
     110    }
     111    private void initLengthSigTextBox_TextChanged(object sender, EventArgs e) {
     112      if (Content == null) return;
     113      if (double.TryParse(initLengthSigTextBox.Text, out double initLengthSig)) {
     114        Content.LengthSigma = initLengthSig;
     115        errorProvider.SetError(initLengthSigTextBox, string.Empty);
     116      } else {
     117        errorProvider.SetError(initLengthSigTextBox, "Invalid value");
    91118      }
    92119    }
    93120
    94     private void additiveChangeSigmaTextBox_TextChanged(object sender, EventArgs e) {
    95       double sigma;
    96       if (double.TryParse(additiveChangeSigmaTextBox.Text, out sigma) && sigma >= 0.0) {
    97         Content.ManipulatorSigma = sigma;
    98         errorProvider.SetError(additiveChangeSigmaTextBox, string.Empty);
     121    private void mutOffsetMuTextBox_TextChanged(object sender, EventArgs e) {
     122      if (Content == null) return;
     123      if (double.TryParse(mutOffsetMuTextBox.Text, out double mutOffsetMu)) {
     124        Content.ManipulatorOffsetMu = mutOffsetMu;
     125        errorProvider.SetError(mutOffsetMuTextBox, string.Empty);
    99126      } else {
    100         errorProvider.SetError(additiveChangeSigmaTextBox, "Invalid value");
     127        errorProvider.SetError(mutOffsetMuTextBox, "Invalid value");
    101128      }
    102129    }
    103 
    104     private void multiplicativeChangeSigmaTextBox_TextChanged(object sender, EventArgs e) {
    105       double sigma;
    106       if (double.TryParse(multiplicativeChangeSigmaTextBox.Text, out sigma) && sigma >= 0.0) {
    107         Content.MultiplicativeManipulatorSigma = sigma;
    108         errorProvider.SetError(multiplicativeChangeSigmaTextBox, string.Empty);
     130    private void mutOffsetSigTextBox_TextChanged(object sender, EventArgs e) {
     131      if (Content == null) return;
     132      if (double.TryParse(mutOffsetSigTextBox.Text, out double mutOffsetSig)) {
     133        Content.ManipulatorOffsetSigma = mutOffsetSig;
     134        errorProvider.SetError(mutOffsetSigTextBox, string.Empty);
    109135      } else {
    110         errorProvider.SetError(multiplicativeChangeSigmaTextBox, "Invalid value");
     136        errorProvider.SetError(mutOffsetSigTextBox, "Invalid value");
     137      }
     138    }
     139    private void mutLengthMuTextBox_TextChanged(object sender, EventArgs e) {
     140      if (Content == null) return;
     141      if (double.TryParse(mutLengthMuTextBox.Text, out double mutLengthMu)) {
     142        Content.ManipulatorLengthMu = mutLengthMu;
     143        errorProvider.SetError(mutLengthMuTextBox, string.Empty);
     144      } else {
     145        errorProvider.SetError(mutLengthMuTextBox, "Invalid value");
     146      }
     147    }
     148    private void mutLengthSigTextBox_TextChanged(object sender, EventArgs e) {
     149      if (Content == null) return;
     150      if (double.TryParse(mutLengthSigTextBox.Text, out double mutLengthSig)) {
     151        Content.ManipulatorLengthSigma = mutLengthSig;
     152        errorProvider.SetError(mutLengthSigTextBox, string.Empty);
     153      } else {
     154        errorProvider.SetError(mutLengthSigTextBox, "Invalid value");
    111155      }
    112156    }
     
    115159    #region helpers
    116160    private void UpdateControl() {
    117       if (Content == null) {
    118         minValueTextBox.Text = string.Empty;
    119         maxValueTextBox.Text = string.Empty;
    120         minValueTextBox.Text = string.Empty;
    121         multiplicativeChangeSigmaTextBox.Text = string.Empty;
    122         additiveChangeSigmaTextBox.Text = string.Empty;
    123       } else {
    124         minValueTextBox.Text = Content.MinValue.ToString();
    125         maxValueTextBox.Text = Content.MaxValue.ToString();
    126         additiveChangeSigmaTextBox.Text = Content.ManipulatorSigma.ToString();
    127         multiplicativeChangeSigmaTextBox.Text = Content.MultiplicativeManipulatorSigma.ToString();
    128       }
     161      enableWindowedCheckBox.Checked = Content?.EnableWindowing ?? false;
     162
     163      initOffsetMuTextBox.Text = Content?.OffsetMu.ToString() ?? string.Empty;
     164      initOffsetSigTextBox.Text = Content?.OffsetSigma.ToString() ?? string.Empty;
     165      initLengthMuTextBox.Text = Content?.LengthMu.ToString() ?? string.Empty;
     166      initLengthSigTextBox.Text = Content?.LengthSigma.ToString() ?? string.Empty;
     167
     168      mutOffsetMuTextBox.Text = Content?.ManipulatorOffsetMu.ToString() ?? string.Empty;
     169      mutOffsetSigTextBox.Text = Content?.ManipulatorOffsetSigma.ToString() ?? string.Empty;
     170      mutLengthMuTextBox.Text = Content?.ManipulatorLengthMu.ToString() ?? string.Empty;
     171      mutLengthSigTextBox.Text = Content?.ManipulatorLengthSigma.ToString() ?? string.Empty;
     172   
    129173      SetEnabledStateOfControls();
    130174    }
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj

    r17554 r17573  
    181181    <Compile Include="Importer\Token.cs" />
    182182    <Compile Include="Interfaces\IModelBacktransformator.cs" />
     183    <Compile Include="Interfaces\IWindowedSymbolTreeNode.cs" />
     184    <Compile Include="Interfaces\IWindowedSymbol.cs" />
    183185    <Compile Include="Interfaces\IVariableTreeNode.cs" />
    184186    <Compile Include="Interfaces\IVariableSymbol.cs" />
     
    250252    <Compile Include="Symbols\Kurtosis.cs" />
    251253    <Compile Include="Symbols\Skewness.cs" />
     254    <Compile Include="Symbols\WindowedSymbolTreeNode.cs" />
     255    <Compile Include="Symbols\WindowedSymbol.cs" />
    252256    <Compile Include="Symbols\Variance.cs" />
    253257    <Compile Include="Symbols\StandardDeviation.cs" />
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/IWindowedSymbol.cs

    r17551 r17573  
    2424
    2525namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
    26   [StorableType("3b28c671-df09-4f2c-9292-b3510b593c5f")]
     26  [StorableType("BB96C8EF-4DB8-4892-B3A3-358F34C06AD6")]
    2727  /// <summary>
    28   /// Any symbol that references a variable (includes terminal as well as non-terminal symbols)
     28  /// Any symbol that can use a window (e.g. partial aggregation of a vector)
    2929  /// </summary>
    30   public interface IVariableSymbol : ISymbol {
     30  public interface IWindowedSymbol : ISymbol {
    3131  }
    3232}
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/IWindowedSymbolTreeNode.cs

    r17551 r17573  
    2424
    2525namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
    26   [StorableType("cc5c792d-09a8-4351-8438-bd8482d8aa03")]
     26  [StorableType("7EF181F5-6595-41D4-8D40-94B1DA0BC28A")]
    2727  /// <summary>
    28   /// Any tree node that references a variable
     28  /// Any tree node that references a windowed function
    2929  /// </summary>
    30   public interface IVariableTreeNode : ISymbolicExpressionTreeNode {
    31     string VariableName { get; }
     30  public interface IWindowedSymbolTreeNode : ISymbolicExpressionTreeNode {
     31    double Offset { get; }
     32    double Length { get; }
    3233  }
    3334}
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeVectorInterpreter.cs

    r17556 r17573  
    2222using System;
    2323using System.Collections.Generic;
     24using System.Linq;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
     
    4142      Median,
    4243      Sum,
     44      First,
    4345      NaN,
    4446      Exception
     
    127129          else if (FinalAggregation == Aggregation.Median) yield return Statistics.Median(result.Vector);
    128130          else if (FinalAggregation == Aggregation.Sum) yield return result.Vector.Sum();
     131          else if (FinalAggregation == Aggregation.First) yield return result.Vector.First();
    129132          else if (FinalAggregation == Aggregation.Exception) throw new InvalidOperationException("Result of the tree is not a scalar.");
    130133          else yield return double.NaN;
     
    221224      return EvaluationResult.NaN;
    222225    }
     226
     227    private static EvaluationResult AggregateApply(EvaluationResult val, WindowedSymbolTreeNode node,
     228      Func<double, double> sFunc = null,
     229      Func<DoubleVector, double> vFunc = null) {
     230
     231      var offset = node.Offset;
     232      var length = node.Length;
     233
     234      DoubleVector SubVector(DoubleVector v) {
     235        int index = (int)(offset * v.Count);
     236        int count = (int)(length * (v.Count - index));
     237        return v.SubVector(index, count);
     238      };
     239
     240      if (val.IsScalar && sFunc != null) return new EvaluationResult(sFunc(val.Scalar));
     241      if (val.IsVector && vFunc != null) return new EvaluationResult(vFunc(SubVector(val.Vector)));
     242      return EvaluationResult.NaN;
     243    }
    223244    private static EvaluationResult AggregateMultipleApply(EvaluationResult lhs, EvaluationResult rhs,
    224245      Func<double, double, double> ssFunc = null,
     
    360381        case OpCodes.Sum: {
    361382            var cur = Evaluate(dataset, ref row, state);
    362             return AggregateApply(cur,
     383            return AggregateApply(cur, (WindowedSymbolTreeNode)currentInstr.dynamicNode,
    363384              s => s,
    364385              v => v.Sum());
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Sum.cs

    r17466 r17573  
    2828  [StorableType("C6C245BF-C44A-4207-A268-55641483F27F")]
    2929  [Item("Sum", "Symbol that represents the sum function.")]
    30   public sealed class Sum : Symbol {
     30  public sealed class Sum : WindowedSymbol {
    3131    private const int minimumArity = 1;
    3232    private const int maximumArity = 1;
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/WindowedSymbol.cs

    r17551 r17573  
    2121
    2222using System;
    23 using System.Collections.Generic;
    2423using HeuristicLab.Common;
    2524using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2625using HEAL.Attic;
     26
    2727namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
    28   [StorableType("F8A6AD96-28D9-4BEC-8392-8B7BA824B085")]
    29   public abstract class VariableBase : Symbol, IVariableSymbol {
     28  [StorableType("2E342E38-BE2F-4E49-A9C3-2E833B83FDBC")]
     29  public abstract class WindowedSymbol : Symbol, IWindowedSymbol {
    3030    #region Properties
    3131    [Storable]
    32     private double weightMu;
    33     public double WeightMu {
    34       get { return weightMu; }
     32    private bool enableWindowing;
     33    public bool EnableWindowing {
     34      get { return enableWindowing; }
    3535      set {
    36         if (value != weightMu) {
    37           weightMu = value;
     36        if (value != enableWindowing) {
     37          enableWindowing = value;
     38          OnChanged(EventArgs.Empty);
     39        }
     40      }
     41    }
     42
     43    [Storable]
     44    private double offsetMu;
     45    public double OffsetMu {
     46      get { return offsetMu; }
     47      set {
     48        if (value != offsetMu) {
     49          offsetMu = value;
    3850          OnChanged(EventArgs.Empty);
    3951        }
     
    4153    }
    4254    [Storable]
    43     private double weightSigma;
    44     public double WeightSigma {
    45       get { return weightSigma; }
     55    private double offsetSigma;
     56    public double OffsetSigma {
     57      get { return offsetSigma; }
    4658      set {
    47         if (weightSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed.");
    48         if (value != weightSigma) {
    49           weightSigma = value;
     59        if (offsetSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed.");
     60        if (value != offsetSigma) {
     61          offsetSigma = value;
    5062          OnChanged(EventArgs.Empty);
    5163        }
     
    5365    }
    5466    [Storable]
    55     private double weightManipulatorMu;
    56     public double WeightManipulatorMu {
    57       get { return weightManipulatorMu; }
     67    private double lengthMu;
     68    public double LengthMu {
     69      get { return lengthMu; }
    5870      set {
    59         if (value != weightManipulatorMu) {
    60           weightManipulatorMu = value;
     71        if (value != lengthMu) {
     72          lengthMu = value;
    6173          OnChanged(EventArgs.Empty);
    6274        }
     
    6476    }
    6577    [Storable]
    66     private double weightManipulatorSigma;
    67     public double WeightManipulatorSigma {
    68       get { return weightManipulatorSigma; }
     78    private double lengthSigma;
     79    public double LengthSigma {
     80      get { return lengthSigma; }
    6981      set {
    70         if (weightManipulatorSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed.");
    71         if (value != weightManipulatorSigma) {
    72           weightManipulatorSigma = value;
     82        if (lengthSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed.");
     83        if (value != lengthSigma) {
     84          lengthSigma = value;
     85          OnChanged(EventArgs.Empty); ;
     86        }
     87      }
     88    }
     89
     90    [Storable]
     91    private double manipulatorOffsetMu;
     92    public double ManipulatorOffsetMu {
     93      get { return manipulatorOffsetMu; }
     94      set {
     95        if (value != manipulatorOffsetMu) {
     96          manipulatorOffsetMu = value;
    7397          OnChanged(EventArgs.Empty);
    7498        }
    7599      }
    76100    }
    77     [Storable(DefaultValue = 0.0)]
    78     private double multiplicativeWeightManipulatorSigma;
    79     public double MultiplicativeWeightManipulatorSigma {
    80       get { return multiplicativeWeightManipulatorSigma; }
     101    [Storable]
     102    private double manipulatorOffsetSigma;
     103    public double ManipulatorOffsetSigma {
     104      get { return manipulatorOffsetSigma; }
    81105      set {
    82         if (multiplicativeWeightManipulatorSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed.");
    83         if (value != multiplicativeWeightManipulatorSigma) {
    84           multiplicativeWeightManipulatorSigma = value;
     106        if (manipulatorOffsetSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed.");
     107        if (value != manipulatorOffsetSigma) {
     108          manipulatorOffsetSigma = value;
    85109          OnChanged(EventArgs.Empty);
    86110        }
    87111      }
    88112    }
    89 
    90     [Storable(DefaultValue = 1.0)]
    91     private double variableChangeProbability;
    92 
    93     public double VariableChangeProbability {
    94       get { return variableChangeProbability; }
     113    [Storable]
     114    private double manipulatorLengthMu;
     115    public double ManipulatorLengthMu {
     116      get { return manipulatorLengthMu; }
    95117      set {
    96         if (value < 0 || value > 1.0) throw new ArgumentException("Variable change probability must lie in the interval [0..1]");
    97         variableChangeProbability = value;
     118        if (value != manipulatorLengthMu) {
     119          manipulatorLengthMu = value;
     120          OnChanged(EventArgs.Empty);
     121        }
    98122      }
    99123    }
    100 
    101     private List<string> variableNames;
    102124    [Storable]
    103     public IEnumerable<string> VariableNames {
    104       get { return variableNames; }
     125    private double manipulatorLengthSigma;
     126    public double ManipulatorLengthSigma {
     127      get { return manipulatorLengthSigma; }
    105128      set {
    106         if (value == null) throw new ArgumentNullException();
    107         variableNames.Clear();
    108         variableNames.AddRange(value);
    109         OnChanged(EventArgs.Empty);
     129        if (manipulatorLengthSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed.");
     130        if (value != manipulatorLengthSigma) {
     131          manipulatorLengthSigma = value;
     132          OnChanged(EventArgs.Empty);;
     133        }
    110134      }
    111     }
    112 
    113     private List<string> allVariableNames;
    114     [Storable]
    115     public IEnumerable<string> AllVariableNames {
    116       get { return allVariableNames; }
    117       set {
    118         if (value == null) throw new ArgumentNullException();
    119         allVariableNames.Clear();
    120         allVariableNames.AddRange(value);
    121       }
    122     }
    123 
    124     public override bool Enabled {
    125       get {
    126         if (variableNames.Count == 0) return false;
    127         return base.Enabled;
    128       }
    129       set {
    130         if (variableNames.Count == 0) base.Enabled = false;
    131         else base.Enabled = value;
    132       }
    133     }
    134 
    135     private const int minimumArity = 0;
    136     private const int maximumArity = 0;
    137 
    138     public override int MinimumArity {
    139       get { return minimumArity; }
    140     }
    141     public override int MaximumArity {
    142       get { return maximumArity; }
    143135    }
    144136    #endregion
    145137
    146     [StorableHook(HookType.AfterDeserialization)]
    147     private void AfterDeserialization() {
    148       if (allVariableNames == null || (allVariableNames.Count == 0 && variableNames.Count > 0)) {
    149         allVariableNames = variableNames;
    150       }
     138    [StorableConstructor]
     139    protected WindowedSymbol(StorableConstructorFlag _) : base(_) {
     140    }
     141    protected WindowedSymbol(WindowedSymbol original, Cloner cloner)
     142      : base(original, cloner) {
     143      enableWindowing = original.enableWindowing;
     144
     145      offsetMu = original.offsetMu;
     146      offsetSigma = original.offsetSigma;
     147      lengthMu = original.lengthMu;
     148      lengthSigma = original.lengthSigma;
     149
     150      manipulatorOffsetMu = original.manipulatorOffsetMu;
     151      manipulatorOffsetSigma = original.manipulatorOffsetSigma;
     152      manipulatorLengthMu = original.manipulatorLengthMu;
     153      manipulatorLengthSigma = original.manipulatorLengthSigma;
     154    }
     155    protected WindowedSymbol(string name, string description)
     156      : base(name, description) {
     157      enableWindowing = false;
     158
     159      offsetMu = 0.0;
     160      offsetSigma = 0.05;
     161      lengthMu = 1.0;
     162      lengthSigma = 0.05;
     163
     164      manipulatorOffsetMu = 0.0;
     165      manipulatorOffsetSigma = 0.05;
     166      manipulatorLengthMu = 0.0;
     167      manipulatorLengthSigma = 0.05;
    151168    }
    152169
    153     [StorableConstructor]
    154     protected VariableBase(StorableConstructorFlag _) : base(_) {
    155       variableNames = new List<string>();
    156       allVariableNames = new List<string>();
    157     }
    158     protected VariableBase(VariableBase original, Cloner cloner)
    159       : base(original, cloner) {
    160       weightMu = original.weightMu;
    161       weightSigma = original.weightSigma;
    162       variableNames = new List<string>(original.variableNames);
    163       allVariableNames = new List<string>(original.allVariableNames);
    164       weightManipulatorMu = original.weightManipulatorMu;
    165       weightManipulatorSigma = original.weightManipulatorSigma;
    166       multiplicativeWeightManipulatorSigma = original.multiplicativeWeightManipulatorSigma;
    167       variableChangeProbability = original.variableChangeProbability;
    168     }
    169     protected VariableBase(string name, string description)
    170       : base(name, description) {
    171       weightMu = 1.0;
    172       weightSigma = 1.0;
    173       weightManipulatorMu = 0.0;
    174       weightManipulatorSigma = 0.05;
    175       multiplicativeWeightManipulatorSigma = 0.03;
    176       variableChangeProbability = 0.2;
    177       variableNames = new List<string>();
    178       allVariableNames = new List<string>();
     170    public override ISymbolicExpressionTreeNode CreateTreeNode() {
     171      return new WindowedSymbolTreeNode(this);
    179172    }
    180173  }
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/WindowedSymbolTreeNode.cs

    r17551 r17573  
    2020#endregion
    2121
     22using System;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
     
    2526using HEAL.Attic;
    2627using HeuristicLab.Random;
     28
    2729namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
    28   [StorableType("B92EF904-18EC-41FC-9123-9B9293246815")]
    29   public abstract class VariableTreeNodeBase : SymbolicExpressionTreeTerminalNode, IVariableTreeNode {
    30     public new VariableBase Symbol {
    31       get { return (VariableBase)base.Symbol; }
     30  [StorableType("E79432BB-414D-4535-8751-D0139AF048E1")]
     31  public class WindowedSymbolTreeNode : SymbolicExpressionTreeNode, IWindowedSymbolTreeNode {
     32    public new WindowedSymbol Symbol {
     33      get { return (WindowedSymbol)base.Symbol; }
    3234    }
    3335    [Storable]
    34     private double weight;
    35     public double Weight {
    36       get { return weight; }
    37       set { weight = value; }
     36    private double offset;
     37    public double Offset {
     38      get { return offset; }
     39      set { offset = Math.Min(Math.Max(value, 0.0), 1.0); }     
    3840    }
    3941    [Storable]
    40     private string variableName;
    41     public string VariableName {
    42       get { return variableName; }
    43       set { variableName = value; }
     42    private double length;
     43    public double Length {
     44      get { return length; }
     45      set { length = Math.Min(Math.Max(value, 0.0), 1.0); }
    4446    }
    4547
    4648    [StorableConstructor]
    47     protected VariableTreeNodeBase(StorableConstructorFlag _) : base(_) { }
    48     protected VariableTreeNodeBase(VariableTreeNodeBase original, Cloner cloner)
     49    protected WindowedSymbolTreeNode(StorableConstructorFlag _) : base(_) { }
     50    protected WindowedSymbolTreeNode(WindowedSymbolTreeNode original, Cloner cloner)
    4951      : base(original, cloner) {
    50       weight = original.weight;
    51       variableName = original.variableName;
     52      offset = original.offset;
     53      length = original.length;
    5254    }
    53     protected VariableTreeNodeBase() { }
    54     protected VariableTreeNodeBase(VariableBase variableSymbol) : base(variableSymbol) { }
     55    public override IDeepCloneable Clone(Cloner cloner) {
     56      return new WindowedSymbolTreeNode(this, cloner);
     57    }
     58
     59    public WindowedSymbolTreeNode(WindowedSymbol windowedSymbol) : base(windowedSymbol) {
     60      if (!windowedSymbol.EnableWindowing) {
     61        Offset = 0.0;
     62        Length = 1.0;
     63      }
     64    }
    5565
    5666    public override bool HasLocalParameters {
    57       get { return true; }
     67      get { return Symbol.EnableWindowing; }
    5868    }
    5969
    6070    public override void ResetLocalParameters(IRandom random) {
    6171      base.ResetLocalParameters(random);
    62       weight = NormalDistributedRandom.NextDouble(random, Symbol.WeightMu, Symbol.WeightSigma);
    6372
    64 #pragma warning disable 612, 618
    65       variableName = Symbol.VariableNames.SelectRandom(random);
    66 #pragma warning restore 612, 618
     73      if (Symbol.EnableWindowing) {
     74        Offset = NormalDistributedRandom.NextDouble(random, Symbol.OffsetMu, Symbol.OffsetSigma);
     75        Length = NormalDistributedRandom.NextDouble(random, Symbol.LengthMu, Symbol.LengthSigma);
     76      }
    6777    }
    6878
     
    7080      base.ShakeLocalParameters(random, shakingFactor);
    7181
    72       // 50% additive & 50% multiplicative (TODO: BUG in if statement below -> fix in HL 4.0!)
    73       if (random.NextDouble() < 0) {
    74         double x = NormalDistributedRandom.NextDouble(random, Symbol.WeightManipulatorMu, Symbol.WeightManipulatorSigma);
    75         weight = weight + x * shakingFactor;
    76       } else {
    77         double x = NormalDistributedRandom.NextDouble(random, 1.0, Symbol.MultiplicativeWeightManipulatorSigma);
    78         weight = weight * x;
    79       }
    80 
    81       if (Symbol.VariableChangeProbability >= 1.0) {
    82         // old behaviour for backwards compatibility
    83         #region Backwards compatible code, remove with 3.4
    84 #pragma warning disable 612, 618
    85         variableName = Symbol.VariableNames.SelectRandom(random);
    86 #pragma warning restore 612, 618
    87         #endregion
    88       } else if (random.NextDouble() < Symbol.VariableChangeProbability) {
    89         var oldName = variableName;
    90         variableName = Symbol.VariableNames.SampleRandom(random);
    91         if (oldName != variableName) {
    92           // re-initialize weight if the variable is changed
    93           weight = NormalDistributedRandom.NextDouble(random, Symbol.WeightMu, Symbol.WeightSigma);
    94         }
     82      if (Symbol.EnableWindowing) {
     83        Offset += NormalDistributedRandom.NextDouble(random, Symbol.ManipulatorOffsetMu, Symbol.ManipulatorOffsetSigma) * shakingFactor;
     84        Length += NormalDistributedRandom.NextDouble(random, Symbol.ManipulatorLengthMu, Symbol.ManipulatorLengthSigma) * shakingFactor;
    9585      }
    9686    }
    9787
    9888    public override string ToString() {
    99       if (weight.IsAlmost(1.0)) return variableName;
    100       else return weight.ToString("E4") + " " + variableName;
     89      return Symbol.EnableWindowing
     90        ? base.ToString() + $"[{Offset} : {Length}]"
     91        : base.ToString();
    10192    }
    10293  }
Note: See TracChangeset for help on using the changeset viewer.