Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

Commit

Permalink
fix path and extract it as constant
Browse files Browse the repository at this point in the history
  • Loading branch information
kt86 committed Jul 18, 2024
1 parent 5bdcbe9 commit 61aea27
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
*/
public class LspScoreStatsControlerListener implements StartupListener, IterationEndsListener, ShutdownListener, LspScoreStats {

private static final String LSP_SCORESTATS = "lsp_scorestats";

public enum ScoreItem { worst, best, average, executed }

private final LSPs lsps;
Expand All @@ -86,7 +88,7 @@ public enum ScoreItem { worst, best, average, executed }
this.lsps = LSPUtils.getLSPs(scenario);
this.controllerIO = controllerIO;
this.delimiter = globalConfig.getDefaultDelimiter();
this.out = IOUtils.getBufferedWriter(controllerIO.getOutputFilename("lsp_scorestats.csv"));
this.out = IOUtils.getBufferedWriter(controllerIO.getOutputFilename(LSP_SCORESTATS + ".csv"));

//TODO: Das hier dann mal ansehen, weil es ja nun nicht mehr via Subpobulations ist.. Vermutlich brauche ich nur die LSPIds...
Set<String> lspIds = lsps.getLSPs().values().stream()
Expand All @@ -95,7 +97,7 @@ public enum ScoreItem { worst, best, average, executed }
.collect(Collectors.toSet());

for (String lspId : lspIds) {
this.perLsp.put(lspId, new ScoreHist(new HashMap<>(), IOUtils.getBufferedWriter(controllerIO.getOutputFilename("lsp_scorestats_" + lspId + ".csv"))));
this.perLsp.put(lspId, new ScoreHist(new HashMap<>(), IOUtils.getBufferedWriter(controllerIO.getOutputFilename(LSP_SCORESTATS + "_" + lspId + ".csv"))));
}

try {
Expand Down Expand Up @@ -182,7 +184,7 @@ private void writePng() {
chart.addSeries("avg. of plans' average score", this.scoreHistory.get( ScoreItem.average) );
chart.addSeries("avg. executed score", this.scoreHistory.get( ScoreItem.executed ) );
chart.addMatsimLogo();
chart.saveAsPng(this.controllerIO.getOutputFilename("scorestats.png"), 800, 600);
chart.saveAsPng(this.controllerIO.getOutputFilename(LSP_SCORESTATS + ".png"), 800, 600);
}

@Override
Expand Down

0 comments on commit 61aea27

Please sign in to comment.