Changeset 16921


Ignore:
Timestamp:
05/08/19 13:57:25 (3 months ago)
Author:
chaider
Message:

#2971

  • Changed getInterval method to return Interval instead of KeyValuePair
  • Calling getMethods from IntervalsCollection
Location:
branches/2971_named_intervals
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveConstraintConstOptEvaluator.cs

    r16851 r16921  
    6060
    6161      var constraints = problemData.IntervalConstraints.Constraints.Where(x => x.Enabled);
    62       var variableRanges = problemData.VariableRanges.VariableIntervals;
     62      var variableRanges = problemData.VariableRanges.getIntervals();
    6363
    6464      var r2 = SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, tree, problemData, problemData.TrainingIndices, applyLinearScaling, 10);
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveConstraintPearsonRSquaredEvaluator.cs

    r16851 r16921  
    6161
    6262      var constraints = problemData.IntervalConstraints.Constraints.Where(x => x.Enabled);
    63       var variableRanges = problemData.VariableRanges.VariableIntervals;
     63      var variableRanges = problemData.VariableRanges.getIntervals();
    6464      var tree = solution;
    6565
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionConstraintAnalyzer.cs

    r16851 r16921  
    7272      var results = ResultCollectionParameter.ActualValue;
    7373      var constraints = problemData.IntervalConstraints.Constraints.Where(x => x.Enabled);
    74       var variableRanges = problemData.VariableRanges.VariableIntervals;
     74      var variableRanges = problemData.VariableRanges.getIntervals();
    7575
    7676      if (!results.ContainsKey(ConstraintViolationsResultName)) {
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolution.cs

    r16904 r16921  
    179179      var problemData = solution.ProblemData;
    180180      var model = solution.Model;
    181       var variableRanges = problemData.VariableRanges.VariableIntervals;
     181      var variableRanges = problemData.VariableRanges.getIntervals();
    182182
    183183      intervalEvaluation.VariableIntervals.Add($"Target {problemData.TargetVariable}", new Interval(variableRanges[problemData.TargetVariable].LowerBound, variableRanges[problemData.TargetVariable].UpperBound));
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs

    r16845 r16921  
    213213      if (regressionProblemData != null) {
    214214        var interpreter = new IntervalInterpreter();
    215         var variableRanges = regressionProblemData.VariableRanges.VariableIntervals;
     215        var variableRanges = regressionProblemData.VariableRanges.getIntervals();
    216216        IDictionary<ISymbolicExpressionTreeNode, Interval> intervals;
    217217        interpreter.GetSymbolicExpressionTreeIntervals(tree, variableRanges, out intervals);
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/IntervalCollectionView.cs

    r16904 r16921  
    6969
    7070
    71       var variablesCount = Content.VariableIntervals.Count;
     71      var variablesCount = Content.getIntervals().Count;
    7272
    7373      DataGridViewRow[] rows = new DataGridViewRow[variablesCount];
     
    9393      for (var i = 0; i < dataGridView.RowCount; ++i) {
    9494        var key = (string)dataGridView.Rows[i].HeaderCell.Value;
    95         dataGridView.Rows[i].Cells[0].Value = Content.VariableIntervals[key].LowerBound;
    96         dataGridView.Rows[i].Cells[1].Value = Content.VariableIntervals[key].UpperBound;
     95        dataGridView.Rows[i].Cells[0].Value = Content.getInterval(key).LowerBound;
     96        dataGridView.Rows[i].Cells[1].Value = Content.getInterval(key).UpperBound;
    9797      }
    9898    }
    9999
    100100    private void SetRowsHeader() {
    101       for (var i = 0; i < Content.VariableIntervals.Count; ++i) {
    102         var item = Content.VariableIntervals.ElementAt(i);
     101      for (var i = 0; i < Content.getIntervals().Count; ++i) {
     102        var item = Content.getIntervals().ElementAt(i);
    103103        dataGridView.Rows[i].HeaderCell.Value = item.Key;
    104104      }
     
    115115      if (e.ColumnIndex < 0 || e.RowIndex < 0) return;
    116116
    117       var lowerBound = e.ColumnIndex == 0 ? double.Parse(dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()) : Content.VariableIntervals[key].LowerBound;
    118       var upperBound = e.ColumnIndex == 1 ? double.Parse(dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()) : Content.VariableIntervals[key].UpperBound;
     117      var lowerBound = e.ColumnIndex == 0 ? double.Parse(dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()) : Content.getInterval(key).LowerBound;
     118      var upperBound = e.ColumnIndex == 1 ? double.Parse(dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()) : Content.getInterval(key).UpperBound;
    119119
    120120      // update if there was a change
    121       if (lowerBound != Content.VariableIntervals[key].LowerBound ||
    122         upperBound != Content.VariableIntervals[key].UpperBound)
     121      if (lowerBound != Content.getInterval(key).LowerBound ||
     122        upperBound != Content.getInterval(key).UpperBound)
    123123        Content.VariableIntervals[key] = new Interval(lowerBound, upperBound);
    124124    }
     
    129129        dataGridView.Rows[e.RowIndex].ErrorText = "Value must be a double value.";
    130130        return;
    131       }/* else if (string.IsNullOrEmpty(dataGridView.Rows[e.RowIndex].Cells[0].Value.ToString()) ||
    132         string.IsNullOrEmpty(dataGridView.Rows[e.RowIndex].Cells[1].Value.ToString())) {
    133         // accept any value if one of the cells is still empty
    134       } */else {
     131      } else {
    135132        var lowerBound = double.Parse(dataGridView.Rows[e.RowIndex].Cells[0].Value.ToString());
    136133        var upperBound = double.Parse(dataGridView.Rows[e.RowIndex].Cells[1].Value.ToString());
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval/IntervalCollection.cs

    r16918 r16921  
    6767    }
    6868
    69     public KeyValuePair<string, Interval> getInterval(string variable) {
     69    public Interval getInterval(string variable) {
    7070      if (VariableIntervals.ContainsKey(variable)) {
    71         return new KeyValuePair<string, Interval>(variable, VariableIntervals[variable]);
     71        return VariableIntervals[variable];
    7272      } else {
    7373        throw new ArgumentException($"The given variable:{variable} is not present!");
Note: See TracChangeset for help on using the changeset viewer.