Changeset 17564
- Timestamp:
- 05/27/20 15:45:50 (5 years ago)
- Location:
- branches/2971_named_intervals
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolution.cs
r17555 r17564 200 200 var problemData = solution.ProblemData; 201 201 var model = solution.Model; 202 var variableRanges = problemData.VariableRanges.Get Intervals();202 var variableRanges = problemData.VariableRanges.GetReadonlyDictionary(); 203 203 204 204 intervalEvaluation.AddInterval($"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
r17538 r17564 215 215 if (regressionProblemData != null) { 216 216 var interpreter = new IntervalInterpreter(); 217 var variableRanges = regressionProblemData.VariableRanges.Get Intervals();217 var variableRanges = regressionProblemData.VariableRanges.GetReadonlyDictionary(); 218 218 IDictionary<ISymbolicExpressionTreeNode, Interval> intervals; 219 219 interpreter.GetSymbolicExpressionTreeIntervals(tree, variableRanges, out intervals); -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/IntervalInterpreter.cs
r17562 r17564 80 80 } 81 81 82 public Interval GetSymbolicExpressionTreeInterval(ISymbolicExpressionTree tree, I Dictionary<string, Interval> variableRanges) {82 public Interval GetSymbolicExpressionTreeInterval(ISymbolicExpressionTree tree, IReadOnlyDictionary<string, Interval> variableRanges) { 83 83 lock (syncRoot) { 84 84 EvaluatedSolutions++; … … 97 97 98 98 public Interval GetSymbolicExpressionTreeIntervals(ISymbolicExpressionTree tree, 99 I Dictionary<string, Interval> variableRanges, out IDictionary<ISymbolicExpressionTreeNode, Interval> nodeIntervals) {99 IReadOnlyDictionary<string, Interval> variableRanges, out IDictionary<ISymbolicExpressionTreeNode, Interval> nodeIntervals) { 100 100 lock (syncRoot) { 101 101 EvaluatedSolutions++; … … 124 124 125 125 126 private static Instruction[] PrepareInterpreterState(ISymbolicExpressionTree tree, I Dictionary<string, Interval> variableRanges) {126 private static Instruction[] PrepareInterpreterState(ISymbolicExpressionTree tree, IReadOnlyDictionary<string, Interval> variableRanges) { 127 127 if (variableRanges == null) 128 128 throw new ArgumentNullException("No variablew ranges are present!", nameof(variableRanges)); -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/IntervalCollectionView.cs
r17145 r17564 21 21 22 22 23 using System.Linq;24 23 using System.Windows.Forms; 25 24 using HeuristicLab.MainForm; … … 69 68 70 69 71 var variablesCount = Content. GetIntervals().Count;70 var variablesCount = Content.Count; 72 71 73 72 DataGridViewRow[] rows = new DataGridViewRow[variablesCount]; … … 78 77 dataGridView.Rows.AddRange(rows); 79 78 80 SetRowsHeader(); 81 FillRows(); 79 int j = 0; 80 foreach (var variableInterval in Content.GetVariableIntervals()) { 81 dataGridView.Rows[j].HeaderCell.Value = variableInterval.Item1; 82 dataGridView.Rows[j].Cells[0].Value = variableInterval.Item2.LowerBound; 83 dataGridView.Rows[j].Cells[1].Value = variableInterval.Item2.UpperBound; 84 j++; 85 } 82 86 83 87 dataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); … … 87 91 foreach (DataGridViewColumn column in dataGridView.Columns) { 88 92 column.SortMode = DataGridViewColumnSortMode.NotSortable; 89 }90 }91 92 private void FillRows() {93 for (var i = 0; i < dataGridView.RowCount; ++i) {94 var key = (string)dataGridView.Rows[i].HeaderCell.Value;95 dataGridView.Rows[i].Cells[0].Value = Content.GetInterval(key).LowerBound;96 dataGridView.Rows[i].Cells[1].Value = Content.GetInterval(key).UpperBound;97 }98 }99 100 private void SetRowsHeader() {101 for (var i = 0; i < Content.GetIntervals().Count; ++i) {102 var item = Content.GetIntervals().ElementAt(i);103 dataGridView.Rows[i].HeaderCell.Value = item.Key;104 93 } 105 94 } -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval/IntervalCollection.cs
r17506 r17564 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Linq; 24 25 using HEAL.Attic; 25 26 using HeuristicLab.Common; … … 51 52 } 52 53 } 54 55 public int Count => intervals.Count; 53 56 54 57 public IntervalCollection() : base() { } … … 87 90 } 88 91 89 public IDictionary<string, Interval> GetIntervals() { 90 return intervals; 92 public IReadOnlyDictionary<string, Interval> GetReadonlyDictionary() { 93 return intervals.ToDictionary(pair => pair.Key, pair => pair.Value); 94 } 95 96 public IEnumerable<Tuple<string, Interval>> GetVariableIntervals() { 97 foreach (var variableInterval in intervals) 98 yield return Tuple.Create(variableInterval.Key, variableInterval.Value); 91 99 } 92 100 }
Note: See TracChangeset
for help on using the changeset viewer.