Free cookie consent management tool by TermsFeed Policy Generator

Changeset 16930


Ignore:
Timestamp:
05/08/19 15:57:35 (5 years ago)
Author:
chaider
Message:

#2971

  • removed setter from VariableRanges and IntervalConstraints
  • changed protected method in sealed class to private
Location:
branches/2971_named_intervals
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/IntervalCollectionView.Designer.cs

    r16904 r16930  
    9090    #endregion
    9191
    92     protected System.Windows.Forms.DataGridView dataGridView;
     92    private System.Windows.Forms.DataGridView dataGridView;
    9393    private System.Windows.Forms.GroupBox groupBox1;
    9494  }
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs

    r16904 r16930  
    107107    public IntervalCollection VariableRanges {
    108108      get => VariableRangesParameter.Value;
    109       set => VariableRanges = value ?? throw new ArgumentNullException("Variable Ranges", "The given variable ranges are null");
    110109    }
    111110
     
    115114    public ProblemDataConstraint IntervalConstraints {
    116115      get => IntervalConstraintsParameter.Value;
    117       set => IntervalConstraints = value ?? throw new ArgumentNullException("IntervalCosntraint", "The given Constraint is null.");
    118116    }
    119117
     
    147145    private void AfterDeserialization() {
    148146      if (!Parameters.ContainsKey(VariableRangesParameterName)) {
    149         var variables = InputVariables.Select(x => x.AsReadOnly()).ToList();
    150         IntervalCollection intervalCollection = new IntervalCollection();
    151         foreach (var variable in variables) {
    152           if (!this.Dataset.DoubleVariables.Contains(variable.Value)) continue; // intervals are only possible for double variables
    153           var variableInterval = Interval.GetInterval(this.Dataset.GetDoubleValues(variable.Value));
    154           intervalCollection.VariableIntervals.Add(variable.Value, variableInterval);
    155         }
    156 
     147        var intervalCollection = CalculateDatasetIntervals(this.Dataset);
    157148        Parameters.Add(new FixedValueParameter<IntervalCollection>(VariableRangesParameterName, intervalCollection));
    158149      }
     
    187178      var variables = InputVariables.Select(x => x.AsReadOnly()).ToList();
    188179      Parameters.Add(new ConstrainedValueParameter<StringValue>(TargetVariableParameterName, new ItemSet<StringValue>(variables), variables.Where(x => x.Value == targetVariable).First()));
    189 
    190       IntervalCollection intervalCollection = new IntervalCollection();
    191       foreach (var variable in variables) {
    192         if (!dataset.DoubleVariables.Contains(variable.Value)) continue; // intervals are only possible for double variables
    193         var variableInterval = Interval.GetInterval(dataset.GetDoubleValues(variable.Value));
    194         intervalCollection.VariableIntervals.Add(variable.Value, variableInterval);
    195       }
    196      
     180      var intervalCollection = CalculateDatasetIntervals(this.Dataset);
    197181      Parameters.Add(new FixedValueParameter<IntervalCollection>(VariableRangesParameterName, intervalCollection));
    198182      Parameters.Add(new FixedValueParameter<ProblemDataConstraint>(IntervalConstraintsParameterName, new ProblemDataConstraint(this)));
     
    200184    }
    201185
     186    private static IntervalCollection CalculateDatasetIntervals(IDataset dataset) {
     187      IntervalCollection intervalCollection = new IntervalCollection();
     188      foreach (var variable in dataset.DoubleVariables) {// intervals are only possible for double variables
     189        var variableInterval = Interval.GetInterval(dataset.GetDoubleValues(variable));
     190        intervalCollection.AddInterval(variable, variableInterval);
     191      }
     192
     193      return intervalCollection;
     194    }
     195
    202196    private void RegisterParameterEvents() {
    203197      TargetVariableParameter.ValueChanged += new EventHandler(TargetVariableParameter_ValueChanged);
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Regression/IRegressionProblemData.cs

    r16904 r16930  
    2828    string TargetVariable { get; set; }
    2929
    30     IntervalCollection VariableRanges { get; set; }
    31     ProblemDataConstraint IntervalConstraints { get; set; }
     30    IntervalCollection VariableRanges { get;}
     31    ProblemDataConstraint IntervalConstraints { get; }
    3232
    3333    IEnumerable<double> TargetVariableValues { get; }
Note: See TracChangeset for help on using the changeset viewer.