From 7b37110a67cdf6add945224915ebae7817fa444c Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Mon, 9 Apr 2018 19:14:34 +0100 Subject: fin --- src/main/evaluation/benchmark.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src/main/evaluation') 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 #include +#include #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 sol_times; multiset states_searched; - multiset sol_depths; - multiset 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(end - start); sol_times.insert(static_cast(elapsed_micros.count())); + total_time += static_cast(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; } -- cgit v1.2.1