Class ResultsWriter


  • public class ResultsWriter
    extends Object
    XXX: Maybe make this a proper label provider for the results? Metamodel results? After calling close(), the ResultWriter should not be used anymore, because it will have closed its internal writer and set the reference to null. Any further logs are written to Log4J.
    • Constructor Detail

      • ResultsWriter

        public ResultsWriter​(URI folder,
                             String filename)
    • Method Detail

      • writeDSEIndividualsToFile

        public static void writeDSEIndividualsToFile​(Collection<DSEIndividual> individuals,
                                                     URI folder,
                                                     String lastSegment,
                                                     int iteration,
                                                     boolean asEMF,
                                                     boolean asCVS,
                                                     List<Exception> exceptionList)
        Write all individuals to new file (file current time in filename).
        Parameters:
        individuals -
        lastSegment -
        iteration -
        exceptionList -
      • writeIndividualsToFile

        public static void writeIndividualsToFile​(Collection<org.opt4j.core.Individual> individuals,
                                                  URI folder,
                                                  String filename,
                                                  int iteration,
                                                  List<Exception> exceptionList,
                                                  boolean asEMF,
                                                  boolean asCSV)
        Write all individuals to new file (file current time in filename).
        Parameters:
        individuals -
        folder -
        iteration -
        exceptionList -
        asEMF -
      • writeStringToFile

        public static void writeStringToFile​(URI folder,
                                             String filename,
                                             String content,
                                             int iteration,
                                             List<Exception> exceptionList,
                                             String fileEnding)
        Write any string to the given file.
        Parameters:
        filename -
        content -
        iteration - Is used for the filename
        exceptionList -
      • printOutIndividuals

        public static void printOutIndividuals​(Collection<DSEIndividual> individuals,
                                               String collectionName)
        Write individuals to Logger using WARN level.
        Parameters:
        individuals -
        collectionName -
      • formatDouble

        public static String formatDouble​(Double gene)
      • writeIndividual

        public void writeIndividual​(DSEIndividual i)
      • getFilename

        public URI getFilename()
        returns the file location
        Returns:
        file location as URI
      • writeToLogFile

        public void writeToLogFile​(String entry)
        Writes String entry to log file in results directory.
        Parameters:
        entry -
      • flush

        public void flush()
      • close

        public void close()
        Closes the internal file writer (as defined in FileWriter.close()). After closing, the ResultWriter should not be used anymore. Further calls of the ResultWriter will be logged to Log4J with error messages, as if no file writer could be initialised. Multiple calls of close() have no effect.
      • getDimensionName

        public static String getDimensionName​(org.opt4j.core.Criterion criterion)