Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/10/14 10:31:41 (9 years ago)
Author:
pfleck
Message:

#2269 Merged trunk. Updated .net version of ALPS plugin.

Location:
branches/ALPS
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/ALPS

  • branches/ALPS/HeuristicLab.Problems.DataAnalysis.Symbolic.Views

  • branches/ALPS/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Exporters/SymbolicSolutionExcelExporter.cs

    r11171 r11677  
    3030namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
    3131  public class SymbolicSolutionExcelExporter : IDataAnalysisSolutionExporter {
    32     private const string TRAININGSTART = "TrainingStart";
    33     private const string TRAININGEND = "TrainingEnd";
    34     private const string TESTSTART = "TestStart";
    35     private const 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";
    3636
    3737
     
    4444    }
    4545
    46     public void Export(IDataAnalysisSolution solution, string fileName) {
     46    public virtual void Export(IDataAnalysisSolution solution, string fileName) {
    4747      var symbSolution = solution as ISymbolicDataAnalysisSolution;
    4848      if (symbSolution == null) throw new NotSupportedException("This solution cannot be exported to Excel");
     
    216216    }
    217217
    218     private string Indirect(string column, bool training) {
     218    protected string Indirect(string column, bool training) {
    219219      if (training) {
    220220        return string.Format("INDIRECT(\"'Estimated Values'!{0}\"&{1}+2&\":{0}\"&{2}+1)", column, TRAININGSTART, TRAININGEND);
     
    260260    }
    261261
    262     private void AddModelTreePicture(ExcelWorksheet modelWorksheet, ISymbolicDataAnalysisModel model) {
     262    protected void AddModelTreePicture(ExcelWorksheet modelWorksheet, ISymbolicDataAnalysisModel model) {
    263263      SymbolicExpressionTreeChart modelTreePicture = new SymbolicExpressionTreeChart();
    264264      modelTreePicture.Tree = model.SymbolicExpressionTree;
     
    289289      estimatedWorksheet.Cells[1, 1, 1, 10].AutoFitColumns();
    290290
     291      // fill in id, target variable and unbounded estimated values
    291292      int targetIndex = solution.ProblemData.Dataset.VariableNames.ToList().FindIndex(x => x.Equals(solution.ProblemData.TargetVariable)) + 1;
    292293      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
    296297      }
    297298      estimatedWorksheet.Cells["B2:B" + (rows + 1)].Style.Numberformat.Format = "0.000";
     
    313314    }
    314315
    315     private string PrepareFormula(string[] formulaParts) {
     316    protected string PrepareFormula(string[] formulaParts) {
    316317      string preparedFormula = formulaParts[0];
    317318      foreach (var part in formulaParts.Skip(2)) {
     
    323324    }
    324325
    325     private void WriteInputSheet(ExcelWorksheet inputsWorksheet, ExcelWorksheet datasetWorksheet, IEnumerable<string> list, Dataset dataset) {
     326    protected void WriteInputSheet(ExcelWorksheet inputsWorksheet, ExcelWorksheet datasetWorksheet, IEnumerable<string> list, Dataset dataset) {
    326327      //remark the performance of EPPlus drops dramatically
    327328      //if the data is not written row wise (from left to right) due the internal indices used.
     
    337338    }
    338339
    339     private void WriteDatasetToExcel(ExcelWorksheet datasetWorksheet, IDataAnalysisProblemData problemData) {
     340    protected void WriteDatasetToExcel(ExcelWorksheet datasetWorksheet, IDataAnalysisProblemData problemData) {
    340341      //remark the performance of EPPlus drops dramatically
    341342      //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.