Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14536 for branches


Ignore:
Timestamp:
01/02/17 14:06:38 (8 years ago)
Author:
jzenisek
Message:

#2719 added datastream type; updated the optimizer view and control functionality

Location:
branches/HeuristicLab.DatastreamAnalysis
Files:
6 added
13 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/DatastreamAnalysisOptimizerView.Designer.cs

    r14488 r14536  
    3030      this.datastreamViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    3131      this.resultsTab = new System.Windows.Forms.TabPage();
    32       this.resultsViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
     32      this.resultsView = new HeuristicLab.Optimization.Views.ResultCollectionView();
     33      this.runsTab = new System.Windows.Forms.TabPage();
     34      this.runsView = new HeuristicLab.Optimization.Views.RunCollectionView();
    3335      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    3436      this.tabControl.SuspendLayout();
     
    3638      this.datastreamTab.SuspendLayout();
    3739      this.resultsTab.SuspendLayout();
     40      this.runsTab.SuspendLayout();
    3841      this.SuspendLayout();
    3942      //
     
    8588      this.tabControl.Controls.Add(this.datastreamTab);
    8689      this.tabControl.Controls.Add(this.resultsTab);
     90      this.tabControl.Controls.Add(this.runsTab);
    8791      this.tabControl.Location = new System.Drawing.Point(3, 26);
    8892      this.tabControl.Name = "tabControl";
     
    103107      this.ensemblesTab.UseVisualStyleBackColor = true;
    104108      this.ensemblesTab.DragDrop += new System.Windows.Forms.DragEventHandler(this.ensemblesTab_DragDrop);
    105       this.ensemblesTab.DragEnter += new System.Windows.Forms.DragEventHandler(this.ensemblesTab_DragEnter);
     109      this.ensemblesTab.DragEnter += new System.Windows.Forms.DragEventHandler(this.ensemblesTab_DragEnterOver);
     110      this.ensemblesTab.DragOver += new System.Windows.Forms.DragEventHandler(this.ensemblesTab_DragEnterOver);
    106111      //
    107112      // ensemblesViewHost
     
    133138      this.datastreamTab.UseVisualStyleBackColor = true;
    134139      this.datastreamTab.DragDrop += new System.Windows.Forms.DragEventHandler(this.datastreamTab_DragDrop);
    135       this.datastreamTab.DragEnter += new System.Windows.Forms.DragEventHandler(this.datastreamTab_DragEnter);
     140      this.datastreamTab.DragEnter += new System.Windows.Forms.DragEventHandler(this.datastreamTab_DragEnterOver);
     141      this.datastreamTab.DragOver += new System.Windows.Forms.DragEventHandler(this.datastreamTab_DragEnterOver);
    136142      //
    137143      // datastreamViewHost
     
    151157      // resultsTab
    152158      //
    153       this.resultsTab.Controls.Add(this.resultsViewHost);
     159      this.resultsTab.Controls.Add(this.resultsView);
    154160      this.resultsTab.Location = new System.Drawing.Point(4, 22);
    155161      this.resultsTab.Name = "resultsTab";
     
    161167      // resultsViewHost
    162168      //
    163       this.resultsViewHost.Caption = "View";
    164       this.resultsViewHost.Content = null;
    165       this.resultsViewHost.Dock = System.Windows.Forms.DockStyle.Fill;
    166       this.resultsViewHost.Enabled = false;
    167       this.resultsViewHost.Location = new System.Drawing.Point(0, 0);
    168       this.resultsViewHost.Name = "resultsViewHost";
    169       this.resultsViewHost.ReadOnly = false;
    170       this.resultsViewHost.Size = new System.Drawing.Size(950, 554);
    171       this.resultsViewHost.TabIndex = 0;
    172       this.resultsViewHost.ViewsLabelVisible = true;
    173       this.resultsViewHost.ViewType = null;
     169      this.resultsView.Caption = "View";
     170      this.resultsView.Content = null;
     171      this.resultsView.Dock = System.Windows.Forms.DockStyle.Fill;
     172      this.resultsView.Enabled = false;
     173      this.resultsView.Location = new System.Drawing.Point(0, 0);
     174      this.resultsView.Name = "resultsViewHost";
     175      this.resultsView.ReadOnly = false;
     176      this.resultsView.Size = new System.Drawing.Size(950, 554);
     177      this.resultsView.TabIndex = 0;
     178      //
     179      // runsTab
     180      //
     181      //this.runsTabPage.Controls.Add(this.storeAlgorithmInEachRunCheckBox);
     182      this.runsTab.Controls.Add(this.runsView);
     183      this.runsTab.Location = new System.Drawing.Point(4, 22);
     184      this.runsTab.Name = "runsTabPage";
     185      this.runsTab.Padding = new System.Windows.Forms.Padding(3);
     186      this.runsTab.Size = new System.Drawing.Size(950, 554);
     187      this.runsTab.TabIndex = 3;
     188      this.runsTab.Text = "Runs";
     189      this.runsTab.UseVisualStyleBackColor = true;
     190      //
     191      // runsView
     192      //
     193      this.runsView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     194      | System.Windows.Forms.AnchorStyles.Left)
     195      | System.Windows.Forms.AnchorStyles.Right)));
     196      this.runsView.Caption = "RunCollection View";
     197      this.runsView.Content = null;
     198      this.runsView.Location = new System.Drawing.Point(0, 0);
     199      this.runsView.Name = "runsView";
     200      this.runsView.ReadOnly = false;
     201      this.runsView.Size = new System.Drawing.Size(950, 554);
     202      this.runsView.TabIndex = 0;
    174203      //
    175204      // DatastreamAnalysisOptimizerView
     
    206235    private System.Windows.Forms.TabPage ensemblesTab;
    207236    private System.Windows.Forms.TabPage datastreamTab;
    208     private System.Windows.Forms.TabPage resultsTab;
     237    protected System.Windows.Forms.TabPage resultsTab;
     238    protected System.Windows.Forms.TabPage runsTab;
    209239    private MainForm.WindowsForms.ViewHost ensemblesViewHost;
    210240    private MainForm.WindowsForms.ViewHost datastreamViewHost;
    211     private MainForm.WindowsForms.ViewHost resultsViewHost;
     241    protected HeuristicLab.Optimization.Views.ResultCollectionView resultsView;
     242    protected HeuristicLab.Optimization.Views.RunCollectionView runsView;
    212243  }
    213244}
  • branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/DatastreamAnalysisOptimizerView.cs

    r14488 r14536  
    11#region License Information
     2
    23/* HeuristicLab
    34 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     
    1819 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
    1920 */
     21
    2022#endregion
    2123
    2224using System;
     25using System.Collections.Generic;
     26using System.Linq;
    2327using System.Windows.Forms;
     28using HeuristicLab.Core;
    2429using HeuristicLab.MainForm;
    2530using HeuristicLab.Optimization;
     
    3742
    3843    public new DatastreamAnalysisOptimizer Content {
    39       get { return (DatastreamAnalysisOptimizer)base.Content; }
     44      get { return (DatastreamAnalysisOptimizer) base.Content; }
    4045      set { base.Content = value; }
     46    }
     47
     48    //protected override void Dispose(bool disposing) {
     49    //  if (disposing) {
     50    //    if (components != null) components.Dispose();
     51    //  }
     52    //  base.Dispose(disposing);
     53    //}
     54
     55    protected override void OnInitialized(EventArgs e) {
     56      // set order of tab pages according to z order.
     57      // NOTE: this is required due to a bug in the VS designer.
     58      List<Control> tabPages = new List<Control>();
     59      for (int i = 0; i < tabControl.Controls.Count; i++) {
     60        tabPages.Add(tabControl.Controls[i]);
     61      }
     62      tabControl.Controls.Clear();
     63      foreach(Control control in tabPages)
     64        tabControl.Controls.Add(control);
     65
     66      base.OnInitialized(e);
    4167    }
    4268
    4369    protected override void OnContentChanged() {
    4470      base.OnContentChanged();
    45       if (Content == null)
    46         return;
    47 
    48       // TODO
     71      if (Content == null) {
     72        ensemblesViewHost.Content = null;
     73        datastreamViewHost.Content = null;
     74        resultsView.Content = null;
     75        runsView.Content = null;
     76      } else {
     77        ensemblesViewHost.Content = Content.Ensembles;
     78        datastreamViewHost.Content = Content.Datastream;
     79        resultsView.Content = Content.Results.AsReadOnly();
     80        runsView.Content = Content.Runs;
     81      }
     82    }
     83
     84    protected override void SetEnabledStateOfControls() {
     85      base.SetEnabledStateOfControls();
     86      resultsView.Enabled = Content != null;
     87      runsView.Enabled = Content != null;
     88    }
     89
     90    protected override void OnClosed(FormClosedEventArgs e) {
     91      if ((Content != null) && (Content.ExecutionState == ExecutionState.Started)) {
     92        //The content must be stopped if no other view showing the content is available
     93        var optimizers =
     94          MainFormManager.MainForm.Views.OfType<IContentView>()
     95            .Where(v => v != this)
     96            .Select(v => v.Content)
     97            .OfType<IOptimizer>();
     98        if (!optimizers.Contains(Content)) {
     99          var nestedOptimizers = optimizers.SelectMany(opt => opt.NestedOptimizers);
     100          if (!nestedOptimizers.Contains(Content)) Content.Stop();
     101        }
     102      }
     103      base.OnClosed(e);
    49104    }
    50105
     
    52107      base.RegisterContentEvents();
    53108
    54       // TODO
     109      Content.EnsemblesChanged += new EventHandler(Content_EnsemblesChanged);
     110      Content.DatastreamChanged += new EventHandler(Content_DatastreamChanged);
    55111    }
    56112
    57113    protected override void DeregisterContentEvents() {
     114      Content.EnsemblesChanged -= new EventHandler(Content_EnsemblesChanged);
     115      Content.DatastreamChanged -= new EventHandler(Content_DatastreamChanged);
     116
    58117      base.DeregisterContentEvents();
    59118    }
    60119
     120    #region
     121    protected override void Content_Prepared(object sender, EventArgs e) {
     122      if (InvokeRequired)
     123        Invoke(new EventHandler(Content_Prepared), sender, e);
     124      else {
     125        base.Content_Prepared(sender,e);
     126        resultsView.Content = Content.Results.AsReadOnly();
     127      }
     128    }
     129
     130    protected void Content_EnsemblesChanged(object sender, EventArgs e) {
     131      if (InvokeRequired)
     132        Invoke(new EventHandler(Content_EnsemblesChanged), sender, e);
     133      else {
     134        ensemblesViewHost.Content = Content.Ensembles;
     135      }
     136    }
     137
     138    protected void Content_DatastreamChanged(object sender, EventArgs e) {
     139      if (InvokeRequired)
     140        Invoke(new EventHandler(Content_DatastreamChanged), sender, e);
     141      else {
     142        if (datastreamViewHost.Content != null && Content.Datastream != null &&
     143            datastreamViewHost.Content.GetType() != Content.Datastream.GetType())
     144          datastreamViewHost.ViewType = null;
     145        datastreamViewHost.Content = Content.Datastream;
     146      }
     147    }
     148    #endregion
     149
    61150    #region event handlers
    62 
    63151    private void ensemblesTab_DragDrop(object sender, DragEventArgs e) {
    64152      if (e.Data.GetDataPresent(HeuristicLab.Common.Constants.DragDropDataFormat)) {
    65153        try {
    66           // TODO
     154          var data = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
     155          if (data is IRegressionEnsembleModel) {
     156            data = (IRegressionEnsembleModel) data;
     157            Content.Ensembles.Add((RegressionEnsembleModel) data);
     158          }
    67159        }
    68160        catch (Exception ex) {
     
    72164    }
    73165
    74     private void ensemblesTab_DragEnter(object sender, DragEventArgs e) {
     166    private void ensemblesTab_DragEnterOver(object sender, DragEventArgs e) {
    75167      e.Effect = DragDropEffects.None;
    76       if (!e.Data.GetDataPresent(HeuristicLab.Common.Constants.DragDropDataFormat))
     168      if (ReadOnly || !e.Data.GetDataPresent(HeuristicLab.Common.Constants.DragDropDataFormat))
    77169        return;
    78170
    79171      var data = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
    80172
    81       // TODO: check if data is taggedEnsembles-data
    82       if(data is IRegressionEnsembleModel)
    83         e.Effect = DragDropEffects.Copy;
     173      if (data is IRegressionEnsembleModel) {
     174        if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link; // ALT key
     175        else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move; // SHIFT key
     176        else if (e.AllowedEffect.HasFlag(DragDropEffects.Copy)) e.Effect = DragDropEffects.Copy;
     177        else if (e.AllowedEffect.HasFlag(DragDropEffects.Move)) e.Effect = DragDropEffects.Move;
     178        else if (e.AllowedEffect.HasFlag(DragDropEffects.Link)) e.Effect = DragDropEffects.Link;
     179      }
    84180    }
    85181
     
    87183      if (e.Data.GetDataPresent(HeuristicLab.Common.Constants.DragDropDataFormat)) {
    88184        try {
    89           // TODO
     185          var data = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
     186          if (data is IValueParameter) data = ((IValueParameter) data).Value;
     187          if (data is IRegressionProblemData)
     188            Content.Datastream.ProblemData = (RegressionProblemData) data;
    90189        }
    91190        catch (Exception ex) {
     
    95194    }
    96195
    97     private void datastreamTab_DragEnter(object sender, DragEventArgs e) {
     196    private void datastreamTab_DragEnterOver(object sender, DragEventArgs e) {
    98197      e.Effect = DragDropEffects.None;
    99       if (!e.Data.GetDataPresent(HeuristicLab.Common.Constants.DragDropDataFormat))
     198
     199      if (ReadOnly || !e.Data.GetDataPresent(HeuristicLab.Common.Constants.DragDropDataFormat))
    100200        return;
    101201
    102202      var data = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
    103       if (data is IRegressionProblemData)
    104         e.Effect = DragDropEffects.Copy;
     203      if (data is IValueParameter) data = ((IValueParameter) data).Value;
     204      if (data is IRegressionProblemData) {
     205        if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link; // ALT key
     206        else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move; // SHIFT key
     207        else if (e.AllowedEffect.HasFlag(DragDropEffects.Copy)) e.Effect = DragDropEffects.Copy;
     208        else if (e.AllowedEffect.HasFlag(DragDropEffects.Move)) e.Effect = DragDropEffects.Move;
     209        else if (e.AllowedEffect.HasFlag(DragDropEffects.Link)) e.Effect = DragDropEffects.Link;
     210      }
    105211    }
    106212
  • branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/HeuristicLab.DatastreamAnalysis.Views.csproj

    r14491 r14536  
    5858      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core.Views-3.3.dll</HintPath>
    5959    </Reference>
     60    <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     61      <SpecificVersion>False</SpecificVersion>
     62      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath>
     63    </Reference>
    6064    <Reference Include="HeuristicLab.MainForm-3.3">
    6165      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.MainForm-3.3.dll</HintPath>
     
    116120    </ProjectReference>
    117121  </ItemGroup>
     122  <ItemGroup>
     123    <EmbeddedResource Include="RegressionEnsembleModelView.resx">
     124      <DependentUpon>RegressionEnsembleModelView.cs</DependentUpon>
     125    </EmbeddedResource>
     126  </ItemGroup>
    118127  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    119128  <PropertyGroup>
  • branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/Plugin.cs

    r14491 r14536  
    2323
    2424namespace HeuristicLab.DatastreamAnalysis.Views {
    25   [Plugin("HeuristicLab.DatastreamAnalysis.Views", "3.4.14.14488")]
     25  [Plugin("HeuristicLab.DatastreamAnalysis.Views", "3.4.14.14491")]
    2626  [PluginFile("HeuristicLab.DatastreamAnalysis.Views-3.4.dll", PluginFileType.Assembly)]
    2727  [PluginDependency("HeuristicLab.Collections", "3.3")]
  • branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/Properties/AssemblyInfo.cs

    r14491 r14536  
    5454// [assembly: AssemblyVersion("1.0.*")]
    5555[assembly: AssemblyVersion("3.4.0.0")]
    56 [assembly: AssemblyFileVersion("3.4.14.14488")]
     56[assembly: AssemblyFileVersion("3.4.14.14491")]
  • branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/RegressionEnsembleModelView.Designer.cs

    r14488 r14536  
    1919 */
    2020#endregion
     21
     22using HeuristicLab.Core.Views;
     23using HeuristicLab.Problems.DataAnalysis;
     24
    2125namespace HeuristicLab.DatastreamAnalysis.Views {
    2226  partial class RegressionEnsembleModelView {
     
    4448    /// </summary>
    4549    private void InitializeComponent() {
     50      this.modelsView = new HeuristicLab.DatastreamAnalysis.Views.RegressionEnsembleModelView.ModelsView();
     51      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    4652      this.SuspendLayout();
    47 
     53      //
     54      // nameTextBox
     55      //
     56      this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
     57      this.errorProvider.SetIconPadding(this.nameTextBox, 2);
     58      this.nameTextBox.Size = new System.Drawing.Size(468, 20);
     59      //
     60      // infoLabel
     61      //
     62      this.infoLabel.Location = new System.Drawing.Point(532, 3);
     63      //
     64      // modelsView
     65      //
     66      this.modelsView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     67            | System.Windows.Forms.AnchorStyles.Left)
     68            | System.Windows.Forms.AnchorStyles.Right)));
     69      this.modelsView.Caption = "Models View";
     70      this.modelsView.Content = null;
     71      this.modelsView.Location = new System.Drawing.Point(6, 35);
     72      this.modelsView.Name = "modelsView";
     73      this.modelsView.ReadOnly = false;
     74      this.modelsView.ShowDetails = true;
     75      this.modelsView.Size = new System.Drawing.Size(532, 383);
     76      this.modelsView.TabIndex = 1;
    4877      //
    4978      // RegressionEnsembleModelView
    5079      //
    51       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    5280      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
     81      this.Controls.Add(this.modelsView);
    5382      this.Name = "RegressionEnsembleModelView";
     83      this.Size = new System.Drawing.Size(551, 425);
     84      this.Controls.SetChildIndex(this.modelsView, 0);
     85      this.Controls.SetChildIndex(this.nameLabel, 0);
     86      this.Controls.SetChildIndex(this.nameTextBox, 0);
     87      this.Controls.SetChildIndex(this.infoLabel, 0);
     88      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    5489      this.ResumeLayout(false);
     90      this.PerformLayout();
     91
    5592    }
    5693
    5794    #endregion
     95
     96    private ModelsView modelsView;
    5897  }
    5998}
  • branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/RegressionEnsembleModelView.cs

    r14491 r14536  
    3434  [Content(typeof(RegressionEnsembleModel), true)]
    3535  internal sealed partial class RegressionEnsembleModelView : NamedItemView {
    36     private ModelsView view;
    37     private ItemCollection<IRegressionModel> models;
     36    //private ItemCollectionView<IRegressionModel> view;
     37    private ItemCollection<IRegressionModel> models = new ItemCollection<IRegressionModel>();
    3838
    3939    public RegressionEnsembleModelView() {
    4040      InitializeComponent();
    41       view = new ModelsView();
    42       view.Dock = DockStyle.Fill;
    43       Controls.Add(view);
     41      models = new ItemCollection<IRegressionModel>();
     42
     43      models.ItemsAdded += Models_ItemsAdded;
     44      models.ItemsRemoved += Models_ItemsRemoved;
     45      models.CollectionReset += Models_CollectionReset;
     46
    4447    }
    4548
     
    4952    }
    5053
    51 
    52 
     54 
    5355    protected override void OnContentChanged() {
    5456      base.OnContentChanged();
    5557      if (Content != null) {
    56          models = new ItemCollection<IRegressionModel>(Content.Models);
    57         view.Content = models;
     58        models.ItemsAdded -= Models_ItemsAdded;
     59        models.ItemsRemoved -= Models_ItemsRemoved;
     60        models.CollectionReset -= Models_CollectionReset;
     61
     62        models.Clear();
     63        models.AddRange(Content.Models);
     64        modelsView.Content = models;
     65
     66        models.ItemsAdded += Models_ItemsAdded;
     67        models.ItemsRemoved += Models_ItemsRemoved;
     68        models.CollectionReset += Models_CollectionReset;
    5869      } else {
    59         view.Content = null;
     70        modelsView.Content = null;
    6071      }
    6172    }
    6273
     74    private void Models_CollectionReset(object sender, Collections.CollectionItemsChangedEventArgs<IRegressionModel> e) {
     75      Content = null;
     76    }
     77
     78    private void Models_ItemsAdded(object sender, Collections.CollectionItemsChangedEventArgs<IRegressionModel> e) {
     79      Content.AddRange(e.Items);
     80    }
     81
     82    private void Models_ItemsRemoved(object sender, Collections.CollectionItemsChangedEventArgs<IRegressionModel> e) {
     83      Content.RemoveRange(e.Items);
     84    }
     85
    6386    private class ModelsView : ItemCollectionView<IRegressionModel> {
    64       protected override void SetEnabledStateOfControls() {
    65         base.SetEnabledStateOfControls();
    66         addButton.Enabled = false;
    67         removeButton.Enabled = Content != null && !Content.IsReadOnly && !Locked && !ReadOnly && itemsListView.SelectedItems.Count > 0;
    68         itemsListView.Enabled = Content != null && !Locked;
    69         detailsGroupBox.Enabled = Content != null && itemsListView.SelectedItems.Count == 1;
    70         sortAscendingButton.Enabled = false;
    71         sortDescendingButton.Enabled = false;
     87      public ModelsView() : base() {
    7288      }
     89    }
    7390
    74       protected override void SortItemsListView(SortOrder sortOrder) { }
     91    //private class ModelsView : ItemCollectionView<IRegressionModel> {
     92    //  protected override void SetEnabledStateOfControls() {
     93    //    base.SetEnabledStateOfControls();
     94    //    addButton.Enabled = false;
     95    //    removeButton.Enabled = Content != null && !Content.IsReadOnly && !Locked && !ReadOnly && itemsListView.SelectedItems.Count > 0;
     96    //    itemsListView.Enabled = Content != null && !Locked;
     97    //    detailsGroupBox.Enabled = Content != null && itemsListView.SelectedItems.Count == 1;
     98    //    sortAscendingButton.Enabled = false;
     99    //    sortDescendingButton.Enabled = false;
     100    //  }
     101
     102    //  protected override void SortItemsListView(SortOrder sortOrder) { }
    75103
    76104
    77       protected override void itemsListView_DragEnter(object sender, DragEventArgs e) {
    78         validDragOperation = false;
    79         if (ReadOnly || Locked) return;
    80         if (Content.IsReadOnly) return;
     105    //  protected override void itemsListView_DragEnter(object sender, DragEventArgs e) {
     106    //    validDragOperation = false;
     107    //    if (ReadOnly || Locked) return;
     108    //    if (Content.IsReadOnly) return;
    81109
    82         var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
    83         validDragOperation = dropData.GetObjectGraphObjects().OfType<IRegressionModel>().Any();
    84       }
    85       protected override void itemsListView_DragDrop(object sender, DragEventArgs e) {
    86         if (e.Effect != DragDropEffects.None) {
    87           var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
    88           var solutions = dropData.GetObjectGraphObjects().OfType<IRegressionModel>();
    89           if (e.Effect.HasFlag(DragDropEffects.Copy)) {
    90             Cloner cloner = new Cloner();
    91             solutions = solutions.Select(s => cloner.Clone(s));
    92           }
    93           var solutionCollection = Content as ItemCollection<IRegressionModel>;
    94           if (solutionCollection != null) {
    95             solutionCollection.AddRange(solutions);
    96           } else {
    97             foreach (var solution in solutions)
    98               Content.Add(solution);
    99           }
    100         }
    101       }
    102       protected override void itemsListView_KeyDown(object sender, KeyEventArgs e) {
    103         var solutionCollection = Content as ItemCollection<IRegressionModel>;
    104         if (e.KeyCode == Keys.Delete && solutionCollection != null) {
    105           if ((itemsListView.SelectedItems.Count > 0) && !Content.IsReadOnly && !ReadOnly) {
    106             solutionCollection.RemoveRange(itemsListView.SelectedItems.Cast<ListViewItem>().Select(x => (IRegressionModel)x.Tag));
    107           }
    108         } else {
    109           base.itemsListView_KeyDown(sender, e);
    110         }
    111       }
    112       protected override void removeButton_Click(object sender, EventArgs e) {
    113         var solutionCollection = Content as ItemCollection<IRegressionModel>;
    114         if (itemsListView.SelectedItems.Count > 0 && solutionCollection != null) {
    115           solutionCollection.RemoveRange(itemsListView.SelectedItems.Cast<ListViewItem>().Select(x => (IRegressionModel)x.Tag));
    116           itemsListView.SelectedItems.Clear();
    117         } else {
    118           base.removeButton_Click(sender, e);
    119         }
    120       }
    121 
    122 
    123     }
     110    //    var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
     111    //    validDragOperation = dropData.GetObjectGraphObjects().OfType<IRegressionModel>().Any();
     112    //  }
     113    //  protected override void itemsListView_DragDrop(object sender, DragEventArgs e) {
     114    //    if (e.Effect != DragDropEffects.None) {
     115    //      var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
     116    //      var solutions = dropData.GetObjectGraphObjects().OfType<IRegressionModel>();
     117    //      if (e.Effect.HasFlag(DragDropEffects.Copy)) {
     118    //        Cloner cloner = new Cloner();
     119    //        solutions = solutions.Select(s => cloner.Clone(s));
     120    //      }
     121    //      var solutionCollection = Content as ItemCollection<IRegressionModel>;
     122    //      if (solutionCollection != null) {
     123    //        solutionCollection.AddRange(solutions);
     124    //      } else {
     125    //        foreach (var solution in solutions)
     126    //          Content.Add(solution);
     127    //      }
     128    //    }
     129    //  }
     130    //  protected override void itemsListView_KeyDown(object sender, KeyEventArgs e) {
     131    //    var solutionCollection = Content as ItemCollection<IRegressionModel>;
     132    //    if (e.KeyCode == Keys.Delete && solutionCollection != null) {
     133    //      if ((itemsListView.SelectedItems.Count > 0) && !Content.IsReadOnly && !ReadOnly) {
     134    //        solutionCollection.RemoveRange(itemsListView.SelectedItems.Cast<ListViewItem>().Select(x => (IRegressionModel)x.Tag));
     135    //      }
     136    //    } else {
     137    //      base.itemsListView_KeyDown(sender, e);
     138    //    }
     139    //  }
     140    //  protected override void removeButton_Click(object sender, EventArgs e) {
     141    //    var solutionCollection = Content as ItemCollection<IRegressionModel>;
     142    //    if (itemsListView.SelectedItems.Count > 0 && solutionCollection != null) {
     143    //      solutionCollection.RemoveRange(itemsListView.SelectedItems.Cast<ListViewItem>().Select(x => (IRegressionModel)x.Tag));
     144    //      itemsListView.SelectedItems.Clear();
     145    //    } else {
     146    //      base.removeButton_Click(sender, e);
     147    //    }
     148    //  }
     149    //}
    124150
    125151  }
  • branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/DatastreamAnalysisOptimizer.cs

    r14488 r14536  
    11#region License Information
     2
    23/* HeuristicLab
    34 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     
    1819 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
    1920 */
     21
    2022#endregion
    2123
    2224using System;
    2325using System.Collections.Generic;
     26using System.Diagnostics;
    2427using System.Drawing;
    2528using System.Linq;
     29using System.Threading;
     30using System.Threading.Tasks;
     31using HeuristicLab.Analysis;
     32using HeuristicLab.Collections;
    2633using HeuristicLab.Common;
    2734using HeuristicLab.Core;
     35using HeuristicLab.Data;
    2836using HeuristicLab.Optimization;
    2937using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    3139
    3240namespace HeuristicLab.DatastreamAnalysis {
    33   internal enum DatastreamAnalysisOptimizerAction { None, Prepare, Start, Stop, Pause }
     41  internal enum DatastreamAnalysisOptimizerAction {
     42    None,
     43    Prepare,
     44    Start,
     45    Stop,
     46    Pause
     47  }
    3448
    3549  [StorableClass]
    36   [Item("DatastreamAnalysis Optimizer", "The main loop for evaluating ensemble models against a incoming datastream of time series fashion.")]
    37   [Creatable("Algorithms")]
    38   public class DatastreamAnalysisOptimizer : NamedItem, IOptimizer, IStorableContent {
    39 
    40     // TODO: introduce members -> ensembles, datastream
    41 
    42 
    43     // VAR 1: datastream = problem data
    44     [Storable]
    45     private IRegressionProblemData problemData;
    46 
    47     public IRegressionProblemData ProblemData {
    48       get { return problemData; }
     50  [Item("DatastreamAnalysis Optimizer",
     51     "The main loop for evaluating ensemble models against a incoming datastream of time series fashion.")]
     52  [Creatable(CreatableAttribute.Categories.Algorithms)]
     53  public class DatastreamAnalysisOptimizer : Executable, IOptimizer, IStorableContent {
     54    #region properties
     55    public string Filename { get; set; }
     56
     57    private DatastreamAnalysisOptimizerAction daoAction;
     58
     59    public IEnumerable<IOptimizer> NestedOptimizers { get; }
     60
     61
     62    [Storable]
     63    protected ILog log;
     64    public ILog Log {
     65      get { return log; }
     66    }
     67
     68    [Storable]
     69    private ResultCollection results;
     70
     71    public ResultCollection Results {
     72      get { return results; }
     73    }
     74
     75    private CancellationTokenSource cancellationTokenSource;
     76    private bool stopPending;
     77    private DateTime lastUpdateTime;
     78
     79    [Storable]
     80    protected int runsCounter;
     81
     82    [Storable]
     83    private RunCollection runs;
     84
     85    public RunCollection Runs
     86    {
     87      get { return runs; }
     88      protected set
     89      {
     90        if (value == null) throw new ArgumentNullException();
     91        if (runs != value) {
     92          if (runs != null) DeregisterRunsEvents();
     93          runs = value;
     94          if (runs != null) RegisterRunsEvents();
     95        }
     96      }
     97    }
     98
     99
     100    [Storable]
     101    private IItemList<RegressionEnsembleModel> ensembles;
     102
     103    public IItemList<RegressionEnsembleModel> Ensembles {
     104      get { return ensembles; }
    49105      set {
    50         if (value == null || value == problemData)
     106        if (value == null || value == ensembles)
    51107          return;
    52108
    53         problemData = value;
    54       }
    55     }
    56 
    57     // VAR 2: datastream = external source (webservice, AMQP-Queue, etc.)
    58     // TODO
     109        ensembles = value;
     110      }
     111    }
     112
     113
     114    // VAR 1: datastream ~= problem data, VAR 2 (TODO): datastream = external source e.g. webservice, AMQP-Queue, etc.
     115    [Storable]
     116    private Datastream datastream;
     117
     118    public Datastream Datastream {
     119      get { return datastream; }
     120      set {
     121        if (value == null || value == datastream)
     122          return;
     123
     124        datastream = value;
     125      }
     126    }
     127
     128    #endregion properties
     129
     130    #region ResultsProperties
     131    private double ResultsBestQuality
     132    {
     133      get { return ((DoubleValue)Results["Best Quality"].Value).Value; }
     134      set { ((DoubleValue)Results["Best Quality"].Value).Value = value; }
     135    }
     136    private DataTable ResultsQualities
     137    {
     138      get { return ((DataTable)Results["Qualities"].Value); }
     139    }
     140    #endregion
     141
     142    #region constructors, cloner,...
    59143
    60144    public DatastreamAnalysisOptimizer() {
    61       Name = "Datastream Analysis";
     145      name = "Datastream Analysis";
     146      log = new Log();
     147      results = new ResultCollection();
     148      ensembles = new ItemList<RegressionEnsembleModel>();
     149      datastream = new Datastream();
     150      runsCounter = 0;
     151      runs = new RunCollection();
     152      Initialize();
    62153    }
    63154
    64155    [StorableConstructor]
    65     protected DatastreamAnalysisOptimizer(bool deserializing) : base(deserializing) { }
     156    protected DatastreamAnalysisOptimizer(bool deserializing) : base(deserializing) {
     157    }
    66158
    67159    [StorableHook(HookType.AfterDeserialization)]
     
    71163
    72164    protected DatastreamAnalysisOptimizer(DatastreamAnalysisOptimizer original, Cloner cloner) : base(original, cloner) {
    73       // TODO: clone members (ensembles, datastream)
    74       this.ProblemData = (IRegressionProblemData)original.ProblemData.Clone(cloner);
     165      name = original.name;
     166      log = cloner.Clone(original.log);
     167      results = cloner.Clone(original.results);
     168      ensembles = (ItemList<RegressionEnsembleModel>) original.Ensembles.Clone(cloner);
     169      datastream = (Datastream) original.Datastream.Clone(cloner);
     170      runsCounter = original.runsCounter;
     171      runs = cloner.Clone(original.runs);
     172      Initialize();
    75173    }
    76174
    77175    public override IDeepCloneable Clone(Cloner cloner) {
    78       return  new DatastreamAnalysisOptimizer(this, cloner);
    79     }
    80 
    81 
    82     // TODO: introduce EventHandler for EnsemblesChanged, DatastreamChanged
    83 
    84     public EventHandler ProblemDataChanged;
    85     private void OnProblemDataChanged() {
    86       var changed = ProblemDataChanged;
     176      return new DatastreamAnalysisOptimizer(this, cloner);
     177    }
     178
     179    private void Initialize() {
     180      if (runs != null) RegisterRunsEvents();
     181    }
     182    #endregion
     183
     184    #region control actions
     185
     186    public override void Prepare() {
     187      if (ensembles == null || datastream == null) return;
     188      Prepare(true);
     189    }
     190
     191    public void Prepare(bool clearRuns) {
     192      if (ensembles == null || datastream == null) return;
     193      base.Prepare();
     194      if (clearRuns) results.Clear();
     195      OnPrepared();
     196    }
     197
     198    public override void Start() {
     199      if (ensembles == null || datastream == null) return;
     200      base.Start();
     201      cancellationTokenSource = new CancellationTokenSource();
     202      stopPending = false;
     203
     204      Task task = Task.Factory.StartNew(Run, cancellationTokenSource.Token, cancellationTokenSource.Token);
     205      task.ContinueWith(t => {
     206        try {
     207          t.Wait();
     208        }
     209        catch (AggregateException ex) {
     210          try {
     211            ex.Flatten().Handle(x => x is OperationCanceledException);
     212          } catch (AggregateException remaining) {
     213            if(remaining.InnerExceptions.Count == 1) OnExceptionOccurred(remaining.InnerExceptions[0]);
     214            else OnExceptionOccurred(remaining);
     215          }
     216        }
     217        cancellationTokenSource.Dispose();
     218        cancellationTokenSource = null;
     219
     220        // handle stop/pause
     221        if(stopPending) { }
     222        if(!Datastream.SlidingWindowMovementPossible) OnStopped();
     223        else OnPaused();
     224      });
     225
     226    }
     227
     228    public override void Pause() {
     229      if (ensembles == null || datastream == null) return;
     230      base.Pause();
     231      cancellationTokenSource.Cancel();
     232    }
     233
     234    public override void Stop() {
     235      if (ensembles == null || datastream == null) return;
     236      base.Stop();
     237      if (ExecutionState == ExecutionState.Paused) {
     238        OnStopped();
     239      } else {
     240        stopPending = true;
     241        cancellationTokenSource.Cancel();
     242      }
     243    }
     244
     245    protected override void OnPrepared() {
     246      Log.LogMessage("Datastream analysis prepared");
     247      base.OnPrepared();
     248    }
     249
     250    protected override void OnStarted() {
     251      Log.LogMessage("Datastream analysis started");
     252      base.OnStarted();
     253    }
     254
     255    protected override void OnPaused() {
     256      Log.LogMessage("Datastream analysis paused");
     257      base.OnPaused();
     258    }
     259
     260    protected override void OnStopped() {
     261      Log.LogMessage("Datastream analysis stopped");
     262      base.OnStopped();
     263    }
     264
     265    #endregion
     266
     267
     268    private void Run(object state) {
     269      CancellationToken cancellationToken = (CancellationToken) state;
     270      OnStarted();
     271      lastUpdateTime = DateTime.UtcNow;
     272      System.Timers.Timer timer = new System.Timers.Timer(250);
     273      timer.AutoReset = true;
     274      timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
     275      timer.Start();
     276
     277      try {
     278        Run(cancellationToken);
     279      }
     280      finally {
     281        timer.Elapsed -= new System.Timers.ElapsedEventHandler(timer_Elapsed);
     282        timer.Stop();
     283        ExecutionTime += DateTime.UtcNow - lastUpdateTime;
     284      }
     285
     286      cancellationToken.ThrowIfCancellationRequested();
     287    }
     288
     289    protected void Run(CancellationToken cancellationToken) {
     290
     291      // setup results
     292      var slidingWindowMovements = new IntValue(0);
     293      Results.Add(new Result("Sliding Window Movements", slidingWindowMovements));
     294
     295      var qtable = new DataTable("Qualities");
     296      qtable.Rows.Add(new DataRow("R²"));
     297      qtable.Rows.Add(new DataRow("Pearson"));
     298      Results.Add(new Result("Qualities", qtable));
     299
     300      var curLoss = new DoubleValue();
     301      Results.Add(new Result("R²", curLoss));
     302      Results.Add(new Result("Best Quality", curLoss));
     303
     304
     305      // init algorithm
     306      var problemData = Datastream.ProblemData;
     307      var targetVarName = problemData.TargetVariable;
     308      var activeVariables = problemData.AllowedInputVariables;
     309      Random rnd = new Random();
     310
     311      try {
     312        while (Datastream.SlidingWindowMovementPossible) {
     313          cancellationToken.ThrowIfCancellationRequested();
     314
     315          Task.Delay(Datastream.SlidingWindowMovementInterval.Value);
     316
     317          Datastream.MoveSlidingWindow();
     318
     319          // TODO do the window evaluation
     320
     321          // TODO: collect results and display them
     322
     323          curLoss.Value = rnd.Next(100);
     324          qtable.Rows["R²"].Values.Add(curLoss.Value);
     325          qtable.Rows["Pearson"].Values.Add(curLoss.Value % 10);
     326
     327          slidingWindowMovements.Value++;
     328        }
     329
     330        // TODO: collect runs (c.f. goal seeking)
     331      }
     332      catch (Exception ex) {
     333        if (ex is ArgumentOutOfRangeException) throw ex;
     334        if (ex is OperationCanceledException) throw ex;
     335      }
     336      finally {
     337        // reset everything
     338        //Prepare(true);
     339      }
     340    }
     341
     342    private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) {
     343      System.Timers.Timer timer = (System.Timers.Timer)sender;
     344      timer.Enabled = false;
     345      DateTime now = DateTime.UtcNow;
     346      ExecutionTime += now - lastUpdateTime;
     347      lastUpdateTime = now;
     348      timer.Enabled = true;
     349    }
     350
     351    public void CollectResultValues(IDictionary<string, IItem> values) {
     352      values.Add("Execution Time", new TimeSpanValue(ExecutionTime));
     353      Results.CollectResultValues(values);
     354    }
     355
     356    #region events
     357
     358    public EventHandler EnsemblesChanged;
     359    public EventHandler DatastreamChanged;
     360
     361    protected virtual void DeregisterRunsEvents() {
     362      runs.CollectionReset -= new CollectionItemsChangedEventHandler<IRun>(Runs_CollectionReset);
     363    }
     364
     365    protected virtual void RegisterRunsEvents() {
     366      runs.CollectionReset += new CollectionItemsChangedEventHandler<IRun>(Runs_CollectionReset);
     367    }
     368
     369    protected virtual void Runs_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRun> e) {
     370      runsCounter = runs.Count;
     371    }
     372
     373    #region event handling
     374
     375    private void OnEnsemblesChanged() {
     376      var changed = EnsemblesChanged;
    87377      if (changed != null)
    88378        changed(this, EventArgs.Empty);
    89379    }
    90380
    91 
    92     public void Prepare() {
    93       Prepare(false);
    94     }
    95 
    96     public void Start() {
    97       if ((ExecutionState != ExecutionState.Prepared) && (ExecutionState != ExecutionState.Paused))
    98         throw new InvalidOperationException(string.Format("Start not allowed in execution state \"{0}\".", ExecutionState));
    99     }
    100 
    101     public void Pause() {
    102       if (ExecutionState != ExecutionState.Started)
    103         throw new InvalidOperationException(string.Format("Pause not allowed in execution state \"{0}\".", ExecutionState));
    104     }
    105 
    106     public void Stop() {
    107       if ((ExecutionState != ExecutionState.Started) && (ExecutionState != ExecutionState.Paused))
    108         throw new InvalidOperationException(string.Format("Stop not allowed in execution state \"{0}\".", ExecutionState));
    109     }
    110 
    111     public void Prepare(bool clearRuns) {
    112       if ((ExecutionState != ExecutionState.Prepared) && (ExecutionState != ExecutionState.Paused) && (ExecutionState != ExecutionState.Stopped))
    113         throw new InvalidOperationException(string.Format("Prepare not allowed in execution state \"{0}\".", ExecutionState));
    114     }
    115 
    116 
    117     [Storable]
    118     private TimeSpan executionTime;
    119     public TimeSpan ExecutionTime {
    120       get { return executionTime; }
    121       private set {
    122         executionTime = value;
    123         OnExecutionTimeChanged();
    124       }
    125     }
    126 
    127     public RunCollection Runs {
    128       get {
    129         return new RunCollection();
    130       }
    131     }
    132 
    133     public IEnumerable<IOptimizer> NestedOptimizers { get; }
    134     public string Filename { get; set; }
    135 
    136     public new static Image StaticItemImage
    137     {
    138       get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; }
    139     }
    140 
    141     public override Image ItemImage {
    142       get {
    143         if (ExecutionState == ExecutionState.Prepared)
    144           return HeuristicLab.Common.Resources.VSImageLibrary.BatchRunPrepared;
    145         else if (ExecutionState == ExecutionState.Started)
    146           return HeuristicLab.Common.Resources.VSImageLibrary.BatchRunStarted;
    147         else if (ExecutionState == ExecutionState.Paused) return HeuristicLab.Common.Resources.VSImageLibrary.BatchRunPaused;
    148         else if (ExecutionState == ExecutionState.Stopped)
    149           return HeuristicLab.Common.Resources.VSImageLibrary.BatchRunStopped;
    150         else return base.ItemImage;
    151       }
    152     }
    153 
    154     #region Events
    155 
    156     public ExecutionState ExecutionState { get; private set; }
    157     public event EventHandler ExecutionStateChanged;
    158     public event EventHandler ExecutionTimeChanged;
    159     public event EventHandler Prepared;
    160     public event EventHandler Started;
    161     public event EventHandler Paused;
    162     public event EventHandler Stopped;
    163     public event EventHandler<EventArgs<Exception>> ExceptionOccurred;
    164 
    165 
    166     #region event firing
    167 
    168     protected override void OnNameChanged() {
    169       base.OnNameChanged();
    170     }
    171 
    172     private void OnExecutionStateChanged() {
    173       EventHandler handler = ExecutionStateChanged;
     381    private void OnDatastreamChanged() {
     382      var changed = DatastreamChanged;
     383      if (changed != null)
     384        changed(this, EventArgs.Empty);
     385    }
     386
     387    #endregion
     388
     389    #endregion
     390
     391    #region nameditem
     392
     393    [Storable] protected string name;
     394
     395    /// <inheritdoc/>
     396    /// <remarks>Calls <see cref="OnNameChanging"/> and also <see cref="OnNameChanged"/>
     397    /// eventually in the setter.</remarks>
     398    public string Name {
     399      get { return name; }
     400      set {
     401        if (!CanChangeName) throw new NotSupportedException("Name cannot be changed.");
     402        if (!(name.Equals(value) || (value == null) && (name == string.Empty))) {
     403          CancelEventArgs<string> e = value == null
     404            ? new CancelEventArgs<string>(string.Empty)
     405            : new CancelEventArgs<string>(value);
     406          OnNameChanging(e);
     407          if (!e.Cancel) {
     408            name = value == null ? string.Empty : value;
     409            OnNameChanged();
     410          }
     411        }
     412      }
     413    }
     414
     415    public virtual bool CanChangeName {
     416      get { return true; }
     417    }
     418
     419    [Storable] protected string description;
     420
     421    public string Description {
     422      get { return description; }
     423      set {
     424        if (!CanChangeDescription) throw new NotSupportedException("Description cannot be changed.");
     425        if (!(description.Equals(value) || (value == null) && (description == string.Empty))) {
     426          description = value == null ? string.Empty : value;
     427          OnDescriptionChanged();
     428        }
     429      }
     430    }
     431
     432    public virtual bool CanChangeDescription {
     433      get { return true; }
     434    }
     435
     436    /// <summary>
     437    /// Gets the string representation of the current instance in the format: <c>Name: [null|Value]</c>.
     438    /// </summary>
     439    /// <returns>The current instance as a string.</returns>
     440    public override string ToString() {
     441      return Name;
     442    }
     443
     444    /// <inheritdoc/>
     445    public event EventHandler<CancelEventArgs<string>> NameChanging;
     446
     447    /// <summary>
     448    /// Fires a new <c>NameChanging</c> event.
     449    /// </summary>
     450    /// <param name="e">The event arguments of the changing.</param>
     451    protected virtual void OnNameChanging(CancelEventArgs<string> e) {
     452      var handler = NameChanging;
     453      if (handler != null) handler(this, e);
     454    }
     455
     456    /// <inheritdoc/>
     457    public event EventHandler NameChanged;
     458
     459    /// <summary>
     460    /// Fires a new <c>NameChanged</c> event.
     461    /// </summary>
     462    /// <remarks>Calls <see cref="ItemBase.OnChanged"/>.</remarks>
     463    protected virtual void OnNameChanged() {
     464      var handler = NameChanged;
    174465      if (handler != null) handler(this, EventArgs.Empty);
    175     }
    176 
    177     private void OnExecutionTimeChanged() {
    178       EventHandler handler = ExecutionTimeChanged;
     466      OnToStringChanged();
     467    }
     468
     469    /// <inheritdoc/>
     470    public event EventHandler DescriptionChanged;
     471
     472    /// <summary>
     473    /// Fires a new <c>DescriptionChanged</c> event.
     474    /// </summary>
     475    /// <remarks>Calls <see cref="ItemBase.OnChanged"/>.</remarks>
     476    protected virtual void OnDescriptionChanged() {
     477      var handler = DescriptionChanged;
    179478      if (handler != null) handler(this, EventArgs.Empty);
    180479    }
    181480
    182     private void OnPrepared() {
    183       ExecutionState = ExecutionState.Prepared;
    184       EventHandler handler = Prepared;
    185       if (handler != null) handler(this, EventArgs.Empty);
    186     }
    187 
    188     private void OnStarted() {
    189       ExecutionState = ExecutionState.Started;
    190       EventHandler handler = Started;
    191       if (handler != null) handler(this, EventArgs.Empty);
    192     }
    193 
    194     private void OnPaused() {
    195       ExecutionState = ExecutionState.Paused;
    196       EventHandler handler = Paused;
    197       if (handler != null) handler(this, EventArgs.Empty);
    198     }
    199 
    200     private void OnStopped() {
    201       ExecutionState = ExecutionState.Stopped;
    202       EventHandler handler = Stopped;
    203       if (handler != null) handler(this, EventArgs.Empty);
    204     }
    205 
    206     private void OnExceptionOccurred(Exception exception) {
    207       EventHandler<EventArgs<Exception>> handler = ExceptionOccurred;
    208       if (handler != null) handler(this, new EventArgs<Exception>(exception));
    209     }
    210 
    211     #endregion
    212 
    213 
    214     #endregion
    215 
     481    #endregion nameditem
    216482  }
    217483}
  • branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/HeuristicLab.DatastreamAnalysis.csproj

    r14491 r14536  
    102102  </ItemGroup>
    103103  <ItemGroup>
     104    <Compile Include="AnalysisBase.cs" />
     105    <Compile Include="Datastream.cs" />
    104106    <Compile Include="DatastreamAnalysisOptimizer.cs" />
     107    <Compile Include="DatastreamAnalysisUtil.cs" />
     108    <Compile Include="IAnalysisBase.cs" />
     109    <Compile Include="IDatastream.cs" />
    105110    <Compile Include="Plugin.cs" />
    106111    <Compile Include="Properties\AssemblyInfo.cs" />
  • branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/HeuristicLab.DatastreamAnalysis.csproj.user

    r14488 r14536  
    44    <StartAction>Program</StartAction>
    55    <StartProgram>C:\dev\workspaces\hl-core\trunk\sources\bin\HeuristicLab 3.3.exe</StartProgram>
     6    <StartArguments>/hidestarter /start:Optimizer</StartArguments>
    67  </PropertyGroup>
    78  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
    89    <StartAction>Program</StartAction>
    910    <StartProgram>C:\dev\workspaces\hl-core\trunk\sources\bin\HeuristicLab 3.3.exe</StartProgram>
     11    <StartArguments>/hidestarter /start:Optimizer</StartArguments>
    1012  </PropertyGroup>
    1113</Project>
  • branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/Plugin.cs

    r14491 r14536  
    2323
    2424namespace HeuristicLab.DatastreamAnalysis {
    25   [Plugin("HeuristicLab.DatastreamAnalysis", "3.4.14.14488")]
     25  [Plugin("HeuristicLab.DatastreamAnalysis", "3.4.14.14491")]
    2626  [PluginFile("HeuristicLab.DatastreamAnalysis-3.4.dll", PluginFileType.Assembly)]
    2727  [PluginDependency("HeuristicLab.Collections", "3.3")]
  • branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/Properties/AssemblyInfo.cs

    r14491 r14536  
    5454// [assembly: AssemblyVersion("1.0.*")]
    5555[assembly: AssemblyVersion("3.4.0.0")]
    56 [assembly: AssemblyFileVersion("3.4.14.14488")]
     56[assembly: AssemblyFileVersion("3.4.14.14491")]
  • branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleModel.cs

    r14491 r14536  
    8282    [StorableHook(HookType.AfterDeserialization)]
    8383    private void AfterDeserialization() {
     84
     85      foreach (var model in Models) {
     86        this.models.Add(model);
     87      }
     88
    8489      // BackwardsCompatibility 3.3.14
    8590      #region Backwards compatible code, remove with 3.4
Note: See TracChangeset for help on using the changeset viewer.