diff options
| author | Charlie Blake | 2018-07-25 14:28:05 +0100 |
|---|---|---|
| committer | Charlie Blake | 2018-07-26 10:32:38 +0100 |
| commit | 4c1a4d02f0a5a4d6daf31744ee8012ff78011196 (patch) | |
| tree | 8e5f4bc4c991ca15b35f2ff15f45c0e30a698e35 | |
| parent | remove openmp cmake flag (diff) | |
| download | metasol-4c1a4d02f0a5a4d6daf31744ee8012ff78011196.tar.gz metasol-4c1a4d02f0a5a4d6daf31744ee8012ff78011196.zip | |
Add timeout to individual games
| -rw-r--r-- | src/main/input-output/input/command_line_helper.cpp | 2 | ||||
| -rw-r--r-- | src/main/main.cpp | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/main/input-output/input/command_line_helper.cpp b/src/main/input-output/input/command_line_helper.cpp index 67224d2..65bbcd6 100644 --- a/src/main/input-output/input/command_line_helper.cpp +++ b/src/main/input-output/input/command_line_helper.cpp @@ -43,7 +43,7 @@ command_line_helper::command_line_helper() ("solvability", po::value<int>(), "calculates the solvability " "percentage of the supplied solitaire game, given a limit for the number of seeds. Must supply " "either 'random', 'benchmark', 'solvability' or list of deals to be solved.") - ("timeout", po::value<uint64_t>(), "adds a per-game timeout to the solvability percentage generation") + ("timeout", po::value<uint64_t>(), "adds a timeout to searches") ("resume", po::value<vector<int>>()->multitoken(), "resumes the solvability percentage calculation from a " "previous run. Must be supplied with the solvability option. " "Syntax: [sol unsol intract in-progress-1 in-progress-2 ...]") diff --git a/src/main/main.cpp b/src/main/main.cpp index e8f287b..ef7131b 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -18,6 +18,8 @@ using namespace boost; namespace po = boost::program_options; +typedef std::chrono::milliseconds millisec; + const optional<sol_rules> gen_rules(command_line_helper&); void solve_random_game(int, const sol_rules&, command_line_helper&); void solve_input_files(vector<string>, const sol_rules&, command_line_helper&); @@ -123,7 +125,7 @@ void solve_input_files(const vector<string> input_files, const sol_rules& rules, void solve_game(const game_state& gs, command_line_helper& clh) { solver solv(gs, clh.get_cache_capacity()); - solver::result result = solv.run(); + solver::result result = solv.run(millisec(clh.get_timeout())); if (!clh.get_classify()) { if (result.sol_type == solver::result::type::SOLVED) { |
