Changeset 17687 for branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Exporters/SymbolicSolutionExcelExporter.cs
- Timestamp:
- 07/19/20 19:07:40 (4 years ago)
- Location:
- branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views
- Property svn:mergeinfo changed
-
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Exporters/SymbolicSolutionExcelExporter.cs
r9994 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 30 30 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views { 31 31 public class SymbolicSolutionExcelExporter : IDataAnalysisSolutionExporter { 32 pr ivateconst string TRAININGSTART = "TrainingStart";33 pr ivateconst string TRAININGEND = "TrainingEnd";34 pr ivateconst string TESTSTART = "TestStart";35 pr ivateconst string TESTEND = "TestEnd";32 protected const string TRAININGSTART = "TrainingStart"; 33 protected const string TRAININGEND = "TrainingEnd"; 34 protected const string TESTSTART = "TestStart"; 35 protected const string TESTEND = "TestEnd"; 36 36 37 37 … … 44 44 } 45 45 46 public v oid Export(IDataAnalysisSolution solution, string fileName) {46 public virtual void Export(IDataAnalysisSolution solution, string fileName) { 47 47 var symbSolution = solution as ISymbolicDataAnalysisSolution; 48 48 if (symbSolution == null) throw new NotSupportedException("This solution cannot be exported to Excel"); … … 216 216 } 217 217 218 pr ivatestring Indirect(string column, bool training) {218 protected string Indirect(string column, bool training) { 219 219 if (training) { 220 220 return string.Format("INDIRECT(\"'Estimated Values'!{0}\"&{1}+2&\":{0}\"&{2}+1)", column, TRAININGSTART, TRAININGEND); … … 260 260 } 261 261 262 pr ivatevoid AddModelTreePicture(ExcelWorksheet modelWorksheet, ISymbolicDataAnalysisModel model) {262 protected void AddModelTreePicture(ExcelWorksheet modelWorksheet, ISymbolicDataAnalysisModel model) { 263 263 SymbolicExpressionTreeChart modelTreePicture = new SymbolicExpressionTreeChart(); 264 264 modelTreePicture.Tree = model.SymbolicExpressionTree; … … 289 289 estimatedWorksheet.Cells[1, 1, 1, 10].AutoFitColumns(); 290 290 291 // fill in id, target variable and unbounded estimated values 291 292 int targetIndex = solution.ProblemData.Dataset.VariableNames.ToList().FindIndex(x => x.Equals(solution.ProblemData.TargetVariable)) + 1; 292 293 for (int i = 0; i < rows; i++) { 293 estimatedWorksheet.Cells[i + 2, 1].Value = i; 294 estimatedWorksheet.Cells[i + 2, 2].Formula = datasetWorksheet.Cells[i + 2, targetIndex].FullAddress; 295 estimatedWorksheet.Cells[i + 2, 9].Formula = string.Format(preparedFormula, i + 2); 294 estimatedWorksheet.Cells[i + 2, 1].Value = i; // id 295 estimatedWorksheet.Cells[i + 2, 2].Formula = datasetWorksheet.Cells[i + 2, targetIndex].FullAddress; // target variable 296 estimatedWorksheet.Cells[i + 2, 9].Formula = string.Format(preparedFormula, i + 2); // unbounded estimated values 296 297 } 297 298 estimatedWorksheet.Cells["B2:B" + (rows + 1)].Style.Numberformat.Format = "0.000"; … … 313 314 } 314 315 315 pr ivatestring PrepareFormula(string[] formulaParts) {316 protected string PrepareFormula(string[] formulaParts) { 316 317 string preparedFormula = formulaParts[0]; 317 318 foreach (var part in formulaParts.Skip(2)) { … … 323 324 } 324 325 325 pr ivate void WriteInputSheet(ExcelWorksheet inputsWorksheet, ExcelWorksheet datasetWorksheet, IEnumerable<string> list,Dataset dataset) {326 protected void WriteInputSheet(ExcelWorksheet inputsWorksheet, ExcelWorksheet datasetWorksheet, IEnumerable<string> list, IDataset dataset) { 326 327 //remark the performance of EPPlus drops dramatically 327 328 //if the data is not written row wise (from left to right) due the internal indices used. … … 337 338 } 338 339 339 pr ivatevoid WriteDatasetToExcel(ExcelWorksheet datasetWorksheet, IDataAnalysisProblemData problemData) {340 protected void WriteDatasetToExcel(ExcelWorksheet datasetWorksheet, IDataAnalysisProblemData problemData) { 340 341 //remark the performance of EPPlus drops dramatically 341 342 //if the data is not written row wise (from left to right) due the internal indices used. 342 Dataset dataset = problemData.Dataset;343 IDataset dataset = problemData.Dataset; 343 344 var variableNames = dataset.VariableNames.ToList(); 344 345 var doubleVariables = new HashSet<string>(dataset.DoubleVariables);
Note: See TracChangeset
for help on using the changeset viewer.