Class ExcelSerializer<S extends Solution<S,I>, I extends Instance>

java.lang.Object
es.urjc.etsii.grafo.io.serializers.ResultsSerializer<S,I>
es.urjc.etsii.grafo.io.serializers.excel.ExcelSerializer<S,I>

public class ExcelSerializer<S extends Solution<S,I>, I extends Instance> extends ResultsSerializer<S,I>
Serialize results to Excel XML format
  • Field Details

  • Constructor Details

    • ExcelSerializer

      public ExcelSerializer(ExcelConfig serializerConfig, List<ReferenceResultProvider> referenceResultProviders, Optional<ExcelCustomizer> excelCustomizer, InstanceManager<I> instanceManager)
      Create an Excel serializer
      Parameters:
      serializerConfig - excel serializer configuration
      referenceResultProviders - reference result providers if available
      excelCustomizer - customizer if available
      instanceManager -
  • Method Details

    • _serializeResults

      public void _serializeResults(String experimentName, List<WorkUnitResult<S,I>> results, Path p)
      This procedure serialize the list of results to a specific format and generate the resultant file in a given path
      Specified by:
      _serializeResults in class ResultsSerializer<S extends Solution<S,I>, I extends Instance>
      Parameters:
      results - list of results
      p - path
    • fillInstanceSheet

      protected void fillInstanceSheet(String expName, org.apache.poi.xssf.usermodel.XSSFWorkbook excelBook)
    • getCommonHeaders

      protected String[] getCommonHeaders()
    • getRawHeaders

      protected String[] getRawHeaders(String[] customProperties)
    • getCustomPropertyHeaders

      protected String[] getCustomPropertyHeaders(List<? extends WorkUnitResult<?,?>> results)
    • bestResultPerInstance

      protected static Map<String,Double> bestResultPerInstance(Objective<?,?,?> objective, List<? extends WorkUnitResult<?,?>> results, List<ReferenceResultProvider> providers, boolean maximizing)
      Get best result for a given instance
      Parameters:
      results - our results
      providers - reference values
      maximizing - true if this is a maximizing problem, false otherwise
      Returns:
      best value known for a given instance
    • headRawSheet

      public void headRawSheet(org.apache.poi.xssf.streaming.SXSSFSheet rawSheet, String[] customProperties)
    • nanInfiniteFilter

      protected static double nanInfiniteFilter(boolean maximizing, double value)
      Transform NaNs and other special double values to valid values in Excel
      Parameters:
      maximizing - true if this is a maximizing problem, false otherwise
      value - value to transform
      Returns:
      transformed value
    • writeCell

      protected static void writeCell(org.apache.poi.xssf.streaming.SXSSFCell cell, Object d, ExcelSerializer.CType type)
      Write value to sheet cell
      Parameters:
      cell - cell where value will be written
      d - value to write
      type - hints how the value should be interpreted. May or may not be honored.
    • writeCell

      protected static void writeCell(org.apache.poi.xssf.usermodel.XSSFCell cell, Object d, ExcelSerializer.CType type)
      Write value to sheet cell
      Parameters:
      cell - cell where value will be written
      d - value to write
      type - hints how the value should be interpreted. May or may not be honored.