Changeset 2843
- Timestamp:
- 02/19/10 18:49:17 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 3 added
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.CEDMA.Server/3.3/DispatcherView.Designer.cs
r2824 r2843 24 24 /// </summary> 25 25 private void InitializeComponent() { 26 this.components = new System.ComponentModel.Container(); 26 27 this.targetVariableList = new System.Windows.Forms.CheckedListBox(); 27 28 this.inputVariableList = new System.Windows.Forms.CheckedListBox(); … … 30 31 this.splitContainer = new System.Windows.Forms.SplitContainer(); 31 32 this.learningTaskGroupBox = new System.Windows.Forms.GroupBox(); 33 this.editEngineButton = new System.Windows.Forms.Button(); 32 34 this.setAlgorithmDefault = new System.Windows.Forms.Button(); 33 35 this.autoregressiveLabel = new System.Windows.Forms.Label(); 34 36 this.classificationRadioButton = new System.Windows.Forms.RadioButton(); 35 37 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();39 38 this.regressionRadioButton = new System.Windows.Forms.RadioButton(); 40 this.maxTimeOffsetTextBox = new System.Windows.Forms.TextBox();41 39 this.timeSeriesRadioButton = new System.Windows.Forms.RadioButton(); 42 40 this.autoregressiveCheckBox = new System.Windows.Forms.CheckBox(); … … 52 50 this.testLabel = new System.Windows.Forms.Label(); 53 51 this.setAllButton = new System.Windows.Forms.Button(); 54 this.e ditEngineButton = new System.Windows.Forms.Button();52 this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components); 55 53 this.splitContainer.Panel1.SuspendLayout(); 56 54 this.splitContainer.Panel2.SuspendLayout(); … … 58 56 this.learningTaskGroupBox.SuspendLayout(); 59 57 this.partitioningGroupBox.SuspendLayout(); 58 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 60 59 this.SuspendLayout(); 61 60 // … … 136 135 this.learningTaskGroupBox.Controls.Add(this.classificationRadioButton); 137 136 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);141 137 this.learningTaskGroupBox.Controls.Add(this.regressionRadioButton); 142 this.learningTaskGroupBox.Controls.Add(this.maxTimeOffsetTextBox);143 138 this.learningTaskGroupBox.Controls.Add(this.timeSeriesRadioButton); 144 139 this.learningTaskGroupBox.Controls.Add(this.autoregressiveCheckBox); … … 146 141 this.learningTaskGroupBox.Location = new System.Drawing.Point(6, 236); 147 142 this.learningTaskGroupBox.Name = "learningTaskGroupBox"; 148 this.learningTaskGroupBox.Size = new System.Drawing.Size(343, 3 21);143 this.learningTaskGroupBox.Size = new System.Drawing.Size(343, 341); 149 144 this.learningTaskGroupBox.TabIndex = 36; 150 145 this.learningTaskGroupBox.TabStop = false; 151 146 this.learningTaskGroupBox.Text = "Learning task"; 152 147 // 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 // 153 159 // setAlgorithmDefault 154 160 // 155 161 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); 157 163 this.setAlgorithmDefault.Name = "setAlgorithmDefault"; 158 164 this.setAlgorithmDefault.Size = new System.Drawing.Size(96, 23); … … 191 197 this.algorithmsListBox.FormattingEnabled = true; 192 198 this.algorithmsListBox.HorizontalScrollbar = true; 193 this.algorithmsListBox.Location = new System.Drawing.Point(6, 1 55);199 this.algorithmsListBox.Location = new System.Drawing.Point(6, 110); 194 200 this.algorithmsListBox.Name = "algorithmsListBox"; 195 this.algorithmsListBox.Size = new System.Drawing.Size(331, 1 24);201 this.algorithmsListBox.Size = new System.Drawing.Size(331, 184); 196 202 this.algorithmsListBox.TabIndex = 4; 197 203 this.algorithmsListBox.SelectedIndexChanged += new System.EventHandler(this.algorithmsListBox_SelectedIndexChanged); 198 204 this.algorithmsListBox.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.algorithmsListBox_ItemCheck); 199 //200 // minTimeOffsetLabel201 //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 // minTimeOffsetTextBox211 //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 // maxTimeOffsetLabel221 //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:";229 205 // 230 206 // regressionRadioButton … … 238 214 this.regressionRadioButton.UseVisualStyleBackColor = true; 239 215 this.regressionRadioButton.CheckedChanged += new System.EventHandler(this.radioButton_CheckedChanged); 240 //241 // maxTimeOffsetTextBox242 //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);250 216 // 251 217 // timeSeriesRadioButton … … 285 251 this.partitioningGroupBox.Controls.Add(this.testLabel); 286 252 this.partitioningGroupBox.Enabled = false; 287 this.partitioningGroupBox.Location = new System.Drawing.Point(6, 5 63);253 this.partitioningGroupBox.Location = new System.Drawing.Point(6, 583); 288 254 this.partitioningGroupBox.Name = "partitioningGroupBox"; 289 this.partitioningGroupBox.Size = new System.Drawing.Size(343, 1 22);255 this.partitioningGroupBox.Size = new System.Drawing.Size(343, 102); 290 256 this.partitioningGroupBox.TabIndex = 26; 291 257 this.partitioningGroupBox.TabStop = false; … … 294 260 // validationSamplesEndTextBox 295 261 // 296 this.validationSamplesEndTextBox.Location = new System.Drawing.Point(22 1, 43);262 this.validationSamplesEndTextBox.Location = new System.Drawing.Point(222, 45); 297 263 this.validationSamplesEndTextBox.Name = "validationSamplesEndTextBox"; 298 264 this.validationSamplesEndTextBox.Size = new System.Drawing.Size(96, 20); … … 304 270 // 305 271 this.trainingLabel.AutoSize = true; 306 this.trainingLabel.Location = new System.Drawing.Point(1 3, 20);272 this.trainingLabel.Location = new System.Drawing.Point(14, 22); 307 273 this.trainingLabel.Name = "trainingLabel"; 308 274 this.trainingLabel.Size = new System.Drawing.Size(89, 13); … … 312 278 // trainingSamplesStartTextBox 313 279 // 314 this.trainingSamplesStartTextBox.Location = new System.Drawing.Point(1 19, 17);280 this.trainingSamplesStartTextBox.Location = new System.Drawing.Point(120, 19); 315 281 this.trainingSamplesStartTextBox.Name = "trainingSamplesStartTextBox"; 316 282 this.trainingSamplesStartTextBox.Size = new System.Drawing.Size(96, 20); … … 321 287 // trainingSamplesEndTextBox 322 288 // 323 this.trainingSamplesEndTextBox.Location = new System.Drawing.Point(22 1, 17);289 this.trainingSamplesEndTextBox.Location = new System.Drawing.Point(222, 19); 324 290 this.trainingSamplesEndTextBox.Name = "trainingSamplesEndTextBox"; 325 291 this.trainingSamplesEndTextBox.Size = new System.Drawing.Size(96, 20); … … 331 297 // 332 298 this.validationLabel.AutoSize = true; 333 this.validationLabel.Location = new System.Drawing.Point( 5, 46);299 this.validationLabel.Location = new System.Drawing.Point(6, 48); 334 300 this.validationLabel.Name = "validationLabel"; 335 301 this.validationLabel.Size = new System.Drawing.Size(97, 13); … … 339 305 // testSamplesEndTextBox 340 306 // 341 this.testSamplesEndTextBox.Location = new System.Drawing.Point(22 1, 68);307 this.testSamplesEndTextBox.Location = new System.Drawing.Point(222, 70); 342 308 this.testSamplesEndTextBox.Name = "testSamplesEndTextBox"; 343 309 this.testSamplesEndTextBox.Size = new System.Drawing.Size(96, 20); … … 348 314 // validationSamplesStartTextBox 349 315 // 350 this.validationSamplesStartTextBox.Location = new System.Drawing.Point(1 19, 43);316 this.validationSamplesStartTextBox.Location = new System.Drawing.Point(120, 45); 351 317 this.validationSamplesStartTextBox.Name = "validationSamplesStartTextBox"; 352 318 this.validationSamplesStartTextBox.Size = new System.Drawing.Size(96, 20); … … 357 323 // testSamplesStartTextBox 358 324 // 359 this.testSamplesStartTextBox.Location = new System.Drawing.Point(1 19, 68);325 this.testSamplesStartTextBox.Location = new System.Drawing.Point(120, 70); 360 326 this.testSamplesStartTextBox.Name = "testSamplesStartTextBox"; 361 327 this.testSamplesStartTextBox.Size = new System.Drawing.Size(96, 20); … … 367 333 // 368 334 this.testLabel.AutoSize = true; 369 this.testLabel.Location = new System.Drawing.Point(3 0, 71);335 this.testLabel.Location = new System.Drawing.Point(31, 73); 370 336 this.testLabel.Name = "testLabel"; 371 337 this.testLabel.Size = new System.Drawing.Size(72, 13); … … 384 350 this.setAllButton.Click += new System.EventHandler(this.setAllButton_Click); 385 351 // 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; 395 355 // 396 356 // DispatcherView … … 410 370 this.partitioningGroupBox.ResumeLayout(false); 411 371 this.partitioningGroupBox.PerformLayout(); 372 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 412 373 this.ResumeLayout(false); 413 374 … … 436 397 private System.Windows.Forms.Label autoregressiveLabel; 437 398 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;441 399 private System.Windows.Forms.RadioButton regressionRadioButton; 442 private System.Windows.Forms.TextBox maxTimeOffsetTextBox;443 400 private System.Windows.Forms.RadioButton timeSeriesRadioButton; 444 401 private System.Windows.Forms.CheckBox autoregressiveCheckBox; 445 402 private System.Windows.Forms.Button setAlgorithmDefault; 446 403 private System.Windows.Forms.Button editEngineButton; 404 private System.Windows.Forms.ErrorProvider errorProvider; 447 405 } 448 406 } -
trunk/sources/HeuristicLab.CEDMA.Server/3.3/DispatcherView.cs
r2824 r2843 102 102 testSamplesStartTextBox.Text = selectedSpec.TestSamplesStart.ToString(); 103 103 testSamplesEndTextBox.Text = selectedSpec.TestSamplesEnd.ToString(); 104 minTimeOffsetTextBox.Text = selectedSpec.MinTimeOffset.ToString();105 maxTimeOffsetTextBox.Text = selectedSpec.MaxTimeOffset.ToString();106 104 autoregressiveCheckBox.Checked = selectedSpec.AutoRegressive; 107 105 } … … 136 134 ProblemSpecification spec = dispatcher.GetProblemSpecification(targetVar); 137 135 spec.LearningTask = selectedSpec.LearningTask; 138 spec.MinTimeOffset = selectedSpec.MinTimeOffset;139 spec.MaxTimeOffset = selectedSpec.MaxTimeOffset;140 136 spec.AutoRegressive = selectedSpec.AutoRegressive; 141 137 var curAllowedAlgos = dispatcher.GetAllowedAlgorithms(targetVar).ToList(); … … 157 153 158 154 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;163 155 autoregressiveCheckBox.Enabled = timeSeriesRadioButton.Checked; 164 156 autoregressiveLabel.Enabled = timeSeriesRadioButton.Checked; … … 171 163 } 172 164 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);185 165 } 186 166 … … 255 235 editEngineButton.Enabled = algorithmsListBox.SelectedItems.Count > 0; 256 236 } 257 258 237 } 259 238 } -
trunk/sources/HeuristicLab.CEDMA.Server/3.3/DispatcherView.resx
r2088 r2843 118 118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 119 119 </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> 120 123 </root> -
trunk/sources/HeuristicLab.CEDMA.Server/3.3/ProblemSpecification.cs
r2422 r2843 83 83 } 84 84 85 public int MaxTimeOffset { get; set; }86 public int MinTimeOffset { get; set; }87 88 85 public bool AutoRegressive { get; set; } 89 86 … … 108 105 LearningTask = original.LearningTask; 109 106 TargetVariable = original.TargetVariable; 110 MinTimeOffset = original.MinTimeOffset;111 MaxTimeOffset = original.MaxTimeOffset;112 107 AutoRegressive = original.AutoRegressive; 113 108 TrainingSamplesStart = original.TrainingSamplesStart; … … 134 129 return 135 130 other.LearningTask == LearningTask && 136 other.MinTimeOffset == MinTimeOffset &&137 other.MaxTimeOffset == MaxTimeOffset &&138 131 other.AutoRegressive == AutoRegressive && 139 132 other.TargetVariable == TargetVariable && … … 156 149 LearningTask.GetHashCode() | 157 150 TargetVariable.GetHashCode() | 158 MinTimeOffset.GetHashCode() |159 MaxTimeOffset.GetHashCode() |160 151 AutoRegressive.GetHashCode() | 161 152 TrainingSamplesStart.GetHashCode() | -
trunk/sources/HeuristicLab.CEDMA.Server/3.3/SimpleDispatcher.cs
r2825 r2843 106 106 private object locker = new object(); 107 107 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 108 124 public SimpleDispatcher(IModelingDatabase database, Dataset dataset) { 109 125 this.dataset = dataset; … … 117 133 finishedAndDispatchedRuns = new Dictionary<string, List<AlgorithmConfiguration>>(); 118 134 119 135 120 136 defaultAlgorithms = ApplicationManager.Manager.GetInstances<HeuristicLab.Modeling.IAlgorithm>().ToArray(); 137 138 TrainingSetPercentageSize = 0.5; 139 SkippedRowsBeginning = 2; 121 140 122 141 // PopulateFinishedRuns(); … … 190 209 191 210 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 196 212 if (spec.AutoRegressive) { 197 213 allowedFeatures.Add(spec.TargetVariable); … … 255 271 if (!(double.IsNaN(x) || double.IsInfinity(x))) break; 256 272 } 273 firstValueIndex += SkippedRowsBeginning; 257 274 // find index of last correct target value 258 275 int lastValueIndex; … … 261 278 if (!(double.IsNaN(x) || double.IsInfinity(x))) break; 262 279 } 280 lastValueIndex -= SkippedRowsEnd; 263 281 264 282 int validTargetRange = lastValueIndex - firstValueIndex; 265 283 spec.TrainingSamplesStart = firstValueIndex; 266 spec.TrainingSamplesEnd = firstValueIndex + (int)Math.Floor(validTargetRange * 0.5);284 spec.TrainingSamplesEnd = firstValueIndex + (int)Math.Floor(validTargetRange * TrainingSetPercentageSize); 267 285 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); 269 287 spec.TestSamplesStart = spec.ValidationSamplesEnd; 270 288 spec.TestSamplesEnd = lastValueIndex; -
trunk/sources/HeuristicLab.GP.StructureIdentification.Networks/3.2/FunctionLibraryInjector.cs
r2821 r2843 28 28 namespace HeuristicLab.GP.StructureIdentification.Networks { 29 29 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;37 30 38 31 public override string Description { … … 40 33 } 41 34 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(); 48 37 } 49 38 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() { 72 40 FunctionLibrary functionLibrary = new FunctionLibrary(); 73 41 … … 147 115 f2Functions.ForEach(x => functionLibrary.AddFunction(x)); 148 116 149 variable.SetConstraints(minTimeOffset, maxTimeOffset); 150 differential.SetConstraints(minTimeOffset, maxTimeOffset); 151 openPar.SetConstraints(minTimeOffset, maxTimeOffset); 117 openPar.SetConstraints(0, 0); 152 118 153 119 -
trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/3.3/OffspringSelectionGPTimeSeriesPrognosis.cs
r2821 r2843 35 35 } 36 36 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 47 37 protected override IOperator CreateProblemInjector() { 48 38 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;68 39 } 69 40 -
trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/3.3/StandardGPTimeSeriesPrognosis.cs
r2821 r2843 35 35 } 36 36 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 47 37 protected override IOperator CreateProblemInjector() { 48 38 return DefaultTimeSeriesOperators.CreateProblemInjector(); 49 39 } 50 40 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 41 protected override IOperator CreateModelAnalyzerOperator() { 64 42 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;72 43 } 73 44 -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/FunctionLibraryInjectors/ArithmeticFunctionLibraryInjector.cs
r2728 r2843 29 29 [SymbolicRegressionFunctionLibraryInjector] 30 30 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 37 31 public override string Description { 38 32 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);56 33 } 57 34 … … 78 55 doubleFunctions.ForEach(fun => functionLibrary.AddFunction(fun)); 79 56 80 variable.SetConstraints(minTimeOffset, maxTimeOffset);81 differential.SetConstraints(minTimeOffset, maxTimeOffset);82 83 57 return functionLibrary; 84 58 } -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/FunctionLibraryInjectors/DefaultFunctionLibraryInjector.cs
r2821 r2843 29 29 [SymbolicRegressionFunctionLibraryInjector] 30 30 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 37 31 public override string Description { 38 32 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);56 33 } 57 34 … … 121 98 booleanFunctions.ForEach(fun => functionLibrary.AddFunction(fun)); 122 99 123 variable.SetConstraints(minTimeOffset, maxTimeOffset);124 differential.SetConstraints(minTimeOffset, maxTimeOffset);125 126 100 return functionLibrary; 127 101 } -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/FunctionLibraryInjectors/SimpleFunctionLibraryInjector.cs
r2728 r2843 29 29 [SymbolicRegressionFunctionLibraryInjector] 30 30 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 37 31 public override string Description { 38 32 get { return @"Injects a simple function library for regression and classification problems."; } 39 33 } 40 34 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(); 45 37 } 46 38 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() { 65 40 FunctionLibrary functionLibrary = new FunctionLibrary(); 66 41 … … 111 86 allFunctions.ForEach(x => functionLibrary.AddFunction(x)); 112 87 113 variable.SetConstraints(minTimeOffset, maxTimeOffset);114 differential.SetConstraints(minTimeOffset, maxTimeOffset);115 116 88 return functionLibrary; 117 89 } -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/FunctionLibraryInjectors/UnconstrainedFunctionLibraryInjector.cs
r2728 r2843 29 29 [SymbolicRegressionFunctionLibraryInjector] 30 30 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 37 31 public override string Description { 38 32 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);56 33 } 57 34 … … 113 90 doubleFunctions.ForEach(fun => functionLibrary.AddFunction(fun)); 114 91 115 variable.SetConstraints(minTimeOffset, maxTimeOffset);116 differential.SetConstraints(minTimeOffset, maxTimeOffset);117 118 92 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);127 93 } 128 94 } -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/HeuristicLab.GP.StructureIdentification-3.3.csproj
r2750 r2843 112 112 </Compile> 113 113 <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> 114 120 <Compile Include="VariableFrequencyAnalyser.cs" /> 115 121 <Compile Include="Symbols\Addition.cs" /> … … 235 241 <DependentUpon>PredictorView.cs</DependentUpon> 236 242 </EmbeddedResource> 243 <EmbeddedResource Include="Symbols\VariableView.resx"> 244 <DependentUpon>VariableView.cs</DependentUpon> 245 </EmbeddedResource> 237 246 </ItemGroup> 238 247 <ItemGroup> -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Differential.cs
r2222 r2843 36 36 return new VariableFunctionTree(this); 37 37 } 38 39 public override HeuristicLab.Core.IView CreateView() { 40 return new VariableView(this); 41 } 38 42 } 39 43 } -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Variable.cs
r2365 r2843 24 24 using HeuristicLab.Random; 25 25 using HeuristicLab.Data; 26 using System.Xml; 26 27 27 28 namespace HeuristicLab.GP.StructureIdentification { … … 32 33 33 34 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 34 48 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 } 35 61 36 62 public override string Description { … … 116 142 } 117 143 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); 123 146 } 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 124 171 } 125 172 } -
trunk/sources/HeuristicLab.GP.Tests/NetworkFunctionLibraryTest.cs
r2822 r2843 57 57 MersenneTwister twister = new MersenneTwister(); 58 58 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); 60 60 } 61 61 -
trunk/sources/HeuristicLab.GP.Tests/NetworkToFunctionTransformerTest.cs
r2822 r2843 330 330 MersenneTwister twister = new MersenneTwister(); 331 331 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); 333 333 foreach (var tree in randomTrees) { 334 334 IEnumerable<IFunctionTree> actualTrees = NetworkToFunctionTransformer_Accessor.Transform(tree, new List<string>() { "a", "b", "c" }); -
trunk/sources/HeuristicLab.GP.Tests/SimpleFunctionLibraryTest.cs
r2728 r2843 56 56 MersenneTwister twister = new MersenneTwister(); 57 57 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); 59 59 } 60 60 -
trunk/sources/HeuristicLab.GP.Tests/Util.cs
r2616 r2843 153 153 functionLibrary.AddFunction(xor); 154 154 155 variable. SetConstraints(0, 0);156 differential. SetConstraints(0, 0);155 variable.MinTimeOffset = variable.MaxTimeOffset = 0; 156 differential.MinTimeOffset = differential.MaxTimeOffset = 0; 157 157 158 158 return functionLibrary; -
trunk/sources/HeuristicLab.GP/3.3/BaseClasses/FunctionLibraryInjectorBase.cs
r2729 r2843 33 33 34 34 public override string Description { 35 get { return @"Descr ption is missing."; }35 get { return @"Description is missing."; } 36 36 } 37 37 … … 55 55 56 56 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())); 58 58 return null; 59 59 } -
trunk/sources/HeuristicLab.GP/3.3/FunctionView.Designer.cs
r2729 r2843 335 335 #endregion 336 336 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 361 362 362 363 } -
trunk/sources/HeuristicLab.GP/3.3/FunctionView.cs
r2729 r2843 30 30 namespace HeuristicLab.GP { 31 31 public partial class FunctionView : ViewBase { 32 private Function function; 32 33 33 private const string ALL_SLOTS = "All"; 34 34 private string selectedSlot = ALL_SLOTS; 35 35 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() { 37 47 InitializeComponent(); 38 48 } 39 49 40 50 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(); 45 55 } 46 56 47 57 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; 56 66 } else { 57 67 initializerTextBox.Enabled = false; 58 68 editInitializerButton.Enabled = false; 59 69 } 60 if ( function.Manipulator != null) {61 manipulatorTextBox.Text = function.Manipulator.Name;70 if (Function.Manipulator != null) { 71 manipulatorTextBox.Text = Function.Manipulator.Name; 62 72 } else { 63 73 manipulatorTextBox.Enabled = false; … … 67 77 argumentComboBox.Items.Clear(); 68 78 argumentComboBox.Items.Add(ALL_SLOTS); 69 for (int i = 0; i < function.MaxSubTrees; i++) {79 for (int i = 0; i < Function.MaxSubTrees; i++) { 70 80 argumentComboBox.Items.Add(i.ToString()); 71 81 } … … 75 85 76 86 private void UpdateAllowedSubFunctionsList() { 77 if ( function.MaxSubTrees > 0) {87 if (Function.MaxSubTrees > 0) { 78 88 subFunctionsListBox.Items.Clear(); 79 89 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)); 83 93 } 84 94 foreach (var subFun in functionSet) { … … 87 97 } else { 88 98 int slot = int.Parse(selectedSlot); 89 foreach (var subFun in function.GetAllowedSubFunctions(slot)) {99 foreach (var subFun in Function.GetAllowedSubFunctions(slot)) { 90 100 subFunctionsListBox.Items.Add(subFun); 91 101 } … … 100 110 string name = nameTextBox.Text; 101 111 if (!string.IsNullOrEmpty(name)) { 102 function.Name = name;112 Function.Name = name; 103 113 functionPropertiesErrorProvider.SetError(nameTextBox, string.Empty); 104 114 } else { … … 110 120 int minSubTrees; 111 121 if (int.TryParse(minSubTreesTextBox.Text, out minSubTrees) && minSubTrees >= 0) { 112 function.MinSubTrees = minSubTrees;122 Function.MinSubTrees = minSubTrees; 113 123 functionPropertiesErrorProvider.SetError(minSubTreesTextBox, string.Empty); 114 124 } else { … … 120 130 int maxSubTrees; 121 131 if (int.TryParse(maxSubTreesTextBox.Text, out maxSubTrees) && maxSubTrees >= 0) { 122 function.MaxSubTrees = maxSubTrees;132 Function.MaxSubTrees = maxSubTrees; 123 133 functionPropertiesErrorProvider.SetError(maxSubTreesTextBox, string.Empty); 124 134 } else { … … 130 140 double tickets; 131 141 if (double.TryParse(ticketsTextBox.Text, out tickets) && tickets >= 0) { 132 function.Tickets = tickets;142 Function.Tickets = tickets; 133 143 functionPropertiesErrorProvider.SetError(ticketsTextBox, string.Empty); 134 144 } else { … … 138 148 139 149 private void editInitializerButton_Click(object sender, EventArgs e) { 140 ControlManager.Manager.ShowControl( function.Initializer.CreateView());150 ControlManager.Manager.ShowControl(Function.Initializer.CreateView()); 141 151 } 142 152 143 153 private void editManipulatorButton_Click(object sender, EventArgs e) { 144 ControlManager.Manager.ShowControl( function.Manipulator.CreateView());154 ControlManager.Manager.ShowControl(Function.Manipulator.CreateView()); 145 155 } 146 156 … … 168 178 Cursor = Cursors.WaitCursor; 169 179 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); 172 182 } else { 173 183 int slot = int.Parse(selectedSlot); 174 function.AddAllowedSubFunction(fun, slot);184 Function.AddAllowedSubFunction(fun, slot); 175 185 } 176 186 } … … 188 198 if (selectedSlot == ALL_SLOTS) { 189 199 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++) { 191 201 foreach (var subFun in removedSubFunctions) { 192 function.RemoveAllowedSubFunction((IFunction)subFun, slot);202 Function.RemoveAllowedSubFunction((IFunction)subFun, slot); 193 203 } 194 204 } … … 197 207 List<IFunction> removedSubFunctions = new List<IFunction>(subFunctionsListBox.SelectedItems.Cast<IFunction>()); 198 208 foreach (var subFun in removedSubFunctions) { 199 function.RemoveAllowedSubFunction(subFun, slot);209 Function.RemoveAllowedSubFunction(subFun, slot); 200 210 } 201 211 } -
trunk/sources/HeuristicLab.LinearRegression/3.2/LinearRegressionOperator.cs
r2789 r2843 114 114 int p = inputMatrix.GetLength(1); 115 115 // 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) }; 117 117 double[,] dataset = new double[n, p]; 118 118 for (int row = 0; row < n; row++) { -
trunk/sources/HeuristicLab.Modeling/3.2/ITimeSeriesAlgorithm.cs
r2366 r2843 27 27 namespace HeuristicLab.Modeling { 28 28 public interface ITimeSeriesAlgorithm : IAlgorithm { 29 int MinTimeOffset { get; set; }30 int MaxTimeOffset { get; set; }31 29 } 32 30 }
Note: See TracChangeset
for help on using the changeset viewer.