added system to get all makespan values
This commit is contained in:
parent
e14f7d77ef
commit
0b156ee40e
1 changed files with 20 additions and 5 deletions
|
@ -108,8 +108,12 @@ public class Main {
|
||||||
}
|
}
|
||||||
output.println();
|
output.println();
|
||||||
|
|
||||||
|
ArrayList<Integer[]> makespans = new ArrayList<>();
|
||||||
|
|
||||||
// for all instances, load it from f
|
// for all instances, load it from f
|
||||||
for(String instanceName : instances) {
|
for(String instanceName : instances) {
|
||||||
|
|
||||||
|
|
||||||
// get the best known result for this instance
|
// get the best known result for this instance
|
||||||
int bestKnown = BestKnownResults.of(instanceName);
|
int bestKnown = BestKnownResults.of(instanceName);
|
||||||
|
|
||||||
|
@ -118,16 +122,16 @@ public class Main {
|
||||||
Instance instance = Instance.fromFile(path);
|
Instance instance = Instance.fromFile(path);
|
||||||
|
|
||||||
// print some general statistics on the instance
|
// print some general statistics on the instance
|
||||||
output.println();
|
output.println("\u001b[36m" + "------------------------------------------------------------------------------------------------------------------" + "\u001b[0m");
|
||||||
output.println();
|
|
||||||
output.println("\u001b[36m" + "------------------------------------------------------------------------" + "\u001b[0m");
|
|
||||||
output.printf("%-8s %-5s %4d ",instanceName, instance.numJobs +"x"+instance.numTasks, bestKnown);
|
output.printf("%-8s %-5s %4d ",instanceName, instance.numJobs +"x"+instance.numTasks, bestKnown);
|
||||||
output.println();
|
|
||||||
|
|
||||||
|
|
||||||
|
// used to get a csv file of all compared makespans
|
||||||
|
ArrayList<Integer> instanceMakespans = new ArrayList<>();
|
||||||
// run all selected solvers on the instance and print the results
|
// run all selected solvers on the instance and print the results
|
||||||
for(int solverId = 0 ; solverId < solvers.size() ; solverId++) {
|
for(int solverId = 0 ; solverId < solvers.size() ; solverId++) {
|
||||||
// Select the next solver to run. Given the solver name passed on the command line,
|
// Select the next solver to run. Given the solver name passed on the command line,
|
||||||
// we lookup the `Main.solvers` hash map to get the solver object with the given name.
|
// we look up the `Main.solvers` hash map to get the solver object with the given name.
|
||||||
Solver solver = solvers.get(solverId);
|
Solver solver = solvers.get(solverId);
|
||||||
|
|
||||||
// start chronometer and compute deadline for the solver to provide a result.
|
// start chronometer and compute deadline for the solver to provide a result.
|
||||||
|
@ -153,11 +157,22 @@ public class Main {
|
||||||
avg_distances[solverId] += dist / (float) instances.size();
|
avg_distances[solverId] += dist / (float) instances.size();
|
||||||
|
|
||||||
output.printf("%7d %8s %5.1f ", runtime, makespan, dist);
|
output.printf("%7d %8s %5.1f ", runtime, makespan, dist);
|
||||||
|
instanceMakespans.add(makespan);
|
||||||
output.flush();
|
output.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
makespans.add(instanceMakespans.toArray(Integer[]::new));
|
||||||
output.println();
|
output.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// used to get a csv file of all compared makespans
|
||||||
|
for(Integer[] i : makespans){
|
||||||
|
for (Integer j : i){
|
||||||
|
System.out.printf("%8s,", j);
|
||||||
|
}
|
||||||
|
System.out.println();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// we have finished all benchmarks, compute the average solve time and distance of each solver.
|
// we have finished all benchmarks, compute the average solve time and distance of each solver.
|
||||||
output.printf("%-8s %-5s %4s ", "AVG", "-", "-");
|
output.printf("%-8s %-5s %4s ", "AVG", "-", "-");
|
||||||
|
|
Loading…
Reference in a new issue