private static void printResult(List<Point> pointList, List<Algorithm> algorithms) { for (Algorithm algorithm : algorithms) { Result r = algorithm.run(pointList); r.stop(); System.err.println(algorithm.toString()); System.err.println("Time: " + r.getTime()); System.err.println("Iterations: " + r.getIterationCount()); for (RoundResult rr : r.getResultsToReport()) { System.err.println(rr.printResult()); } // System.out.println(r.getBestResult().print(true)); System.err.println(); } }
private static void writeToFile(Algorithm a, RoundResult[] resultsToReport) { try { PrintWriter pw = new PrintWriter( "resources/results_" + a.getClass().getSimpleName() + "_" + new SimpleDateFormat("yyyyMMdd_kkmm") .format(new Date(System.currentTimeMillis()))); for (RoundResult r : resultsToReport) { pw.println(r.toString()); } pw.flush(); pw.close(); } catch (FileNotFoundException e) { System.err.println("File not found: " + e.getMessage()); for (RoundResult r : resultsToReport) { System.out.println(r.toString()); } } }