Search in sources :

Example 1 with CsvWriter

use of org.kanonizo.reporting.CsvWriter in project kanonizo by kanonizo.

the class Framework method reportResults.

/**
 * Method that can decide how to display results once the algorithm has finished executing.
 *
 * @param algorithm - the Search Algorithm that was used to find a solution
 */
protected void reportResults(SearchAlgorithm algorithm) {
    StringBuilder sb = new StringBuilder();
    if (algorithm != null) {
        sb.append("The solution found by the ");
        String algorithmName = algorithm.getClass().getName();
        algorithmName = algorithmName.substring(algorithmName.lastIndexOf(".") + 1);
        String[] algorithmSplit = algorithmName.split("(?=\\p{Upper})");
        for (String name : algorithmSplit) {
            sb.append(name + " ");
        }
        sb.append("for the problem ");
        sb.append("is:\n");
        sb.append(algorithm.getCurrentOptimal());
    }
    logger.info(sb.toString());
    for (CsvWriter writer : writers) {
        writer.write();
    }
    logger.info("Results complete");
}
Also used : CsvWriter(org.kanonizo.reporting.CsvWriter)

Aggregations

CsvWriter (org.kanonizo.reporting.CsvWriter)1