diff options
Diffstat (limited to 'src/main/evaluation')
| -rw-r--r-- | src/main/evaluation/benchmark.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/main/evaluation/benchmark.cpp b/src/main/evaluation/benchmark.cpp index f25e491..b8866ff 100644 --- a/src/main/evaluation/benchmark.cpp +++ b/src/main/evaluation/benchmark.cpp @@ -4,6 +4,7 @@ #include <climits> #include <iostream> +#include <numeric> #include "benchmark.h" #include "../game/game_state.h" @@ -14,16 +15,14 @@ typedef chrono::microseconds microsec; void benchmark::run(const sol_rules &rules) { cout << "Seed " - "| Median Solution Time(μs) " - "| Median States Searched " - "| Median Backtracks " - "| Median (Non-Zero) Solution Depth " - "| Solvable/Unsolvable "; + "| Median/Mean Solution Time(μs)" + "| Median/Mean States Searched " + "| Solvable/Unsolvable "; multiset<int> sol_times; multiset<int> states_searched; - multiset<int> sol_depths; - multiset<int> backtracks; + int total_time = 0; + int total_states = 0; int total_solvable = 0; int total_unsolvable = 0; @@ -38,9 +37,9 @@ void benchmark::run(const sol_rules &rules) { chrono::duration_cast<chrono::microseconds>(end - start); sol_times.insert(static_cast<int>(elapsed_micros.count())); + total_time += static_cast<int>(elapsed_micros.count()); states_searched.insert(sol.get_states_searched()); - if (sol.get_final_depth() != 0) sol_depths.insert(sol.get_final_depth()); - backtracks.insert(sol.get_backtrack_count()); + total_states += sol.get_states_searched(); switch (result) { case solver::sol_state::solved: total_solvable++; @@ -55,9 +54,9 @@ void benchmark::run(const sol_rules &rules) { cout << "\n" << seed << " | " << *next(begin(sol_times), (sol_times.size())/2) + << "/" << total_time/sol_times.size() << " | " << *next(begin(states_searched), (states_searched.size())/2) - << " | " << *next(begin(backtracks), (backtracks.size())/2) - << " | " << *next(begin(sol_depths), (sol_depths.size())/2) + << "/" << total_states/sol_times.size() << " | " << total_solvable << "/" << total_unsolvable; } |
