- Timestamp:
- 01/27/14 14:14:42 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SlidingWindowBestSolutionsCollectionView.cs
r10396 r10402 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 2 23 using System.Collections.Generic; 3 24 using System.Linq; … … 43 64 var dataGridView = (DataGridView)sender; 44 65 var cell = dataGridView.SelectedCells[0]; 45 var tree = Content.BestSolutions[cell.RowIndex]; 66 var bestSolutions = Content.BestSolutions.ToList(); 67 var tree = bestSolutions[cell.RowIndex]; 46 68 var model = Content.CreateModel(tree, Content.Interpreter); 47 69 var solution = Content.CreateSolution(model, Content.ProblemData); … … 93 115 94 116 private void UpdateQualitiesMap() { 95 var qualitiesMap = new DoubleMatrix(Content.BestSolutions.Count, Content.SlidingWindowPositions.Count + 1); 117 var bestSolutions = Content.BestSolutions.ToList(); 118 var swPositions = Content.SlidingWindowPositions.ToList(); 119 var qualitiesMap = new DoubleMatrix(bestSolutions.Count, swPositions.Count + 1); 96 120 qualitiesMap.ColumnNames = Content.SlidingWindowPositions.Select(x => x.Start + "-" + x.End).Concat(new List<string> { "Training" }); 97 qualitiesMap.RowNames = Enumerable.Range(1, Content.BestSolutions.Count).Select(x => "M" + x);121 qualitiesMap.RowNames = Enumerable.Range(1, bestSolutions.Count).Select(x => "M" + x); 98 122 double min = 0, max = 0; 99 123 100 124 for (int i = 0; i < qualitiesMap.Columns - 1; ++i) { 101 var pos = Content.SlidingWindowPositions[i];125 var pos = swPositions[i]; 102 126 var rows = Enumerable.Range(pos.Start, pos.End - pos.Start).ToList(); 103 127 104 128 for (int j = 0; j < qualitiesMap.Rows; ++j) { 105 var tree = Content.BestSolutions[j];129 var tree = bestSolutions[j]; 106 130 var q = CalculateQuality(tree, rows); 107 131 if (min > q) min = q; … … 112 136 // deal separately with the last column which represents the whole training partition interval 113 137 for (int j = 0; j < qualitiesMap.Rows; ++j) { 114 var tree = Content.BestSolutions[j];138 var tree = bestSolutions[j]; 115 139 var q = CalculateQuality(tree, Content.ProblemData.TrainingIndices); 116 140 if (min > q) min = q;
Note: See TracChangeset
for help on using the changeset viewer.