- Timestamp:
- 11/05/14 11:13:34 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Exporters/SymbolicSolutionExcelExporter.cs
r11171 r11523 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 … … 52 52 } 53 53 54 pr ivatevoid ExportChart(string fileName, ISymbolicDataAnalysisSolution solution, string formula) {54 protected virtual void ExportChart(string fileName, ISymbolicDataAnalysisSolution solution, string formula) { 55 55 FileInfo newFile = new FileInfo(fileName); 56 56 if (newFile.Exists) { … … 85 85 } 86 86 87 pr ivatevoid FormatModelSheet(ExcelWorksheet modelWorksheet, ISymbolicDataAnalysisSolution solution, IEnumerable<string> formulaParts) {87 protected virtual void FormatModelSheet(ExcelWorksheet modelWorksheet, ISymbolicDataAnalysisSolution solution, IEnumerable<string> formulaParts) { 88 88 int row = 1; 89 89 modelWorksheet.Cells[row, 1].Value = "Model"; … … 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); … … 224 224 } 225 225 226 pr ivatevoid AddCharts(ExcelWorksheet chartsWorksheet) {226 protected virtual void AddCharts(ExcelWorksheet chartsWorksheet) { 227 227 chartsWorksheet.Names.AddFormula("AllId", "OFFSET('Estimated Values'!$A$1,1,0, COUNTA('Estimated Values'!$A:$A)-1)"); 228 228 chartsWorksheet.Names.AddFormula("AllTarget", "OFFSET('Estimated Values'!$B$1,1,0, COUNTA('Estimated Values'!$B:$B)-1)"); … … 260 260 } 261 261 262 pr ivatevoid AddModelTreePicture(ExcelWorksheet modelWorksheet, ISymbolicDataAnalysisModel model) {262 protected virtual 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 ivatevoid WriteInputSheet(ExcelWorksheet inputsWorksheet, ExcelWorksheet datasetWorksheet, IEnumerable<string> list, Dataset dataset) {326 protected void WriteInputSheet(ExcelWorksheet inputsWorksheet, ExcelWorksheet datasetWorksheet, IEnumerable<string> list, Dataset 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.
Note: See TracChangeset
for help on using the changeset viewer.