Changeset 12821


Ignore:
Timestamp:
07/30/15 19:40:56 (4 years ago)
Author:
gkronber
Message:

#2434 fixed problems in persistence and cloning and 'data binding' between content and view

Location:
branches/crossvalidation-2434
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/crossvalidation-2434/HeuristicLab.Algorithms.DataAnalysis.Views/3.4/CrossValidationView.cs

    r12800 r12821  
    6262        storeAlgorithmInEachRunCheckBox.Checked = true;
    6363      } else {
     64        disableUpdateToContent = true; // don't propagate changes from GUI elements back to the content
    6465        Locked = ReadOnly = Content.ExecutionState == ExecutionState.Started;
    6566        workersNumericUpDown.Value = Content.NumberOfWorkers.Value;
    66         foldsNumericUpDown.Value = Content.Folds;
    6767        samplesStartStringConvertibleValueView.Content = Content.SamplesStart;
    6868        samplesEndStringConvertibleValueView.Content = Content.SamplesEnd;
    6969        UpdateAlgorithmView();
    7070        UpdateProblemView();
     71        UpdateFolds();
    7172        runCollectionView.Content = Content.Runs;
    7273        algorithmParameterCollectionView.Content = ((IParameterizedNamedItem)Content).Parameters;
     
    7475        executionTimeTextBox.Text = Content.ExecutionTime.ToString();
    7576        storeAlgorithmInEachRunCheckBox.Checked = Content.StoreAlgorithmInEachRun;
     77        disableUpdateToContent = false;
    7678      }
    7779    }
     
    147149    #region Content Events
    148150    private void Content_AlgorithmChanged(object sender, EventArgs e) {
     151      disableUpdateToContent = true;
    149152      UpdateAlgorithmView();
    150153      UpdateFolds();
    151154      UpdateProblemView();
    152155      SetEnabledStateOfControls();
     156      disableUpdateToContent = false;
    153157    }
    154158    private void UpdateAlgorithmView() {
     
    162166    private void Content_ProblemChanged(object sender, EventArgs e) {
    163167      if (Content.Problem != null) Content.Problem.Reset += Content_ProblemReset;
     168      disableUpdateToContent = true;
    164169      UpdateFolds();
    165170      UpdateProblemView();
    166171      SetEnabledStateOfControls();
     172      disableUpdateToContent = false;
    167173    }
    168174
    169175    private void Content_ProblemReset(object sender, EventArgs e) {
     176      disableUpdateToContent = true;
    170177      UpdateFolds();
     178      disableUpdateToContent = false;
    171179    }
    172180
     
    180188
    181189    private void Content_FoldsChanged(object sender, EventArgs e) {
     190      disableUpdateToContent = true;
    182191      UpdateFolds();
     192      disableUpdateToContent = false;
    183193    }
    184194
     
    193203        partitionVariableComboBox.Items.Clear();
    194204        partitionVariableComboBox.Items.Add(CrossValidation.NoPartitionVariable);
    195         var ds = Content.Problem.ProblemData.Dataset;
    196         var rows = Enumerable.Range(Content.SamplesStart.Value, Content.SamplesEnd.Value - Content.SamplesStart.Value);
    197         foreach (var variable in Content.Problem.ProblemData.Dataset.DoubleVariables) {
    198           if (Content.Problem.ProblemData.AllowedInputVariables.Contains(variable)) continue;
    199           int distinctValues = ds.GetDoubleValues(variable, rows).Distinct().Count();
    200           if (distinctValues < 2 || distinctValues > 20) continue;
    201           partitionVariableComboBox.Items.Add(variable);
     205        if (Content.Problem != null) {
     206          var ds = Content.Problem.ProblemData.Dataset;
     207          var rows = Enumerable.Range(Content.SamplesStart.Value, Content.SamplesEnd.Value - Content.SamplesStart.Value);
     208          foreach (var variable in Content.Problem.ProblemData.Dataset.DoubleVariables) {
     209            if (Content.Problem.ProblemData.AllowedInputVariables.Contains(variable)) continue;
     210            int distinctValues = ds.GetDoubleValues(variable, rows).Distinct().Count();
     211            if (distinctValues < 2 || distinctValues > 20) continue;
     212            partitionVariableComboBox.Items.Add(variable);
     213          }
    202214        }
    203215        partitionVariableComboBox.SelectedItem = Content.PartitionVariable;
     
    256268    }
    257269    private void workersNumericUpDown_ValueChanged(object sender, EventArgs e) {
    258       if (Content != null)
     270      if (Content != null && !disableUpdateToContent)
    259271        Content.NumberOfWorkers.Value = (int)workersNumericUpDown.Value;
    260272    }
  • branches/crossvalidation-2434/HeuristicLab.Algorithms.DataAnalysis/3.4/CrossValidation.cs

    r12814 r12821  
    9191
    9292      folds = original.folds;
     93      partitionVariable = original.partitionVariable;
    9394      numberOfWorkers = cloner.Clone(original.numberOfWorkers);
    9495      samplesStart = cloner.Clone(original.samplesStart);
     
    195196    }
    196197
    197     [Storable]
    198198    // folds are either specified explicitly or by a variable from the dataset
    199199    public const string NoPartitionVariable = "<none>";
     200    [Storable]
    200201    private string partitionVariable = NoPartitionVariable;
    201202    public string PartitionVariable {
Note: See TracChangeset for help on using the changeset viewer.