Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4567


Ignore:
Timestamp:
10/07/10 10:07:12 (14 years ago)
Author:
mkommend
Message:

Filled ResultCollection in CrossValidation (ticket #1199).

Location:
branches/HeuristicLab.Classification
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Classification/HeuristicLab.Algorithms.DataAnalysis.Views/3.3/CrossValidationView.Designer.cs

    r4561 r4567  
    7373      this.openAlgorithmButton = new System.Windows.Forms.Button();
    7474      this.newAlgorithmButton = new System.Windows.Forms.Button();
    75       this.foldsTabPage = new System.Windows.Forms.TabPage();
    76       this.algorithmResultsCollectionView = new HeuristicLab.Algorithms.DataAnalysis.Views.AlgorithmResultsCollectionView();
     75      this.resultsTabPage = new System.Windows.Forms.TabPage();
    7776      this.runsTabPage = new System.Windows.Forms.TabPage();
    7877      this.storeAlgorithmInEachRunCheckBox = new System.Windows.Forms.CheckBox();
    7978      this.runCollectionView = new HeuristicLab.Optimization.Views.RunCollectionView();
    8079      this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
     80      this.splitContainer = new System.Windows.Forms.SplitContainer();
     81      this.resultCollectionView = new HeuristicLab.Optimization.Views.ResultCollectionView();
    8182      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    8283      ((System.ComponentModel.ISupportInitialize)(this.foldsNumericUpDown)).BeginInit();
     
    8788      this.algorithmProblemTabPage.SuspendLayout();
    8889      this.algorithmParametersTabPage.SuspendLayout();
    89       this.foldsTabPage.SuspendLayout();
     90      this.resultsTabPage.SuspendLayout();
    9091      this.runsTabPage.SuspendLayout();
     92      this.splitContainer.Panel1.SuspendLayout();
     93      this.splitContainer.Panel2.SuspendLayout();
     94      this.splitContainer.SuspendLayout();
    9195      this.SuspendLayout();
    9296      //
     
    96100      this.errorProvider.SetIconPadding(this.nameTextBox, 2);
    97101      this.nameTextBox.Location = new System.Drawing.Point(80, 0);
    98       this.nameTextBox.Size = new System.Drawing.Size(531, 20);
     102      this.nameTextBox.Size = new System.Drawing.Size(533, 20);
    99103      //
    100104      // descriptionTextBox
    101105      //
    102106      this.descriptionTextBox.Location = new System.Drawing.Point(80, 26);
    103       this.descriptionTextBox.Size = new System.Drawing.Size(531, 20);
     107      this.descriptionTextBox.Size = new System.Drawing.Size(533, 20);
    104108      //
    105109      // startButton
     
    150154      //
    151155      this.executionTimeTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    152       this.executionTimeTextBox.Location = new System.Drawing.Point(476, 517);
     156      this.executionTimeTextBox.Location = new System.Drawing.Point(478, 517);
    153157      this.executionTimeTextBox.Name = "executionTimeTextBox";
    154158      this.executionTimeTextBox.ReadOnly = true;
     
    160164      this.executionTimeLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    161165      this.executionTimeLabel.AutoSize = true;
    162       this.executionTimeLabel.Location = new System.Drawing.Point(387, 520);
     166      this.executionTimeLabel.Location = new System.Drawing.Point(389, 520);
    163167      this.executionTimeLabel.Name = "executionTimeLabel";
    164168      this.executionTimeLabel.Size = new System.Drawing.Size(83, 13);
     
    170174      this.foldsNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    171175                  | System.Windows.Forms.AnchorStyles.Right)));
    172       this.foldsNumericUpDown.Location = new System.Drawing.Point(389, 79);
     176      this.foldsNumericUpDown.Location = new System.Drawing.Point(55, 26);
    173177      this.foldsNumericUpDown.Maximum = new decimal(new int[] {
    174178            50,
     
    182186            0});
    183187      this.foldsNumericUpDown.Name = "foldsNumericUpDown";
    184       this.foldsNumericUpDown.Size = new System.Drawing.Size(222, 20);
     188      this.foldsNumericUpDown.Size = new System.Drawing.Size(248, 20);
    185189      this.foldsNumericUpDown.TabIndex = 18;
    186190      this.foldsNumericUpDown.ThousandsSeparator = true;
     
    196200      //
    197201      this.foldsLabel.AutoSize = true;
    198       this.foldsLabel.Location = new System.Drawing.Point(333, 80);
     202      this.foldsLabel.Location = new System.Drawing.Point(3, 29);
    199203      this.foldsLabel.Name = "foldsLabel";
    200204      this.foldsLabel.Size = new System.Drawing.Size(35, 13);
     
    206210      this.workersNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    207211                  | System.Windows.Forms.AnchorStyles.Right)));
    208       this.workersNumericUpDown.Location = new System.Drawing.Point(389, 53);
     212      this.workersNumericUpDown.Location = new System.Drawing.Point(55, 0);
    209213      this.workersNumericUpDown.Maximum = new decimal(new int[] {
    210214            50,
     
    218222            0});
    219223      this.workersNumericUpDown.Name = "workersNumericUpDown";
    220       this.workersNumericUpDown.Size = new System.Drawing.Size(222, 20);
     224      this.workersNumericUpDown.Size = new System.Drawing.Size(248, 20);
    221225      this.workersNumericUpDown.TabIndex = 20;
    222226      this.workersNumericUpDown.ThousandsSeparator = true;
     
    232236      //
    233237      this.workersLabel.AutoSize = true;
    234       this.workersLabel.Location = new System.Drawing.Point(333, 55);
     238      this.workersLabel.Location = new System.Drawing.Point(3, 3);
    235239      this.workersLabel.Name = "workersLabel";
    236240      this.workersLabel.Size = new System.Drawing.Size(50, 13);
     
    241245      //
    242246      this.samplesStartLabel.AutoSize = true;
    243       this.samplesStartLabel.Location = new System.Drawing.Point(3, 55);
     247      this.samplesStartLabel.Location = new System.Drawing.Point(3, 3);
    244248      this.samplesStartLabel.Name = "samplesStartLabel";
    245249      this.samplesStartLabel.Size = new System.Drawing.Size(75, 13);
     
    250254      //
    251255      this.samplesEndLabel.AutoSize = true;
    252       this.samplesEndLabel.Location = new System.Drawing.Point(3, 80);
     256      this.samplesEndLabel.Location = new System.Drawing.Point(3, 29);
    253257      this.samplesEndLabel.Name = "samplesEndLabel";
    254258      this.samplesEndLabel.Size = new System.Drawing.Size(72, 13);
     
    258262      // samplesEndStringConvertibleValueView
    259263      //
     264      this.samplesEndStringConvertibleValueView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     265                  | System.Windows.Forms.AnchorStyles.Right)));
    260266      this.samplesEndStringConvertibleValueView.Caption = "StringConvertibleValue View";
    261267      this.samplesEndStringConvertibleValueView.Content = null;
    262268      this.samplesEndStringConvertibleValueView.LabelVisible = false;
    263       this.samplesEndStringConvertibleValueView.Location = new System.Drawing.Point(80, 79);
     269      this.samplesEndStringConvertibleValueView.Location = new System.Drawing.Point(80, 26);
    264270      this.samplesEndStringConvertibleValueView.Name = "samplesEndStringConvertibleValueView";
    265271      this.samplesEndStringConvertibleValueView.ReadOnly = false;
    266       this.samplesEndStringConvertibleValueView.Size = new System.Drawing.Size(247, 18);
     272      this.samplesEndStringConvertibleValueView.Size = new System.Drawing.Size(223, 20);
    267273      this.samplesEndStringConvertibleValueView.TabIndex = 24;
    268274      //
    269275      // samplesStartStringConvertibleValueView
    270276      //
     277      this.samplesStartStringConvertibleValueView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     278                  | System.Windows.Forms.AnchorStyles.Right)));
    271279      this.samplesStartStringConvertibleValueView.Caption = "StringConvertibleValue View";
    272280      this.samplesStartStringConvertibleValueView.Content = null;
    273281      this.samplesStartStringConvertibleValueView.LabelVisible = false;
    274       this.samplesStartStringConvertibleValueView.Location = new System.Drawing.Point(80, 54);
     282      this.samplesStartStringConvertibleValueView.Location = new System.Drawing.Point(80, 0);
    275283      this.samplesStartStringConvertibleValueView.Name = "samplesStartStringConvertibleValueView";
    276284      this.samplesStartStringConvertibleValueView.ReadOnly = false;
    277       this.samplesStartStringConvertibleValueView.Size = new System.Drawing.Size(247, 18);
     285      this.samplesStartStringConvertibleValueView.Size = new System.Drawing.Size(223, 20);
    278286      this.samplesStartStringConvertibleValueView.TabIndex = 22;
    279287      //
     
    284292                  | System.Windows.Forms.AnchorStyles.Right)));
    285293      this.tabControl.Controls.Add(this.algorithmTabPage);
    286       this.tabControl.Controls.Add(this.foldsTabPage);
     294      this.tabControl.Controls.Add(this.resultsTabPage);
    287295      this.tabControl.Controls.Add(this.runsTabPage);
    288       this.tabControl.Location = new System.Drawing.Point(0, 105);
     296      this.tabControl.Location = new System.Drawing.Point(0, 113);
    289297      this.tabControl.Name = "tabControl";
    290298      this.tabControl.SelectedIndex = 0;
    291       this.tabControl.Size = new System.Drawing.Size(614, 403);
     299      this.tabControl.Size = new System.Drawing.Size(616, 395);
    292300      this.tabControl.TabIndex = 25;
    293301      //
     
    302310      this.algorithmTabPage.Name = "algorithmTabPage";
    303311      this.algorithmTabPage.Padding = new System.Windows.Forms.Padding(3);
    304       this.algorithmTabPage.Size = new System.Drawing.Size(606, 377);
     312      this.algorithmTabPage.Size = new System.Drawing.Size(608, 369);
    305313      this.algorithmTabPage.TabIndex = 0;
    306314      this.algorithmTabPage.Text = "Algorithm";
     
    319327      this.algorithmNamedItemView.Name = "algorithmNamedItemView";
    320328      this.algorithmNamedItemView.ReadOnly = false;
    321       this.algorithmNamedItemView.Size = new System.Drawing.Size(594, 52);
     329      this.algorithmNamedItemView.Size = new System.Drawing.Size(596, 52);
    322330      this.algorithmNamedItemView.TabIndex = 29;
    323331      //
     
    332340      this.algorithmTabControl.Name = "algorithmTabControl";
    333341      this.algorithmTabControl.SelectedIndex = 0;
    334       this.algorithmTabControl.Size = new System.Drawing.Size(592, 277);
     342      this.algorithmTabControl.Size = new System.Drawing.Size(594, 269);
    335343      this.algorithmTabControl.TabIndex = 28;
    336344      //
     
    343351      this.algorithmProblemTabPage.Name = "algorithmProblemTabPage";
    344352      this.algorithmProblemTabPage.Padding = new System.Windows.Forms.Padding(3);
    345       this.algorithmProblemTabPage.Size = new System.Drawing.Size(584, 251);
     353      this.algorithmProblemTabPage.Size = new System.Drawing.Size(586, 243);
    346354      this.algorithmProblemTabPage.TabIndex = 0;
    347355      this.algorithmProblemTabPage.Text = "Problem";
     
    373381      this.algorithmProblemViewHost.Name = "algorithmProblemViewHost";
    374382      this.algorithmProblemViewHost.ReadOnly = false;
    375       this.algorithmProblemViewHost.Size = new System.Drawing.Size(572, 209);
     383      this.algorithmProblemViewHost.Size = new System.Drawing.Size(574, 201);
    376384      this.algorithmProblemViewHost.TabIndex = 0;
    377385      this.algorithmProblemViewHost.ViewType = null;
     
    394402      this.algorithmParametersTabPage.Name = "algorithmParametersTabPage";
    395403      this.algorithmParametersTabPage.Padding = new System.Windows.Forms.Padding(3);
    396       this.algorithmParametersTabPage.Size = new System.Drawing.Size(584, 251);
     404      this.algorithmParametersTabPage.Size = new System.Drawing.Size(586, 243);
    397405      this.algorithmParametersTabPage.TabIndex = 1;
    398406      this.algorithmParametersTabPage.Text = "Parameters";
     
    407415      this.algorithmParameterCollectionView.Name = "algorithmParameterCollectionView";
    408416      this.algorithmParameterCollectionView.ReadOnly = false;
    409       this.algorithmParameterCollectionView.Size = new System.Drawing.Size(578, 245);
     417      this.algorithmParameterCollectionView.Size = new System.Drawing.Size(580, 237);
    410418      this.algorithmParameterCollectionView.TabIndex = 0;
    411419      //
     
    432440      this.newAlgorithmButton.Click += new System.EventHandler(this.newAlgorithmButton_Click);
    433441      //
    434       // foldsTabPage
    435       //
    436       this.foldsTabPage.Controls.Add(this.algorithmResultsCollectionView);
    437       this.foldsTabPage.Location = new System.Drawing.Point(4, 22);
    438       this.foldsTabPage.Name = "foldsTabPage";
    439       this.foldsTabPage.Padding = new System.Windows.Forms.Padding(3);
    440       this.foldsTabPage.Size = new System.Drawing.Size(606, 377);
    441       this.foldsTabPage.TabIndex = 1;
    442       this.foldsTabPage.Text = "Folds";
    443       this.foldsTabPage.UseVisualStyleBackColor = true;
    444       //
    445       // algorithmResultsCollectionView
    446       //
    447       this.algorithmResultsCollectionView.Caption = "View";
    448       this.algorithmResultsCollectionView.Content = null;
    449       this.algorithmResultsCollectionView.Dock = System.Windows.Forms.DockStyle.Fill;
    450       this.algorithmResultsCollectionView.Location = new System.Drawing.Point(3, 3);
    451       this.algorithmResultsCollectionView.Name = "algorithmResultsCollectionView";
    452       this.algorithmResultsCollectionView.ReadOnly = true;
    453       this.algorithmResultsCollectionView.Size = new System.Drawing.Size(600, 371);
    454       this.algorithmResultsCollectionView.TabIndex = 0;
     442      // resultsTabPage
     443      //
     444      this.resultsTabPage.Controls.Add(this.resultCollectionView);
     445      this.resultsTabPage.Location = new System.Drawing.Point(4, 22);
     446      this.resultsTabPage.Name = "resultsTabPage";
     447      this.resultsTabPage.Padding = new System.Windows.Forms.Padding(3);
     448      this.resultsTabPage.Size = new System.Drawing.Size(608, 369);
     449      this.resultsTabPage.TabIndex = 1;
     450      this.resultsTabPage.Text = "Results";
     451      this.resultsTabPage.UseVisualStyleBackColor = true;
    455452      //
    456453      // runsTabPage
     
    461458      this.runsTabPage.Name = "runsTabPage";
    462459      this.runsTabPage.Padding = new System.Windows.Forms.Padding(3);
    463       this.runsTabPage.Size = new System.Drawing.Size(606, 377);
     460      this.runsTabPage.Size = new System.Drawing.Size(608, 369);
    464461      this.runsTabPage.TabIndex = 2;
    465462      this.runsTabPage.Text = "Runs";
     
    490487      this.runCollectionView.Name = "runCollectionView";
    491488      this.runCollectionView.ReadOnly = false;
    492       this.runCollectionView.Size = new System.Drawing.Size(600, 371);
     489      this.runCollectionView.Size = new System.Drawing.Size(602, 363);
    493490      this.runCollectionView.TabIndex = 3;
    494491      //
     
    499496      this.openFileDialog.Filter = "HeuristicLab Files|*.hl|All Files|*.*";
    500497      this.openFileDialog.Title = "Open Algorithm";
     498      //
     499      // splitContainer
     500      //
     501      this.splitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     502                  | System.Windows.Forms.AnchorStyles.Right)));
     503      this.splitContainer.Location = new System.Drawing.Point(0, 52);
     504      this.splitContainer.Name = "splitContainer";
     505      //
     506      // splitContainer.Panel1
     507      //
     508      this.splitContainer.Panel1.Controls.Add(this.samplesEndStringConvertibleValueView);
     509      this.splitContainer.Panel1.Controls.Add(this.samplesStartStringConvertibleValueView);
     510      this.splitContainer.Panel1.Controls.Add(this.samplesStartLabel);
     511      this.splitContainer.Panel1.Controls.Add(this.samplesEndLabel);
     512      //
     513      // splitContainer.Panel2
     514      //
     515      this.splitContainer.Panel2.Controls.Add(this.foldsNumericUpDown);
     516      this.splitContainer.Panel2.Controls.Add(this.foldsLabel);
     517      this.splitContainer.Panel2.Controls.Add(this.workersLabel);
     518      this.splitContainer.Panel2.Controls.Add(this.workersNumericUpDown);
     519      this.splitContainer.Size = new System.Drawing.Size(616, 55);
     520      this.splitContainer.SplitterDistance = 306;
     521      this.splitContainer.TabIndex = 26;
     522      //
     523      // resultCollectionView
     524      //
     525      this.resultCollectionView.Caption = "ResultCollection View";
     526      this.resultCollectionView.Content = null;
     527      this.resultCollectionView.Dock = System.Windows.Forms.DockStyle.Fill;
     528      this.resultCollectionView.Location = new System.Drawing.Point(3, 3);
     529      this.resultCollectionView.Name = "resultCollectionView";
     530      this.resultCollectionView.ReadOnly = true;
     531      this.resultCollectionView.Size = new System.Drawing.Size(602, 363);
     532      this.resultCollectionView.TabIndex = 0;
    501533      //
    502534      // CrossValidationView
     
    507539      this.Controls.Add(this.executionTimeTextBox);
    508540      this.Controls.Add(this.executionTimeLabel);
    509       this.Controls.Add(this.samplesStartStringConvertibleValueView);
    510541      this.Controls.Add(this.startButton);
    511       this.Controls.Add(this.workersNumericUpDown);
    512       this.Controls.Add(this.workersLabel);
    513       this.Controls.Add(this.samplesEndStringConvertibleValueView);
    514       this.Controls.Add(this.samplesEndLabel);
    515542      this.Controls.Add(this.pauseButton);
    516       this.Controls.Add(this.foldsNumericUpDown);
    517       this.Controls.Add(this.foldsLabel);
    518       this.Controls.Add(this.samplesStartLabel);
    519543      this.Controls.Add(this.stopButton);
    520544      this.Controls.Add(this.resetButton);
     545      this.Controls.Add(this.splitContainer);
    521546      this.Name = "CrossValidationView";
    522       this.Size = new System.Drawing.Size(614, 538);
     547      this.Size = new System.Drawing.Size(616, 538);
     548      this.Controls.SetChildIndex(this.splitContainer, 0);
    523549      this.Controls.SetChildIndex(this.resetButton, 0);
    524550      this.Controls.SetChildIndex(this.stopButton, 0);
    525       this.Controls.SetChildIndex(this.samplesStartLabel, 0);
    526       this.Controls.SetChildIndex(this.foldsLabel, 0);
    527       this.Controls.SetChildIndex(this.foldsNumericUpDown, 0);
    528551      this.Controls.SetChildIndex(this.pauseButton, 0);
    529       this.Controls.SetChildIndex(this.samplesEndLabel, 0);
    530       this.Controls.SetChildIndex(this.samplesEndStringConvertibleValueView, 0);
    531       this.Controls.SetChildIndex(this.workersLabel, 0);
    532       this.Controls.SetChildIndex(this.workersNumericUpDown, 0);
    533552      this.Controls.SetChildIndex(this.startButton, 0);
    534       this.Controls.SetChildIndex(this.samplesStartStringConvertibleValueView, 0);
    535553      this.Controls.SetChildIndex(this.executionTimeLabel, 0);
    536554      this.Controls.SetChildIndex(this.executionTimeTextBox, 0);
     
    548566      this.algorithmProblemTabPage.ResumeLayout(false);
    549567      this.algorithmParametersTabPage.ResumeLayout(false);
    550       this.foldsTabPage.ResumeLayout(false);
     568      this.resultsTabPage.ResumeLayout(false);
    551569      this.runsTabPage.ResumeLayout(false);
    552570      this.runsTabPage.PerformLayout();
     571      this.splitContainer.Panel1.ResumeLayout(false);
     572      this.splitContainer.Panel1.PerformLayout();
     573      this.splitContainer.Panel2.ResumeLayout(false);
     574      this.splitContainer.Panel2.PerformLayout();
     575      this.splitContainer.ResumeLayout(false);
    553576      this.ResumeLayout(false);
    554577      this.PerformLayout();
     
    558581    #endregion
    559582
    560     private AlgorithmResultsCollectionView algorithmResultsCollectionView;
    561583    private System.Windows.Forms.Button startButton;
    562584    private System.Windows.Forms.Button pauseButton;
     
    575597    private System.Windows.Forms.TabControl tabControl;
    576598    private System.Windows.Forms.TabPage algorithmTabPage;
    577     private System.Windows.Forms.TabPage foldsTabPage;
     599    private System.Windows.Forms.TabPage resultsTabPage;
    578600    private System.Windows.Forms.Button openAlgorithmButton;
    579601    private System.Windows.Forms.Button newAlgorithmButton;
     
    590612    private Optimization.Views.RunCollectionView runCollectionView;
    591613    private System.Windows.Forms.CheckBox storeAlgorithmInEachRunCheckBox;
     614    private System.Windows.Forms.SplitContainer splitContainer;
     615    private Optimization.Views.ResultCollectionView resultCollectionView;
    592616  }
    593617}
  • branches/HeuristicLab.Classification/HeuristicLab.Algorithms.DataAnalysis.Views/3.3/CrossValidationView.cs

    r4563 r4567  
    5050      base.OnContentChanged();
    5151      if (Content == null) {
    52         workersNumericUpDown.Value = 0;
    53         foldsNumericUpDown.Value = 0;
     52        workersNumericUpDown.Value = 1;
     53        foldsNumericUpDown.Value = 2;
    5454        samplesStartStringConvertibleValueView.Content = null;
    5555        samplesEndStringConvertibleValueView.Content = null;
     
    5757        algorithmProblemViewHost.Content = null;
    5858        algorithmParameterCollectionView.Content = null;
    59         algorithmResultsCollectionView.Content = null;
     59        resultCollectionView.Content = null;
    6060        runCollectionView.Content = null;
    6161        storeAlgorithmInEachRunCheckBox.Checked = true;
     
    7070        runCollectionView.Content = Content.Runs;
    7171        algorithmParameterCollectionView.Content = ((IParameterizedNamedItem)Content).Parameters;
    72         algorithmResultsCollectionView.Content = Content.ClonedAlgorithms;
     72        resultCollectionView.Content = Content.Results;
    7373        executionTimeTextBox.Text = Content.ExecutionTime.ToString();
    7474        storeAlgorithmInEachRunCheckBox.Checked = Content.StoreAlgorithmInEachRun;
     
    349349    }
    350350    #endregion
     351
    351352  }
    352353}
  • branches/HeuristicLab.Classification/HeuristicLab.Algorithms.DataAnalysis/3.3/CrossValidation.cs

    r4563 r4567  
    4343
    4444      executionState = ExecutionState.Stopped;
    45       executionTime = TimeSpan.Zero;
    4645      runs = new RunCollection();
    4746      runsCounter = 0;
     
    7372    public override IDeepCloneable Clone(Cloner cloner) {
    7473      CrossValidation clone = (CrossValidation)base.Clone(cloner);
    75       clone.DeregisterEvents(); //not necessary
    7674      clone.executionState = executionState;
    77       clone.executionTime = executionTime;
    7875      clone.storeAlgorithmInEachRun = storeAlgorithmInEachRun;
    7976      clone.runs = (RunCollection)cloner.Clone(runs);
     
    8885      return clone;
    8986    }
    90 
    9187    #endregion
    9288
     
    228224    }
    229225
    230     [Storable]
    231     private TimeSpan executionTime;
    232226    public TimeSpan ExecutionTime {
    233227      get {
    234         if (ExecutionState != ExecutionState.Stopped && ExecutionState != ExecutionState.Prepared)
    235           return executionTime + TimeSpan.FromMilliseconds(clonedAlgorithms.Select(x => x.ExecutionTime.TotalMilliseconds).Sum());
    236         else
    237           return executionTime;
    238       }
    239       private set {
    240         executionTime = value;
    241         OnExecutionTimeChanged();
     228        if (ExecutionState != ExecutionState.Prepared)
     229          return TimeSpan.FromMilliseconds(clonedAlgorithms.Select(x => x.ExecutionTime.TotalMilliseconds).Sum());
     230        return TimeSpan.Zero;
    242231      }
    243232    }
     
    247236      if (ExecutionState == ExecutionState.Started)
    248237        throw new InvalidOperationException(string.Format("Prepare not allowed in execution state \"{0}\".", ExecutionState));
     238      results.Clear();
    249239      clonedAlgorithms.Clear();
    250240      if (Algorithm != null) {
     
    357347        results.Add(result.Name, result.Value);
    358348
    359       results.Add("Execution Time", new TimeSpanValue(TimeSpan.FromMilliseconds(clonedAlgorithms.Select(x => x.ExecutionTime.TotalMilliseconds).Sum())));
     349      results.Add("Execution Time", new TimeSpanValue(this.ExecutionTime));
    360350      results.Add("CrossValidation Folds", new RunCollection(runs));
    361351    }
     
    395385      else throw new NotSupportedException("Could not convert any item type to double");
    396386    }
    397 
    398387    #endregion
    399388
     
    404393      SamplesEnd.ValueChanged += new EventHandler(SamplesEnd_ValueChanged);
    405394      RegisterClonedAlgorithmsEvents();
    406       RegisterRunsEvents();
    407     }
    408     private void DeregisterEvents() {
    409       Folds.ValueChanged -= new EventHandler(Folds_ValueChanged);
    410       SamplesStart.ValueChanged -= new EventHandler(SamplesStart_ValueChanged);
    411       SamplesEnd.ValueChanged -= new EventHandler(SamplesEnd_ValueChanged);
    412       DeregisterClonedAlgorithmsEvents();
    413       DeregisterRunsEvents();
    414 
    415395    }
    416396    private void Folds_ValueChanged(object sender, EventArgs e) {
     
    526506    private void ClonedAlgorithm_Started(object sender, EventArgs e) {
    527507      lock (locker) {
     508        IAlgorithm algorithm = sender as IAlgorithm;
     509        if (algorithm != null && !results.ContainsKey(algorithm.Name))
     510          results.Add(new Result(algorithm.Name, "Contains results for the specific fold.", algorithm.Results));
     511
    528512        if (startPending) {
    529513          int startedAlgorithms = clonedAlgorithms.Count(alg => alg.ExecutionState == ExecutionState.Started);
     
    563547    }
    564548    #endregion
    565 
    566     #region run events
    567     private void RegisterRunsEvents() {
    568       runs.CollectionReset += new CollectionItemsChangedEventHandler<IRun>(Runs_CollectionReset);
    569       runs.ItemsAdded += new CollectionItemsChangedEventHandler<IRun>(Runs_ItemsAdded);
    570       runs.ItemsRemoved += new CollectionItemsChangedEventHandler<IRun>(Runs_ItemsRemoved);
    571     }
    572     private void DeregisterRunsEvents() {
    573       runs.CollectionReset -= new CollectionItemsChangedEventHandler<IRun>(Runs_CollectionReset);
    574       runs.ItemsAdded -= new CollectionItemsChangedEventHandler<IRun>(Runs_ItemsAdded);
    575       runs.ItemsRemoved -= new CollectionItemsChangedEventHandler<IRun>(Runs_ItemsRemoved);
    576     }
    577     private void Runs_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRun> e) {
    578       foreach (IRun run in e.OldItems) {
    579         IItem item;
    580         run.Results.TryGetValue("Execution Time", out item);
    581         TimeSpanValue executionTime = item as TimeSpanValue;
    582         if (executionTime != null) ExecutionTime = this.executionTime - executionTime.Value;
    583       }
    584       foreach (IRun run in e.Items) {
    585         IItem item;
    586         run.Results.TryGetValue("Execution Time", out item);
    587         TimeSpanValue executionTime = item as TimeSpanValue;
    588         if (executionTime != null) ExecutionTime = this.executionTime + executionTime.Value;
    589       }
    590       runsCounter = Runs.Count;
    591     }
    592     private void Runs_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IRun> e) {
    593       foreach (IRun run in e.Items) {
    594         IItem item;
    595         run.Results.TryGetValue("Execution Time", out item);
    596         TimeSpanValue executionTime = item as TimeSpanValue;
    597         if (executionTime != null) this.executionTime = this.executionTime + executionTime.Value;
    598       }
    599     }
    600     private void Runs_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRun> e) {
    601       foreach (IRun run in e.Items) {
    602         IItem item;
    603         run.Results.TryGetValue("Execution Time", out item);
    604         TimeSpanValue executionTime = item as TimeSpanValue;
    605         if (executionTime != null) ExecutionTime = this.executionTime - executionTime.Value;
    606       }
    607     }
    608     #endregion
    609549    #endregion
    610550
     
    625565      EventHandler handler = Prepared;
    626566      if (handler != null) handler(this, EventArgs.Empty);
     567      OnExecutionTimeChanged();
    627568    }
    628569    public event EventHandler Started;
     
    643584    private void OnStopped() {
    644585      stopPending = false;
     586      Dictionary<string, IItem> collectedResults = new Dictionary<string, IItem>();
     587      CollectResultValues(collectedResults);
     588      results.AddRange(collectedResults.Select(x => new Result(x.Key, x.Value)).Cast<IResult>().ToArray());
    645589      runsCounter++;
    646590      runs.Add(new Run(string.Format("{0} Run {1}", Name, runsCounter), this));
Note: See TracChangeset for help on using the changeset viewer.