aboutsummaryrefslogtreecommitdiff
path: root/src/main/evaluation/solvability_calc.h
diff options
context:
space:
mode:
authorTom Harley2019-01-27 15:37:06 +0000
committerTom Harley2019-01-27 15:37:06 +0000
commita996283af7c21baaff0e114d58c34db820902c6f (patch)
tree2fe5b6f7a800d4a7b8a65ee345f8c98aa138e36b /src/main/evaluation/solvability_calc.h
parentSplit code into 3 files (diff)
downloadmetasol-a996283af7c21baaff0e114d58c34db820902c6f.tar.gz
metasol-a996283af7c21baaff0e114d58c34db820902c6f.zip

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.

Diffstat (limited to 'src/main/evaluation/solvability_calc.h')
-rw-r--r--src/main/evaluation/solvability_calc.h58
1 files changed, 0 insertions, 58 deletions
diff --git a/src/main/evaluation/solvability_calc.h b/src/main/evaluation/solvability_calc.h
deleted file mode 100644
index 25eb844..0000000
--- a/src/main/evaluation/solvability_calc.h
+++ /dev/null
@@ -1,58 +0,0 @@
-//
-// Created by thecharlesblake on 3/21/18.
-//
-
-#ifndef SOLVITAIRE_SOLVABILITY_H
-#define SOLVITAIRE_SOLVABILITY_H
-
-#include <vector>
-#include <set>
-#include <chrono>
-#include <mutex>
-
-#include "../game/sol_rules.h"
-#include "../solver/solver.h"
-#include "../input-output/input/command_line_helper.h"
-
-class solvability_calc {
-public:
- explicit solvability_calc(const sol_rules&, uint64_t);
-
- void calculate_solvability_percentage(uint64_t, int, uint, command_line_helper::streamliner_opt, const std::vector<int>&);
-
-private:
- typedef std::pair<int, solver::result> seed_result;
-
- struct seed_results {
- seed_results();
- void add_result(solver::result::type);
-
- std::atomic<int> solvable;
- std::atomic<int> unsolvable;
- std::atomic<int> timed_out;
- std::atomic<int> mem_limit;
- };
-
- // Printing methods
- static void print_general_info(const seed_results&);
- static void print_seed_info(seed_result);
- static void print_seeds_in_prog(std::set<int>&);
-
- // Solving methods
- static void solver_thread(solvability_calc*, uint core);
- static seed_result solve_seed(int, std::chrono::milliseconds, const sol_rules&, uint64_t, game_state::streamliner_options);
-
- const sol_rules& rules;
- const uint64_t cache_capacity;
- std::chrono::milliseconds timeout;
- std::mutex results_mutex;
- seed_results seed_res;
- std::set<int> seeds_in_progress;
- std::vector<int> resume_seeds;
- std::atomic<int> current_seed;
- int seed_count;
- command_line_helper::streamliner_opt stream_opt;
-};
-
-
-#endif //SOLVITAIRE_SOLVABILITY_H