/** * In the end algorithms are sorted by their rating. Best is first! * * @param repeat number of repetitions */ public void run(int repeat) { long stTime = System.currentTimeMillis(); RatingBenchmark.debugPrint = printDebug; // prints one on one results RatingBenchmark.printSingleRunDuration = printSingleRunDuration; benchMark.run(ra, allSingleProblemRunResults, repeat); ra.recalcRangs(); Collections.sort(listAll, new Player.RatingComparator()); long endTime = System.currentTimeMillis(); duration = endTime - stTime; // System.out.println("Benchmark DURATION: "+duration/1000+"s"); }
public String toString() { StringBuffer sb = new StringBuffer(); sb.append("Results for benchmark:") .append(benchMark.getAcronym()) .append("Benchmark DURATION: (" + duration / 1000 + "s)") .append("\n") .append("\n"); ; for (PlayerAlgorithmExport a : listAll) { sb.append(a.getPlayerId()).append(" ").append(a.getR().toString()).append("\n"); } return sb.toString(); }
/** * Add algorithms in arena. Then run! * * @param al * @param startRating */ public void addAlgorithm(Algorithm al, Rating startRating) { players.add(al); if (al == null) System.out.println("Add null algorithm"); if (al.getAlgorithmInfo() == null) System.out.println("Add algorithm with null AlgorithmInfo " + al.getClass().getName()); if (al.getImplementationAuthor() == null) System.out.println("Add algorithm with null Author " + al.getClass().getName()); PlayerAlgorithmExport tmp; tmp = new PlayerAlgorithmExport(al, startRating, 0, 0, 0); listAll.add(tmp); ra.addPlayer(tmp); benchMark.registerAlgorithm(al); }