Changeset 2843


Ignore:
Timestamp:
02/19/10 18:49:17 (11 years ago)
Author:
gkronber
Message:

Removed max. and min. time offset constraints as algorithm parameters and from all engines. The time constraints were added to the relevant terminal symbols (variable & differential) instead. The time offset constraint can be changed by editing the symbols in the function library. #880 (Max and min time offsets for variable symbols are not set correctly by FunctionLibraryInjectors)

Location:
trunk/sources
Files:
3 added
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/DispatcherView.Designer.cs

    r2824 r2843  
    2424    /// </summary>
    2525    private void InitializeComponent() {
     26      this.components = new System.ComponentModel.Container();
    2627      this.targetVariableList = new System.Windows.Forms.CheckedListBox();
    2728      this.inputVariableList = new System.Windows.Forms.CheckedListBox();
     
    3031      this.splitContainer = new System.Windows.Forms.SplitContainer();
    3132      this.learningTaskGroupBox = new System.Windows.Forms.GroupBox();
     33      this.editEngineButton = new System.Windows.Forms.Button();
    3234      this.setAlgorithmDefault = new System.Windows.Forms.Button();
    3335      this.autoregressiveLabel = new System.Windows.Forms.Label();
    3436      this.classificationRadioButton = new System.Windows.Forms.RadioButton();
    3537      this.algorithmsListBox = new System.Windows.Forms.CheckedListBox();
    36       this.minTimeOffsetLabel = new System.Windows.Forms.Label();
    37       this.minTimeOffsetTextBox = new System.Windows.Forms.TextBox();
    38       this.maxTimeOffsetLabel = new System.Windows.Forms.Label();
    3938      this.regressionRadioButton = new System.Windows.Forms.RadioButton();
    40       this.maxTimeOffsetTextBox = new System.Windows.Forms.TextBox();
    4139      this.timeSeriesRadioButton = new System.Windows.Forms.RadioButton();
    4240      this.autoregressiveCheckBox = new System.Windows.Forms.CheckBox();
     
    5250      this.testLabel = new System.Windows.Forms.Label();
    5351      this.setAllButton = new System.Windows.Forms.Button();
    54       this.editEngineButton = new System.Windows.Forms.Button();
     52      this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components);
    5553      this.splitContainer.Panel1.SuspendLayout();
    5654      this.splitContainer.Panel2.SuspendLayout();
     
    5856      this.learningTaskGroupBox.SuspendLayout();
    5957      this.partitioningGroupBox.SuspendLayout();
     58      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    6059      this.SuspendLayout();
    6160      //
     
    136135      this.learningTaskGroupBox.Controls.Add(this.classificationRadioButton);
    137136      this.learningTaskGroupBox.Controls.Add(this.algorithmsListBox);
    138       this.learningTaskGroupBox.Controls.Add(this.minTimeOffsetLabel);
    139       this.learningTaskGroupBox.Controls.Add(this.minTimeOffsetTextBox);
    140       this.learningTaskGroupBox.Controls.Add(this.maxTimeOffsetLabel);
    141137      this.learningTaskGroupBox.Controls.Add(this.regressionRadioButton);
    142       this.learningTaskGroupBox.Controls.Add(this.maxTimeOffsetTextBox);
    143138      this.learningTaskGroupBox.Controls.Add(this.timeSeriesRadioButton);
    144139      this.learningTaskGroupBox.Controls.Add(this.autoregressiveCheckBox);
     
    146141      this.learningTaskGroupBox.Location = new System.Drawing.Point(6, 236);
    147142      this.learningTaskGroupBox.Name = "learningTaskGroupBox";
    148       this.learningTaskGroupBox.Size = new System.Drawing.Size(343, 321);
     143      this.learningTaskGroupBox.Size = new System.Drawing.Size(343, 341);
    149144      this.learningTaskGroupBox.TabIndex = 36;
    150145      this.learningTaskGroupBox.TabStop = false;
    151146      this.learningTaskGroupBox.Text = "Learning task";
    152147      //
     148      // editEngineButton
     149      //
     150      this.editEngineButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     151      this.editEngineButton.Location = new System.Drawing.Point(108, 312);
     152      this.editEngineButton.Name = "editEngineButton";
     153      this.editEngineButton.Size = new System.Drawing.Size(75, 23);
     154      this.editEngineButton.TabIndex = 37;
     155      this.editEngineButton.Text = "Edit engine";
     156      this.editEngineButton.UseVisualStyleBackColor = true;
     157      this.editEngineButton.Click += new System.EventHandler(this.editEngineButton_Click);
     158      //
    153159      // setAlgorithmDefault
    154160      //
    155161      this.setAlgorithmDefault.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    156       this.setAlgorithmDefault.Location = new System.Drawing.Point(6, 292);
     162      this.setAlgorithmDefault.Location = new System.Drawing.Point(6, 312);
    157163      this.setAlgorithmDefault.Name = "setAlgorithmDefault";
    158164      this.setAlgorithmDefault.Size = new System.Drawing.Size(96, 23);
     
    191197      this.algorithmsListBox.FormattingEnabled = true;
    192198      this.algorithmsListBox.HorizontalScrollbar = true;
    193       this.algorithmsListBox.Location = new System.Drawing.Point(6, 155);
     199      this.algorithmsListBox.Location = new System.Drawing.Point(6, 110);
    194200      this.algorithmsListBox.Name = "algorithmsListBox";
    195       this.algorithmsListBox.Size = new System.Drawing.Size(331, 124);
     201      this.algorithmsListBox.Size = new System.Drawing.Size(331, 184);
    196202      this.algorithmsListBox.TabIndex = 4;
    197203      this.algorithmsListBox.SelectedIndexChanged += new System.EventHandler(this.algorithmsListBox_SelectedIndexChanged);
    198204      this.algorithmsListBox.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.algorithmsListBox_ItemCheck);
    199       //
    200       // minTimeOffsetLabel
    201       //
    202       this.minTimeOffsetLabel.AutoSize = true;
    203       this.minTimeOffsetLabel.Enabled = false;
    204       this.minTimeOffsetLabel.Location = new System.Drawing.Point(38, 106);
    205       this.minTimeOffsetLabel.Name = "minTimeOffsetLabel";
    206       this.minTimeOffsetLabel.Size = new System.Drawing.Size(87, 13);
    207       this.minTimeOffsetLabel.TabIndex = 31;
    208       this.minTimeOffsetLabel.Text = "Min. Time Offset:";
    209       //
    210       // minTimeOffsetTextBox
    211       //
    212       this.minTimeOffsetTextBox.Enabled = false;
    213       this.minTimeOffsetTextBox.Location = new System.Drawing.Point(131, 103);
    214       this.minTimeOffsetTextBox.Name = "minTimeOffsetTextBox";
    215       this.minTimeOffsetTextBox.Size = new System.Drawing.Size(96, 20);
    216       this.minTimeOffsetTextBox.TabIndex = 32;
    217       this.minTimeOffsetTextBox.Validated += new System.EventHandler(this.timeOffsetTextBox_Validated);
    218       this.minTimeOffsetTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.timeOffsetTextBox_Validating);
    219       //
    220       // maxTimeOffsetLabel
    221       //
    222       this.maxTimeOffsetLabel.AutoSize = true;
    223       this.maxTimeOffsetLabel.Enabled = false;
    224       this.maxTimeOffsetLabel.Location = new System.Drawing.Point(35, 132);
    225       this.maxTimeOffsetLabel.Name = "maxTimeOffsetLabel";
    226       this.maxTimeOffsetLabel.Size = new System.Drawing.Size(90, 13);
    227       this.maxTimeOffsetLabel.TabIndex = 33;
    228       this.maxTimeOffsetLabel.Text = "Max. Time Offset:";
    229205      //
    230206      // regressionRadioButton
     
    238214      this.regressionRadioButton.UseVisualStyleBackColor = true;
    239215      this.regressionRadioButton.CheckedChanged += new System.EventHandler(this.radioButton_CheckedChanged);
    240       //
    241       // maxTimeOffsetTextBox
    242       //
    243       this.maxTimeOffsetTextBox.Enabled = false;
    244       this.maxTimeOffsetTextBox.Location = new System.Drawing.Point(131, 129);
    245       this.maxTimeOffsetTextBox.Name = "maxTimeOffsetTextBox";
    246       this.maxTimeOffsetTextBox.Size = new System.Drawing.Size(96, 20);
    247       this.maxTimeOffsetTextBox.TabIndex = 34;
    248       this.maxTimeOffsetTextBox.Validated += new System.EventHandler(this.timeOffsetTextBox_Validated);
    249       this.maxTimeOffsetTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.timeOffsetTextBox_Validating);
    250216      //
    251217      // timeSeriesRadioButton
     
    285251      this.partitioningGroupBox.Controls.Add(this.testLabel);
    286252      this.partitioningGroupBox.Enabled = false;
    287       this.partitioningGroupBox.Location = new System.Drawing.Point(6, 563);
     253      this.partitioningGroupBox.Location = new System.Drawing.Point(6, 583);
    288254      this.partitioningGroupBox.Name = "partitioningGroupBox";
    289       this.partitioningGroupBox.Size = new System.Drawing.Size(343, 122);
     255      this.partitioningGroupBox.Size = new System.Drawing.Size(343, 102);
    290256      this.partitioningGroupBox.TabIndex = 26;
    291257      this.partitioningGroupBox.TabStop = false;
     
    294260      // validationSamplesEndTextBox
    295261      //
    296       this.validationSamplesEndTextBox.Location = new System.Drawing.Point(221, 43);
     262      this.validationSamplesEndTextBox.Location = new System.Drawing.Point(222, 45);
    297263      this.validationSamplesEndTextBox.Name = "validationSamplesEndTextBox";
    298264      this.validationSamplesEndTextBox.Size = new System.Drawing.Size(96, 20);
     
    304270      //
    305271      this.trainingLabel.AutoSize = true;
    306       this.trainingLabel.Location = new System.Drawing.Point(13, 20);
     272      this.trainingLabel.Location = new System.Drawing.Point(14, 22);
    307273      this.trainingLabel.Name = "trainingLabel";
    308274      this.trainingLabel.Size = new System.Drawing.Size(89, 13);
     
    312278      // trainingSamplesStartTextBox
    313279      //
    314       this.trainingSamplesStartTextBox.Location = new System.Drawing.Point(119, 17);
     280      this.trainingSamplesStartTextBox.Location = new System.Drawing.Point(120, 19);
    315281      this.trainingSamplesStartTextBox.Name = "trainingSamplesStartTextBox";
    316282      this.trainingSamplesStartTextBox.Size = new System.Drawing.Size(96, 20);
     
    321287      // trainingSamplesEndTextBox
    322288      //
    323       this.trainingSamplesEndTextBox.Location = new System.Drawing.Point(221, 17);
     289      this.trainingSamplesEndTextBox.Location = new System.Drawing.Point(222, 19);
    324290      this.trainingSamplesEndTextBox.Name = "trainingSamplesEndTextBox";
    325291      this.trainingSamplesEndTextBox.Size = new System.Drawing.Size(96, 20);
     
    331297      //
    332298      this.validationLabel.AutoSize = true;
    333       this.validationLabel.Location = new System.Drawing.Point(5, 46);
     299      this.validationLabel.Location = new System.Drawing.Point(6, 48);
    334300      this.validationLabel.Name = "validationLabel";
    335301      this.validationLabel.Size = new System.Drawing.Size(97, 13);
     
    339305      // testSamplesEndTextBox
    340306      //
    341       this.testSamplesEndTextBox.Location = new System.Drawing.Point(221, 68);
     307      this.testSamplesEndTextBox.Location = new System.Drawing.Point(222, 70);
    342308      this.testSamplesEndTextBox.Name = "testSamplesEndTextBox";
    343309      this.testSamplesEndTextBox.Size = new System.Drawing.Size(96, 20);
     
    348314      // validationSamplesStartTextBox
    349315      //
    350       this.validationSamplesStartTextBox.Location = new System.Drawing.Point(119, 43);
     316      this.validationSamplesStartTextBox.Location = new System.Drawing.Point(120, 45);
    351317      this.validationSamplesStartTextBox.Name = "validationSamplesStartTextBox";
    352318      this.validationSamplesStartTextBox.Size = new System.Drawing.Size(96, 20);
     
    357323      // testSamplesStartTextBox
    358324      //
    359       this.testSamplesStartTextBox.Location = new System.Drawing.Point(119, 68);
     325      this.testSamplesStartTextBox.Location = new System.Drawing.Point(120, 70);
    360326      this.testSamplesStartTextBox.Name = "testSamplesStartTextBox";
    361327      this.testSamplesStartTextBox.Size = new System.Drawing.Size(96, 20);
     
    367333      //
    368334      this.testLabel.AutoSize = true;
    369       this.testLabel.Location = new System.Drawing.Point(30, 71);
     335      this.testLabel.Location = new System.Drawing.Point(31, 73);
    370336      this.testLabel.Name = "testLabel";
    371337      this.testLabel.Size = new System.Drawing.Size(72, 13);
     
    384350      this.setAllButton.Click += new System.EventHandler(this.setAllButton_Click);
    385351      //
    386       // editEngineButton
    387       //
    388       this.editEngineButton.Location = new System.Drawing.Point(108, 292);
    389       this.editEngineButton.Name = "editEngineButton";
    390       this.editEngineButton.Size = new System.Drawing.Size(75, 23);
    391       this.editEngineButton.TabIndex = 37;
    392       this.editEngineButton.Text = "Edit engine";
    393       this.editEngineButton.UseVisualStyleBackColor = true;
    394       this.editEngineButton.Click += new System.EventHandler(this.editEngineButton_Click);
     352      // errorProvider
     353      //
     354      this.errorProvider.ContainerControl = this;
    395355      //
    396356      // DispatcherView
     
    410370      this.partitioningGroupBox.ResumeLayout(false);
    411371      this.partitioningGroupBox.PerformLayout();
     372      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    412373      this.ResumeLayout(false);
    413374
     
    436397    private System.Windows.Forms.Label autoregressiveLabel;
    437398    private System.Windows.Forms.RadioButton classificationRadioButton;
    438     private System.Windows.Forms.Label minTimeOffsetLabel;
    439     private System.Windows.Forms.TextBox minTimeOffsetTextBox;
    440     private System.Windows.Forms.Label maxTimeOffsetLabel;
    441399    private System.Windows.Forms.RadioButton regressionRadioButton;
    442     private System.Windows.Forms.TextBox maxTimeOffsetTextBox;
    443400    private System.Windows.Forms.RadioButton timeSeriesRadioButton;
    444401    private System.Windows.Forms.CheckBox autoregressiveCheckBox;
    445402    private System.Windows.Forms.Button setAlgorithmDefault;
    446403    private System.Windows.Forms.Button editEngineButton;
     404    private System.Windows.Forms.ErrorProvider errorProvider;
    447405  }
    448406}
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/DispatcherView.cs

    r2824 r2843  
    102102      testSamplesStartTextBox.Text = selectedSpec.TestSamplesStart.ToString();
    103103      testSamplesEndTextBox.Text = selectedSpec.TestSamplesEnd.ToString();
    104       minTimeOffsetTextBox.Text = selectedSpec.MinTimeOffset.ToString();
    105       maxTimeOffsetTextBox.Text = selectedSpec.MaxTimeOffset.ToString();
    106104      autoregressiveCheckBox.Checked = selectedSpec.AutoRegressive;
    107105    }
     
    136134          ProblemSpecification spec = dispatcher.GetProblemSpecification(targetVar);
    137135          spec.LearningTask = selectedSpec.LearningTask;
    138           spec.MinTimeOffset = selectedSpec.MinTimeOffset;
    139           spec.MaxTimeOffset = selectedSpec.MaxTimeOffset;
    140136          spec.AutoRegressive = selectedSpec.AutoRegressive;
    141137          var curAllowedAlgos = dispatcher.GetAllowedAlgorithms(targetVar).ToList();
     
    157153
    158154    private void radioButton_CheckedChanged(object sender, EventArgs e) {
    159       minTimeOffsetLabel.Enabled = timeSeriesRadioButton.Checked;
    160       minTimeOffsetTextBox.Enabled = timeSeriesRadioButton.Checked;
    161       maxTimeOffsetLabel.Enabled = timeSeriesRadioButton.Checked;
    162       maxTimeOffsetTextBox.Enabled = timeSeriesRadioButton.Checked;
    163155      autoregressiveCheckBox.Enabled = timeSeriesRadioButton.Checked;
    164156      autoregressiveLabel.Enabled = timeSeriesRadioButton.Checked;
     
    171163      }
    172164      UpdateAlgorithms();
    173     }
    174 
    175     private void timeOffsetTextBox_Validating(object sender, CancelEventArgs e) {
    176       int min, max;
    177       e.Cancel = !int.TryParse(minTimeOffsetTextBox.Text, out min);
    178       e.Cancel = !int.TryParse(maxTimeOffsetTextBox.Text, out max);
    179       e.Cancel = min > max;
    180     }
    181 
    182     private void timeOffsetTextBox_Validated(object sender, EventArgs e) {
    183       selectedSpec.MinTimeOffset = int.Parse(minTimeOffsetTextBox.Text);
    184       selectedSpec.MaxTimeOffset = int.Parse(maxTimeOffsetTextBox.Text);
    185165    }
    186166
     
    255235      editEngineButton.Enabled = algorithmsListBox.SelectedItems.Count > 0;
    256236    }
    257 
    258237  }
    259238}
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/DispatcherView.resx

    r2088 r2843  
    118118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    119119  </resheader>
     120  <metadata name="errorProvider.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     121    <value>17, 17</value>
     122  </metadata>
    120123</root>
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/ProblemSpecification.cs

    r2422 r2843  
    8383    }
    8484
    85     public int MaxTimeOffset { get; set; }
    86     public int MinTimeOffset { get; set; }
    87 
    8885    public bool AutoRegressive { get; set; }
    8986
     
    108105      LearningTask = original.LearningTask;
    109106      TargetVariable = original.TargetVariable;
    110       MinTimeOffset = original.MinTimeOffset;
    111       MaxTimeOffset = original.MaxTimeOffset;
    112107      AutoRegressive = original.AutoRegressive;
    113108      TrainingSamplesStart = original.TrainingSamplesStart;
     
    134129      return
    135130        other.LearningTask == LearningTask &&
    136         other.MinTimeOffset == MinTimeOffset &&
    137         other.MaxTimeOffset == MaxTimeOffset &&
    138131        other.AutoRegressive == AutoRegressive &&
    139132        other.TargetVariable == TargetVariable &&
     
    156149        LearningTask.GetHashCode() |
    157150        TargetVariable.GetHashCode() |
    158         MinTimeOffset.GetHashCode() |
    159         MaxTimeOffset.GetHashCode() |
    160151        AutoRegressive.GetHashCode() |
    161152        TrainingSamplesStart.GetHashCode() |
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/SimpleDispatcher.cs

    r2825 r2843  
    106106    private object locker = new object();
    107107
     108
     109    public double TrainingSetPercentageSize {
     110      get;
     111      set;
     112    }
     113
     114    public int SkippedRowsBeginning {
     115      get;
     116      set;
     117    }
     118
     119    public int SkippedRowsEnd {
     120      get;
     121      set;
     122    }
     123
    108124    public SimpleDispatcher(IModelingDatabase database, Dataset dataset) {
    109125      this.dataset = dataset;
     
    117133      finishedAndDispatchedRuns = new Dictionary<string, List<AlgorithmConfiguration>>();
    118134
    119      
     135
    120136      defaultAlgorithms = ApplicationManager.Manager.GetInstances<HeuristicLab.Modeling.IAlgorithm>().ToArray();
     137
     138      TrainingSetPercentageSize = 0.5;
     139      SkippedRowsBeginning = 2;
    121140
    122141      // PopulateFinishedRuns();
     
    190209
    191210      if (spec.LearningTask == LearningTask.TimeSeries) {
    192         ITimeSeriesAlgorithm timeSeriesAlgo = (ITimeSeriesAlgorithm)algo;
    193         timeSeriesAlgo.MinTimeOffset = spec.MinTimeOffset;
    194         timeSeriesAlgo.MaxTimeOffset = spec.MaxTimeOffset;
    195         timeSeriesAlgo.TrainingSamplesStart = spec.TrainingSamplesStart - spec.MinTimeOffset + 1; // first possible index is 1 because of differential symbol
     211        algo.TrainingSamplesStart = spec.TrainingSamplesStart + 1; // first possible index is 1 because of differential symbol
    196212        if (spec.AutoRegressive) {
    197213          allowedFeatures.Add(spec.TargetVariable);
     
    255271        if (!(double.IsNaN(x) || double.IsInfinity(x))) break;
    256272      }
     273      firstValueIndex += SkippedRowsBeginning;
    257274      // find index of last correct target value
    258275      int lastValueIndex;
     
    261278        if (!(double.IsNaN(x) || double.IsInfinity(x))) break;
    262279      }
     280      lastValueIndex -= SkippedRowsEnd;
    263281
    264282      int validTargetRange = lastValueIndex - firstValueIndex;
    265283      spec.TrainingSamplesStart = firstValueIndex;
    266       spec.TrainingSamplesEnd = firstValueIndex + (int)Math.Floor(validTargetRange * 0.5);
     284      spec.TrainingSamplesEnd = firstValueIndex + (int)Math.Floor(validTargetRange * TrainingSetPercentageSize);
    267285      spec.ValidationSamplesStart = spec.TrainingSamplesEnd;
    268       spec.ValidationSamplesEnd = firstValueIndex + (int)Math.Floor(validTargetRange * 0.75);
     286      spec.ValidationSamplesEnd = spec.TrainingSamplesEnd + (int)Math.Floor(validTargetRange * (1 - TrainingSetPercentageSize) / 2.0);
    269287      spec.TestSamplesStart = spec.ValidationSamplesEnd;
    270288      spec.TestSamplesEnd = lastValueIndex;
  • trunk/sources/HeuristicLab.GP.StructureIdentification.Networks/3.2/FunctionLibraryInjector.cs

    r2821 r2843  
    2828namespace HeuristicLab.GP.StructureIdentification.Networks {
    2929  public class FunctionLibraryInjector : FunctionLibraryInjectorBase {
    30     public const string MINTIMEOFFSET = "MinTimeOffset";
    31     public const string MAXTIMEOFFSET = "MaxTimeOffset";
    32 
    33     public const string DIFFERENTIALS_ALLOWED = "Differentials";
    34 
    35     private int minTimeOffset;
    36     private int maxTimeOffset;
    3730
    3831    public override string Description {
     
    4033    }
    4134
    42     public FunctionLibraryInjector()
    43       : base() {
    44       AddVariableInfo(new VariableInfo(MINTIMEOFFSET, "Minimal time offset for all features", typeof(IntData), VariableKind.In));
    45       AddVariableInfo(new VariableInfo(MAXTIMEOFFSET, "Maximal time offset for all feature", typeof(IntData), VariableKind.In));
    46 
    47       AddVariable(DIFFERENTIALS_ALLOWED, false);
     35    protected override FunctionLibrary CreateFunctionLibrary() {
     36      return Create();
    4837    }
    4938
    50     private void AddVariable(string name, bool allowed) {
    51       AddVariableInfo(new VariableInfo(name, name + " allowed", typeof(BoolData), Core.VariableKind.New));
    52       GetVariableInfo(name).Local = true;
    53       AddVariable(new Core.Variable(name, new BoolData(allowed)));
    54     }
    55 
    56     public override IOperation Apply(IScope scope) {
    57       // try to get minTimeOffset (use 0 as default if not available)
    58       IItem minTimeOffsetItem = GetVariableValue(MINTIMEOFFSET, scope, true, false);
    59       minTimeOffset = minTimeOffsetItem == null ? 0 : ((IntData)minTimeOffsetItem).Data;
    60       // try to get maxTimeOffset (use 0 as default if not available)
    61       IItem maxTimeOffsetItem = GetVariableValue(MAXTIMEOFFSET, scope, true, false);
    62       maxTimeOffset = maxTimeOffsetItem == null ? 0 : ((IntData)maxTimeOffsetItem).Data;
    63 
    64       return base.Apply(scope);
    65     }
    66 
    67     protected override FunctionLibrary CreateFunctionLibrary() {
    68       return Create(minTimeOffset, maxTimeOffset);
    69     }
    70 
    71     public static FunctionLibrary Create(int minTimeOffset, int maxTimeOffset) {
     39    public static FunctionLibrary Create() {
    7240      FunctionLibrary functionLibrary = new FunctionLibrary();
    7341
     
    147115      f2Functions.ForEach(x => functionLibrary.AddFunction(x));
    148116
    149       variable.SetConstraints(minTimeOffset, maxTimeOffset);
    150       differential.SetConstraints(minTimeOffset, maxTimeOffset);
    151       openPar.SetConstraints(minTimeOffset, maxTimeOffset);
     117      openPar.SetConstraints(0, 0);
    152118
    153119
  • trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/3.3/OffspringSelectionGPTimeSeriesPrognosis.cs

    r2821 r2843  
    3535    }
    3636
    37     public int MinTimeOffset {
    38       get { return GetVariableInjector().GetVariable("MinTimeOffset").GetValue<IntData>().Data; }
    39       set { GetVariableInjector().GetVariable("MinTimeOffset").GetValue<IntData>().Data = value; }
    40     }
    41 
    42     public int MaxTimeOffset {
    43       get { return GetVariableInjector().GetVariable("MaxTimeOffset").GetValue<IntData>().Data; }
    44       set { GetVariableInjector().GetVariable("MaxTimeOffset").GetValue<IntData>().Data = value; }
    45     }
    46 
    4737    protected override IOperator CreateProblemInjector() {
    4838      return DefaultTimeSeriesOperators.CreateProblemInjector();
    49     }
    50 
    51     protected override IOperator CreateFunctionLibraryInjector() {
    52       CombinedOperator op = new CombinedOperator();
    53       op.Name = "FunctionLibraryInjector";
    54       SequentialProcessor seq = new SequentialProcessor();
    55       DefaultFunctionLibraryInjector funLibInjector = new DefaultFunctionLibraryInjector();
    56       seq.AddSubOperator(funLibInjector);
    57       seq.AddSubOperator(new ScalingTreeEvaluatorInjector());
    58       op.OperatorGraph.AddOperator(seq);
    59       op.OperatorGraph.InitialOperator = seq;
    60       return op;
    61     }
    62 
    63     protected override VariableInjector CreateGlobalInjector() {
    64       VariableInjector injector = base.CreateGlobalInjector();
    65       injector.AddVariable(new HeuristicLab.Core.Variable("MinTimeOffset", new IntData()));
    66       injector.AddVariable(new HeuristicLab.Core.Variable("MaxTimeOffset", new IntData()));
    67       return injector;
    6839    }
    6940
  • trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/3.3/StandardGPTimeSeriesPrognosis.cs

    r2821 r2843  
    3535    }
    3636
    37     public int MinTimeOffset {
    38       get { return GetVariableInjector().GetVariable("MinTimeOffset").GetValue<IntData>().Data; }
    39       set { GetVariableInjector().GetVariable("MinTimeOffset").GetValue<IntData>().Data = value; }
    40     }
    41 
    42     public int MaxTimeOffset {
    43       get { return GetVariableInjector().GetVariable("MaxTimeOffset").GetValue<IntData>().Data; }
    44       set { GetVariableInjector().GetVariable("MaxTimeOffset").GetValue<IntData>().Data = value; }
    45     }
    46 
    4737    protected override IOperator CreateProblemInjector() {
    4838      return DefaultTimeSeriesOperators.CreateProblemInjector();
    4939    }
    5040
    51     protected override IOperator CreateFunctionLibraryInjector() {
    52       CombinedOperator op = new CombinedOperator();
    53       op.Name = "FunctionLibraryInjector";
    54       SequentialProcessor seq = new SequentialProcessor();
    55       DefaultFunctionLibraryInjector funLibInjector = new DefaultFunctionLibraryInjector();
    56       seq.AddSubOperator(funLibInjector);
    57       seq.AddSubOperator(new ScalingTreeEvaluatorInjector());
    58       op.OperatorGraph.AddOperator(seq);
    59       op.OperatorGraph.InitialOperator = seq;
    60       return op;
    61     }
    62 
    6341    protected override IOperator CreateModelAnalyzerOperator() {
    6442      return DefaultTimeSeriesOperators.CreatePostProcessingOperator();
    65     }
    66 
    67     protected override VariableInjector CreateGlobalInjector() {
    68       VariableInjector injector = base.CreateGlobalInjector();
    69       injector.AddVariable(new HeuristicLab.Core.Variable("MinTimeOffset", new IntData()));
    70       injector.AddVariable(new HeuristicLab.Core.Variable("MaxTimeOffset", new IntData()));
    71       return injector;
    7243    }
    7344
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/FunctionLibraryInjectors/ArithmeticFunctionLibraryInjector.cs

    r2728 r2843  
    2929  [SymbolicRegressionFunctionLibraryInjector]
    3030  public class ArithmeticFunctionLibraryInjector : FunctionLibraryInjectorBase {
    31     public const string MINTIMEOFFSET = "MinTimeOffset";
    32     public const string MAXTIMEOFFSET = "MaxTimeOffset";
    33 
    34     private int minTimeOffset;
    35     private int maxTimeOffset;
    36 
    3731    public override string Description {
    3832      get { return @"Injects a function library with (+, -, *,  /) symbols."; }
    39     }
    40 
    41     public ArithmeticFunctionLibraryInjector()
    42       : base() {
    43       AddVariableInfo(new VariableInfo(MINTIMEOFFSET, "Minimal time offset for all features", typeof(IntData), VariableKind.In));
    44       AddVariableInfo(new VariableInfo(MAXTIMEOFFSET, "Maximal time offset for all feature", typeof(IntData), VariableKind.In));
    45     }
    46 
    47     public override IOperation Apply(IScope scope) {
    48       // try to get minTimeOffset (use 0 as default if not available)
    49       IItem minTimeOffsetItem = GetVariableValue(MINTIMEOFFSET, scope, true, false);
    50       minTimeOffset = minTimeOffsetItem == null ? 0 : ((IntData)minTimeOffsetItem).Data;
    51       // try to get maxTimeOffset (use 0 as default if not available)
    52       IItem maxTimeOffsetItem = GetVariableValue(MAXTIMEOFFSET, scope, true, false);
    53       maxTimeOffset = maxTimeOffsetItem == null ? 0 : ((IntData)maxTimeOffsetItem).Data;
    54 
    55       return base.Apply(scope);
    5633    }
    5734
     
    7855      doubleFunctions.ForEach(fun => functionLibrary.AddFunction(fun));
    7956
    80       variable.SetConstraints(minTimeOffset, maxTimeOffset);
    81       differential.SetConstraints(minTimeOffset, maxTimeOffset);
    82 
    8357      return functionLibrary;
    8458    }
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/FunctionLibraryInjectors/DefaultFunctionLibraryInjector.cs

    r2821 r2843  
    2929  [SymbolicRegressionFunctionLibraryInjector]
    3030  public class DefaultFunctionLibraryInjector : FunctionLibraryInjectorBase {
    31     public const string MINTIMEOFFSET = "MinTimeOffset";
    32     public const string MAXTIMEOFFSET = "MaxTimeOffset";
    33 
    34     private int minTimeOffset;
    35     private int maxTimeOffset;
    36 
    3731    public override string Description {
    3832      get { return @"Injects a default function library for regression and classification problems."; }
    39     }
    40 
    41     public DefaultFunctionLibraryInjector()
    42       : base() {
    43       AddVariableInfo(new VariableInfo(MINTIMEOFFSET, "Minimal time offset for all features", typeof(IntData), VariableKind.In));
    44       AddVariableInfo(new VariableInfo(MAXTIMEOFFSET, "Maximal time offset for all feature", typeof(IntData), VariableKind.In));
    45     }
    46 
    47     public override IOperation Apply(IScope scope) {
    48       // try to get minTimeOffset (use 0 as default if not available)
    49       IItem minTimeOffsetItem = GetVariableValue(MINTIMEOFFSET, scope, true, false);
    50       minTimeOffset = minTimeOffsetItem == null ? 0 : ((IntData)minTimeOffsetItem).Data;
    51       // try to get maxTimeOffset (use 0 as default if not available)
    52       IItem maxTimeOffsetItem = GetVariableValue(MAXTIMEOFFSET, scope, true, false);
    53       maxTimeOffset = maxTimeOffsetItem == null ? 0 : ((IntData)maxTimeOffsetItem).Data;
    54 
    55       return base.Apply(scope);
    5633    }
    5734
     
    12198      booleanFunctions.ForEach(fun => functionLibrary.AddFunction(fun));
    12299
    123       variable.SetConstraints(minTimeOffset, maxTimeOffset);
    124       differential.SetConstraints(minTimeOffset, maxTimeOffset);
    125 
    126100      return functionLibrary;
    127101    }
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/FunctionLibraryInjectors/SimpleFunctionLibraryInjector.cs

    r2728 r2843  
    2929  [SymbolicRegressionFunctionLibraryInjector]
    3030  public class SimpleFunctionLibraryInjector : FunctionLibraryInjectorBase {
    31     public const string MINTIMEOFFSET = "MinTimeOffset";
    32     public const string MAXTIMEOFFSET = "MaxTimeOffset";
    33 
    34     private int minTimeOffset;
    35     private int maxTimeOffset;
    36 
    3731    public override string Description {
    3832      get { return @"Injects a simple function library for regression and classification problems."; }
    3933    }
    4034
    41     public SimpleFunctionLibraryInjector()
    42       : base() {
    43       AddVariableInfo(new VariableInfo(MINTIMEOFFSET, "Minimal time offset for all features", typeof(IntData), VariableKind.In));
    44       AddVariableInfo(new VariableInfo(MAXTIMEOFFSET, "Maximal time offset for all feature", typeof(IntData), VariableKind.In));
     35    protected override FunctionLibrary CreateFunctionLibrary() {
     36      return Create();
    4537    }
    4638
    47     public override IOperation Apply(IScope scope) {
    48       // try to get minTimeOffset (use 0 as default if not available)
    49       IItem minTimeOffsetItem = GetVariableValue(MINTIMEOFFSET, scope, true, false);
    50       minTimeOffset = minTimeOffsetItem == null ? 0 : ((IntData)minTimeOffsetItem).Data;
    51       // try to get maxTimeOffset (use 0 as default if not available)
    52       IItem maxTimeOffsetItem = GetVariableValue(MAXTIMEOFFSET, scope, true, false);
    53       maxTimeOffset = maxTimeOffsetItem == null ? 0 : ((IntData)maxTimeOffsetItem).Data;
    54 
    55       return base.Apply(scope);
    56     }
    57 
    58     protected override FunctionLibrary CreateFunctionLibrary() {
    59       return Create(
    60         minTimeOffset,
    61         maxTimeOffset);
    62     }
    63 
    64     public static FunctionLibrary Create(int minTimeOffset, int maxTimeOffset) {
     39    public static FunctionLibrary Create() {
    6540      FunctionLibrary functionLibrary = new FunctionLibrary();
    6641
     
    11186      allFunctions.ForEach(x => functionLibrary.AddFunction(x));
    11287
    113       variable.SetConstraints(minTimeOffset, maxTimeOffset);
    114       differential.SetConstraints(minTimeOffset, maxTimeOffset);
    115 
    11688      return functionLibrary;
    11789    }
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/FunctionLibraryInjectors/UnconstrainedFunctionLibraryInjector.cs

    r2728 r2843  
    2929  [SymbolicRegressionFunctionLibraryInjector]
    3030  public class UnconstrainedFunctionLibraryInjector : FunctionLibraryInjectorBase {
    31     public const string MINTIMEOFFSET = "MinTimeOffset";
    32     public const string MAXTIMEOFFSET = "MaxTimeOffset";
    33 
    34     private int minTimeOffset;
    35     private int maxTimeOffset;
    36 
    3731    public override string Description {
    3832      get { return @"Injects a function library for regression and classification problems."; }
    39     }
    40 
    41     public UnconstrainedFunctionLibraryInjector()
    42       : base() {
    43       AddVariableInfo(new VariableInfo(MINTIMEOFFSET, "Minimal time offset for all features", typeof(IntData), VariableKind.In));
    44       AddVariableInfo(new VariableInfo(MAXTIMEOFFSET, "Maximal time offset for all feature", typeof(IntData), VariableKind.In));
    45     }
    46 
    47     public override IOperation Apply(IScope scope) {
    48       // try to get minTimeOffset (use 0 as default if not available)
    49       IItem minTimeOffsetItem = GetVariableValue(MINTIMEOFFSET, scope, true, false);
    50       minTimeOffset = minTimeOffsetItem == null ? 0 : ((IntData)minTimeOffsetItem).Data;
    51       // try to get maxTimeOffset (use 0 as default if not available)
    52       IItem maxTimeOffsetItem = GetVariableValue(MAXTIMEOFFSET, scope, true, false);
    53       maxTimeOffset = maxTimeOffsetItem == null ? 0 : ((IntData)maxTimeOffsetItem).Data;
    54 
    55       return base.Apply(scope);
    5633    }
    5734
     
    11390      doubleFunctions.ForEach(fun => functionLibrary.AddFunction(fun));
    11491
    115       variable.SetConstraints(minTimeOffset, maxTimeOffset);
    116       differential.SetConstraints(minTimeOffset, maxTimeOffset);
    117 
    11892      return functionLibrary;
    119     }
    120 
    121     private void ConditionalAddFunction(string condName, IFunction fun, List<IFunction> list) {
    122       if (GetVariableValue<BoolData>(condName, null, false).Data) list.Add(fun);
    123     }
    124 
    125     private void ConditionalAddOperator(string condName, FunctionLibrary functionLib, IFunction op) {
    126       if (GetVariableValue<BoolData>(condName, null, false).Data) functionLib.AddFunction(op);
    12793    }
    12894  }
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/HeuristicLab.GP.StructureIdentification-3.3.csproj

    r2750 r2843  
    112112    </Compile>
    113113    <Compile Include="StandardGPRegression.cs" />
     114    <Compile Include="Symbols\VariableView.cs">
     115      <SubType>UserControl</SubType>
     116    </Compile>
     117    <Compile Include="Symbols\VariableView.Designer.cs">
     118      <DependentUpon>VariableView.cs</DependentUpon>
     119    </Compile>
    114120    <Compile Include="VariableFrequencyAnalyser.cs" />
    115121    <Compile Include="Symbols\Addition.cs" />
     
    235241      <DependentUpon>PredictorView.cs</DependentUpon>
    236242    </EmbeddedResource>
     243    <EmbeddedResource Include="Symbols\VariableView.resx">
     244      <DependentUpon>VariableView.cs</DependentUpon>
     245    </EmbeddedResource>
    237246  </ItemGroup>
    238247  <ItemGroup>
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Differential.cs

    r2222 r2843  
    3636      return new VariableFunctionTree(this);
    3737    }
     38
     39    public override HeuristicLab.Core.IView CreateView() {
     40      return new VariableView(this);
     41    }
    3842  }
    3943}
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Variable.cs

    r2365 r2843  
    2424using HeuristicLab.Random;
    2525using HeuristicLab.Data;
     26using System.Xml;
    2627
    2728namespace HeuristicLab.GP.StructureIdentification {
     
    3233
    3334    private int minOffset;
     35    public int MinTimeOffset {
     36      get {
     37        return minOffset;
     38      }
     39      set {
     40        if (value != minOffset) {
     41          minOffset = value;
     42          SetupInitialization();
     43          SetupManipulation();
     44        }
     45      }
     46    }
     47
    3448    private int maxOffset;
     49    public int MaxTimeOffset {
     50      get {
     51        return maxOffset;
     52      }
     53      set {
     54        if (value != maxOffset) {
     55          maxOffset = value;
     56          SetupManipulation();
     57          SetupInitialization();
     58        }
     59      }
     60    }
    3561
    3662    public override string Description {
     
    116142    }
    117143
    118     public void SetConstraints(int minSampleOffset, int maxSampleOffset) {
    119       this.minOffset = minSampleOffset;
    120       this.maxOffset = maxSampleOffset;
    121       SetupInitialization();
    122       SetupManipulation();
     144    public override HeuristicLab.Core.IView CreateView() {
     145      return new VariableView(this);
    123146    }
     147
     148    #region persistence
     149    public override object Clone(System.Collections.Generic.IDictionary<System.Guid, object> clonedObjects) {
     150      Variable clone = (Variable)base.Clone(clonedObjects);
     151      clone.MaxTimeOffset = MaxTimeOffset;
     152      clone.MinTimeOffset = MinTimeOffset;
     153      return clone;
     154    }
     155    public override System.Xml.XmlNode GetXmlNode(string name, System.Xml.XmlDocument document, System.Collections.Generic.IDictionary<System.Guid, HeuristicLab.Core.IStorable> persistedObjects) {
     156      XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     157      var minTimeOffsetAttr = document.CreateAttribute("MinTimeOffset");
     158      minTimeOffsetAttr.Value = MinTimeOffset.ToString();
     159      var maxTimeOffsetAttr = document.CreateAttribute("MaxTimeOffset");
     160      maxTimeOffsetAttr.Value = MaxTimeOffset.ToString();
     161      node.Attributes.Append(minTimeOffsetAttr);
     162      node.Attributes.Append(maxTimeOffsetAttr);
     163      return node;
     164    }
     165    public override void Populate(System.Xml.XmlNode node, System.Collections.Generic.IDictionary<System.Guid, HeuristicLab.Core.IStorable> restoredObjects) {
     166      base.Populate(node, restoredObjects);
     167      MinTimeOffset = XmlConvert.ToInt32(node.Attributes["MinTimeOffset"].Value);
     168      MaxTimeOffset = XmlConvert.ToInt32(node.Attributes["MaxTimeOffset"].Value);
     169    }
     170    #endregion
    124171  }
    125172}
  • trunk/sources/HeuristicLab.GP.Tests/NetworkFunctionLibraryTest.cs

    r2822 r2843  
    5757      MersenneTwister twister = new MersenneTwister();
    5858      Dataset ds = Util.CreateRandomDataset(twister, 1, 20);
    59       randomTrees = Util.CreateRandomTrees(twister, ds, FunctionLibraryInjector.Create(-3, 0), N, 1, 100);
     59      randomTrees = Util.CreateRandomTrees(twister, ds, FunctionLibraryInjector.Create(), N, 1, 100);
    6060    }
    6161
  • trunk/sources/HeuristicLab.GP.Tests/NetworkToFunctionTransformerTest.cs

    r2822 r2843  
    330330      MersenneTwister twister = new MersenneTwister();
    331331      Dataset ds = Util.CreateRandomDataset(twister, 1, 20);
    332       IFunctionTree[] randomTrees = Util.CreateRandomTrees(twister, ds, FunctionLibraryInjector.Create(0, 0), 1000, 1, 100);
     332      IFunctionTree[] randomTrees = Util.CreateRandomTrees(twister, ds, FunctionLibraryInjector.Create(), 1000, 1, 100);
    333333      foreach (var tree in randomTrees) {
    334334        IEnumerable<IFunctionTree> actualTrees = NetworkToFunctionTransformer_Accessor.Transform(tree, new List<string>() { "a", "b", "c" });
  • trunk/sources/HeuristicLab.GP.Tests/SimpleFunctionLibraryTest.cs

    r2728 r2843  
    5656      MersenneTwister twister = new MersenneTwister();
    5757      Dataset ds = Util.CreateRandomDataset(twister, 1, 20);
    58       randomTrees = Util.CreateRandomTrees(twister, ds, SimpleFunctionLibraryInjector.Create(-3, 0), N, 1, 100);
     58      randomTrees = Util.CreateRandomTrees(twister, ds, SimpleFunctionLibraryInjector.Create(), N, 1, 100);
    5959    }
    6060
  • trunk/sources/HeuristicLab.GP.Tests/Util.cs

    r2616 r2843  
    153153      functionLibrary.AddFunction(xor);
    154154
    155       variable.SetConstraints(0, 0);
    156       differential.SetConstraints(0, 0);
     155      variable.MinTimeOffset = variable.MaxTimeOffset = 0;
     156      differential.MinTimeOffset = differential.MaxTimeOffset = 0;
    157157
    158158      return functionLibrary;
  • trunk/sources/HeuristicLab.GP/3.3/BaseClasses/FunctionLibraryInjectorBase.cs

    r2729 r2843  
    3333
    3434    public override string Description {
    35       get { return @"Descrption is missing."; }
     35      get { return @"Description is missing."; }
    3636    }
    3737
     
    5555
    5656    public override IOperation Apply(IScope scope) {
    57       scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName(FUNCTIONLIBRARY), functionLibrary));
     57      scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName(FUNCTIONLIBRARY), (FunctionLibrary)functionLibrary.Clone()));
    5858      return null;
    5959    }
  • trunk/sources/HeuristicLab.GP/3.3/FunctionView.Designer.cs

    r2729 r2843  
    335335    #endregion
    336336
    337     private System.Windows.Forms.GroupBox groupBox;
    338     private System.Windows.Forms.TextBox minSubTreesTextBox;
    339     private System.Windows.Forms.Label label1;
    340     private System.Windows.Forms.TextBox nameTextBox;
    341     private System.Windows.Forms.Label nameLabel;
    342     private System.Windows.Forms.TextBox maxSubTreesTextBox;
    343     private System.Windows.Forms.Label label2;
    344     private System.Windows.Forms.TextBox minTreeSizeTextBox;
    345     private System.Windows.Forms.Label label3;
    346     private System.Windows.Forms.TextBox minTreeHeightTextBox;
    347     private System.Windows.Forms.Label label4;
    348     private System.Windows.Forms.TextBox ticketsTextBox;
    349     private System.Windows.Forms.Label label5;
    350     private System.Windows.Forms.ListBox subFunctionsListBox;
    351     private System.Windows.Forms.Label label7;
    352     private System.Windows.Forms.Button editManipulatorButton;
    353     private System.Windows.Forms.TextBox manipulatorTextBox;
    354     private System.Windows.Forms.TextBox initializerTextBox;
    355     private System.Windows.Forms.Button editInitializerButton;
    356     private System.Windows.Forms.Label label8;
    357     private System.Windows.Forms.ComboBox argumentComboBox;
    358     private System.Windows.Forms.GroupBox subTreesGroupBox;
    359     private System.Windows.Forms.Label label6;
    360     private System.Windows.Forms.ErrorProvider functionPropertiesErrorProvider;
     337    protected System.Windows.Forms.GroupBox groupBox;
     338    protected System.Windows.Forms.TextBox minSubTreesTextBox;
     339    protected System.Windows.Forms.Label label1;
     340    protected System.Windows.Forms.TextBox nameTextBox;
     341    protected System.Windows.Forms.Label nameLabel;
     342    protected System.Windows.Forms.TextBox maxSubTreesTextBox;
     343    protected System.Windows.Forms.Label label2;
     344    protected System.Windows.Forms.TextBox minTreeSizeTextBox;
     345    protected System.Windows.Forms.Label label3;
     346    protected System.Windows.Forms.TextBox minTreeHeightTextBox;
     347    protected System.Windows.Forms.Label label4;
     348    protected System.Windows.Forms.TextBox ticketsTextBox;
     349    protected System.Windows.Forms.Label label5;
     350    protected System.Windows.Forms.ListBox subFunctionsListBox;
     351    protected System.Windows.Forms.Label label7;
     352    protected System.Windows.Forms.Button editManipulatorButton;
     353    protected System.Windows.Forms.TextBox manipulatorTextBox;
     354    protected System.Windows.Forms.TextBox initializerTextBox;
     355    protected System.Windows.Forms.Button editInitializerButton;
     356    protected System.Windows.Forms.Label label8;
     357    protected System.Windows.Forms.ComboBox argumentComboBox;
     358    protected System.Windows.Forms.GroupBox subTreesGroupBox;
     359    protected System.Windows.Forms.Label label6;
     360    protected System.Windows.Forms.ErrorProvider functionPropertiesErrorProvider;
     361
    361362
    362363  }
  • trunk/sources/HeuristicLab.GP/3.3/FunctionView.cs

    r2729 r2843  
    3030namespace HeuristicLab.GP {
    3131  public partial class FunctionView : ViewBase {
    32     private Function function;
     32
    3333    private const string ALL_SLOTS = "All";
    3434    private string selectedSlot = ALL_SLOTS;
    3535
    36     public FunctionView() {
     36    public Function Function {
     37      get {
     38        return (Function)Item;
     39      }
     40      set {
     41        Item = value;
     42      }
     43    }
     44
     45    public FunctionView()
     46      : base() {
    3747      InitializeComponent();
    3848    }
    3949
    4050    public FunctionView(Function function)
    41       : this() {
    42       this.function = function;
    43       function.Changed += (sender, args) => UpdateControls();
    44       Refresh();
     51      : base() {
     52      InitializeComponent();
     53      Function = function;
     54      UpdateControls();
    4555    }
    4656
    4757    protected override void UpdateControls() {
    48       nameTextBox.Text = function.Name;
    49       minSubTreesTextBox.Text = function.MinSubTrees.ToString();
    50       maxSubTreesTextBox.Text = function.MaxSubTrees.ToString();
    51       ticketsTextBox.Text = function.Tickets.ToString();
    52       minTreeHeightTextBox.Text = function.MinTreeHeight.ToString();
    53       minTreeSizeTextBox.Text = function.MinTreeSize.ToString();
    54       if (function.Initializer != null) {
    55         initializerTextBox.Text = function.Initializer.Name;
     58      nameTextBox.Text = Function.Name;
     59      minSubTreesTextBox.Text = Function.MinSubTrees.ToString();
     60      maxSubTreesTextBox.Text = Function.MaxSubTrees.ToString();
     61      ticketsTextBox.Text = Function.Tickets.ToString();
     62      minTreeHeightTextBox.Text = Function.MinTreeHeight.ToString();
     63      minTreeSizeTextBox.Text = Function.MinTreeSize.ToString();
     64      if (Function.Initializer != null) {
     65        initializerTextBox.Text = Function.Initializer.Name;
    5666      } else {
    5767        initializerTextBox.Enabled = false;
    5868        editInitializerButton.Enabled = false;
    5969      }
    60       if (function.Manipulator != null) {
    61         manipulatorTextBox.Text = function.Manipulator.Name;
     70      if (Function.Manipulator != null) {
     71        manipulatorTextBox.Text = Function.Manipulator.Name;
    6272      } else {
    6373        manipulatorTextBox.Enabled = false;
     
    6777      argumentComboBox.Items.Clear();
    6878      argumentComboBox.Items.Add(ALL_SLOTS);
    69       for (int i = 0; i < function.MaxSubTrees; i++) {
     79      for (int i = 0; i < Function.MaxSubTrees; i++) {
    7080        argumentComboBox.Items.Add(i.ToString());
    7181      }
     
    7585
    7686    private void UpdateAllowedSubFunctionsList() {
    77       if (function.MaxSubTrees > 0) {
     87      if (Function.MaxSubTrees > 0) {
    7888        subFunctionsListBox.Items.Clear();
    7989        if (selectedSlot == ALL_SLOTS) {
    80           IEnumerable<IFunction> functionSet = function.GetAllowedSubFunctions(0);
    81           for (int i = 1; i < function.MaxSubTrees; i++) {
    82             functionSet = functionSet.Intersect(function.GetAllowedSubFunctions(i));
     90          IEnumerable<IFunction> functionSet = Function.GetAllowedSubFunctions(0);
     91          for (int i = 1; i < Function.MaxSubTrees; i++) {
     92            functionSet = functionSet.Intersect(Function.GetAllowedSubFunctions(i));
    8393          }
    8494          foreach (var subFun in functionSet) {
     
    8797        } else {
    8898          int slot = int.Parse(selectedSlot);
    89           foreach (var subFun in function.GetAllowedSubFunctions(slot)) {
     99          foreach (var subFun in Function.GetAllowedSubFunctions(slot)) {
    90100            subFunctionsListBox.Items.Add(subFun);
    91101          }
     
    100110      string name = nameTextBox.Text;
    101111      if (!string.IsNullOrEmpty(name)) {
    102         function.Name = name;
     112        Function.Name = name;
    103113        functionPropertiesErrorProvider.SetError(nameTextBox, string.Empty);
    104114      } else {
     
    110120      int minSubTrees;
    111121      if (int.TryParse(minSubTreesTextBox.Text, out minSubTrees) && minSubTrees >= 0) {
    112         function.MinSubTrees = minSubTrees;
     122        Function.MinSubTrees = minSubTrees;
    113123        functionPropertiesErrorProvider.SetError(minSubTreesTextBox, string.Empty);
    114124      } else {
     
    120130      int maxSubTrees;
    121131      if (int.TryParse(maxSubTreesTextBox.Text, out maxSubTrees) && maxSubTrees >= 0) {
    122         function.MaxSubTrees = maxSubTrees;
     132        Function.MaxSubTrees = maxSubTrees;
    123133        functionPropertiesErrorProvider.SetError(maxSubTreesTextBox, string.Empty);
    124134      } else {
     
    130140      double tickets;
    131141      if (double.TryParse(ticketsTextBox.Text, out tickets) && tickets >= 0) {
    132         function.Tickets = tickets;
     142        Function.Tickets = tickets;
    133143        functionPropertiesErrorProvider.SetError(ticketsTextBox, string.Empty);
    134144      } else {
     
    138148
    139149    private void editInitializerButton_Click(object sender, EventArgs e) {
    140       ControlManager.Manager.ShowControl(function.Initializer.CreateView());
     150      ControlManager.Manager.ShowControl(Function.Initializer.CreateView());
    141151    }
    142152
    143153    private void editManipulatorButton_Click(object sender, EventArgs e) {
    144       ControlManager.Manager.ShowControl(function.Manipulator.CreateView());
     154      ControlManager.Manager.ShowControl(Function.Manipulator.CreateView());
    145155    }
    146156
     
    168178            Cursor = Cursors.WaitCursor;
    169179            if (selectedSlot == ALL_SLOTS) {
    170               for (int slot = 0; slot < function.MaxSubTrees; slot++)
    171                 function.AddAllowedSubFunction(fun, slot);
     180              for (int slot = 0; slot < Function.MaxSubTrees; slot++)
     181                Function.AddAllowedSubFunction(fun, slot);
    172182            } else {
    173183              int slot = int.Parse(selectedSlot);
    174               function.AddAllowedSubFunction(fun, slot);
     184              Function.AddAllowedSubFunction(fun, slot);
    175185            }
    176186          }
     
    188198          if (selectedSlot == ALL_SLOTS) {
    189199            List<IFunction> removedSubFunctions = new List<IFunction>(subFunctionsListBox.SelectedItems.Cast<IFunction>());
    190             for (int slot = 0; slot < function.MaxSubTrees; slot++) {
     200            for (int slot = 0; slot < Function.MaxSubTrees; slot++) {
    191201              foreach (var subFun in removedSubFunctions) {
    192                 function.RemoveAllowedSubFunction((IFunction)subFun, slot);
     202                Function.RemoveAllowedSubFunction((IFunction)subFun, slot);
    193203              }
    194204            }
     
    197207            List<IFunction> removedSubFunctions = new List<IFunction>(subFunctionsListBox.SelectedItems.Cast<IFunction>());
    198208            foreach (var subFun in removedSubFunctions) {
    199               function.RemoveAllowedSubFunction(subFun, slot);
     209              Function.RemoveAllowedSubFunction(subFun, slot);
    200210            }
    201211          }
  • trunk/sources/HeuristicLab.LinearRegression/3.2/LinearRegressionOperator.cs

    r2789 r2843  
    114114      int p = inputMatrix.GetLength(1);
    115115      // no features allowed -> return constant offset
    116       if (p == 0) return new double[] { Statistics.Mean(targetVector) };
     116      if (p <= 1) return new double[] { Statistics.Mean(targetVector) };
    117117      double[,] dataset = new double[n, p];
    118118      for (int row = 0; row < n; row++) {
  • trunk/sources/HeuristicLab.Modeling/3.2/ITimeSeriesAlgorithm.cs

    r2366 r2843  
    2727namespace HeuristicLab.Modeling {
    2828  public interface ITimeSeriesAlgorithm : IAlgorithm {
    29     int MinTimeOffset { get; set; }
    30     int MaxTimeOffset { get; set; }
    3129  }
    3230}
Note: See TracChangeset for help on using the changeset viewer.