From a996283af7c21baaff0e114d58c34db820902c6f Mon Sep 17 00:00:00 2001 From: Tom Harley Date: Sun, 27 Jan 2019 15:37:06 +0000 Subject: Reorganise repo All solvitaire content has been shoved into a subdirectory to tidy up the root of the project. This also means solvitaire is treated similarly to other dependencies of the project, and allows other dependencies to be added easily. There's also a lot of other work done here, such as usign a thread pool library to manage the running of the voters. --- src/main/evaluation/benchmark.cpp | 63 --------------------------------------- 1 file changed, 63 deletions(-) delete mode 100644 src/main/evaluation/benchmark.cpp (limited to 'src/main/evaluation/benchmark.cpp') diff --git a/src/main/evaluation/benchmark.cpp b/src/main/evaluation/benchmark.cpp deleted file mode 100644 index f66573c..0000000 --- a/src/main/evaluation/benchmark.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// -// Created by thecharlesblake on 4/5/18. -// - -#include -#include -#include - -#include "benchmark.h" -#include "../game/search-state/game_state.h" -#include "../solver/solver.h" - -using namespace std; -typedef chrono::microseconds microsec; - -void benchmark::run(const sol_rules &rules, uint64_t cache_capacity, game_state::streamliner_options streamliners) { - cout << "Seed " - "| Median/Mean Solution Time(μs) " - "| Median/Mean States Searched " - "| Solvable/Unsolvable"; - - multiset sol_times; - multiset states_searched; - int total_time = 0; - int total_states = 0; - int total_solvable = 0; - int total_unsolvable = 0; - - for(int seed = 1; seed <= 1000; seed++) { - game_state gs(rules, seed, streamliners); - solver sol(gs, cache_capacity); - - auto start = chrono::steady_clock::now(); - solver::result result = sol.run(); - auto end = chrono::steady_clock::now(); - microsec elapsed_micros = - chrono::duration_cast(end - start); - - sol_times.insert(static_cast(elapsed_micros.count())); - total_time += static_cast(elapsed_micros.count()); - states_searched.insert(result.states_searched); - total_states += result.states_searched; - switch (result.sol_type) { - case solver::result::type::SOLVED: - total_solvable++; - break; - case solver::result::type::UNSOLVABLE: - total_unsolvable++; - break; - default: - assert(false); - break; - } - - cout << "\n" << seed - << " | " << *next(begin(sol_times), (sol_times.size())/2) - << "/" << total_time/sol_times.size() - << " | " << *next(begin(states_searched), (states_searched.size())/2) - << "/" << total_states/sol_times.size() - << " | " << total_solvable - << "/" << total_unsolvable; - } -} -- cgit v1.2.1