From fea5d4c3a84e3d83ed761579a7a7cc31279cc165 Mon Sep 17 00:00:00 2001 From: Charlie Blake Date: Wed, 20 Jun 2018 15:43:21 +0100 Subject: Set solver seed limit --- src/main/input-output/input/command_line_helper.cpp | 15 +++++++++++++-- src/main/input-output/input/command_line_helper.h | 2 ++ 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'src/main/input-output') diff --git a/src/main/input-output/input/command_line_helper.cpp b/src/main/input-output/input/command_line_helper.cpp index 2abef54..21eec88 100644 --- a/src/main/input-output/input/command_line_helper.cpp +++ b/src/main/input-output/input/command_line_helper.cpp @@ -38,12 +38,13 @@ command_line_helper::command_line_helper() "'solvability', 'benchmark' or list of deals to be solved.") ("classify", "outputs a simple 'solvable/not solvable' " "classification") - ("cache-capacity", po::value(), "sets an upper bound on the number of states allowed in " + ("cache-capacity", po::value(), "sets an upper bound on the number of states allowed in " "the cache") ("solvability", po::value(), "calculates the solvability " - "percentage of the supplied solitaire game, given a timeout in milliseconds. Must supply " + "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(), "adds a per-game timeout to the solvability percentage generation") ("resume", po::value>()->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 ...]") @@ -121,6 +122,12 @@ bool command_line_helper::parse(int argc, const char* argv[]) { solvability = -1; } + if (vm.count("timeout")) { + timeout = vm["timeout"].as(); + } else { + timeout = 604800000; // 1 week in milliseconds + } + if (vm.count("cores")) { cores = vm["cores"].as(); } else { @@ -248,6 +255,10 @@ int command_line_helper::get_solvability() { return solvability; } +uint64_t command_line_helper::get_timeout() { + return timeout; +} + vector command_line_helper::get_resume() { return resume; } diff --git a/src/main/input-output/input/command_line_helper.h b/src/main/input-output/input/command_line_helper.h index 3ce239d..744935f 100644 --- a/src/main/input-output/input/command_line_helper.h +++ b/src/main/input-output/input/command_line_helper.h @@ -24,6 +24,7 @@ public: std::vector get_resume(); uint64_t get_cache_capacity(); std::string get_describe_game_rules(); + uint64_t get_timeout(); private: bool assess_errors(); @@ -51,6 +52,7 @@ private: bool available_game_types; bool benchmark; uint64_t cache_capacity; + uint64_t timeout; }; #endif //SOLVITAIRE_COMMAND_LINE_HELPER_H -- cgit v1.2.1 From abae8e0529cf2e6048e9b2eb8248434e1f9551de Mon Sep 17 00:00:00 2001 From: Charlie Blake Date: Wed, 20 Jun 2018 17:37:22 +0100 Subject: Add streamliner command line option (inc for spgs) --- src/main/input-output/input/command_line_helper.cpp | 15 +++++++++++---- src/main/input-output/input/command_line_helper.h | 2 ++ 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'src/main/input-output') diff --git a/src/main/input-output/input/command_line_helper.cpp b/src/main/input-output/input/command_line_helper.cpp index 21eec88..ec9a375 100644 --- a/src/main/input-output/input/command_line_helper.cpp +++ b/src/main/input-output/input/command_line_helper.cpp @@ -38,18 +38,20 @@ command_line_helper::command_line_helper() "'solvability', 'benchmark' or list of deals to be solved.") ("classify", "outputs a simple 'solvable/not solvable' " "classification") - ("cache-capacity", po::value(), "sets an upper bound on the number of states allowed in " + ("cache-capacity", po::value(), "sets an upper bound on the number of states allowed in " "the cache") ("solvability", po::value(), "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.") + "either 'random', 'benchmark', 'solvability' or list of deals to be solved.") ("timeout", po::value(), "adds a per-game timeout to the solvability percentage generation") ("resume", po::value>()->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 ...]") ("cores", po::value(), "the number of cores for the solvability percentages to be run across. " - "Must be supplied with the solvability option.") + "Must be supplied with the solvability option.") + ("streamliners", "applies any relevant streamliners to the search. If the --solvability option is supplied," + " runs the streamliner version of the search first and then if unsuccessful, the full" + " search for each seed.") ("benchmark", "outputs performance statistics for the solver on the " "supplied solitaire game. Must supply " "either 'random', 'benchmark', 'solvability' or list of deals to be " @@ -141,6 +143,7 @@ bool command_line_helper::parse(int argc, const char* argv[]) { for (uint i = 0; i < cores; i++) resume.push_back(i); } + streamliners = (vm.count("streamliners") != 0); benchmark = (vm.count("benchmark") != 0); @@ -278,3 +281,7 @@ string command_line_helper::get_describe_game_rules() { bool command_line_helper::get_benchmark() { return benchmark; } + +bool command_line_helper::get_streamliners() { + return streamliners; +} diff --git a/src/main/input-output/input/command_line_helper.h b/src/main/input-output/input/command_line_helper.h index 744935f..c12bb69 100644 --- a/src/main/input-output/input/command_line_helper.h +++ b/src/main/input-output/input/command_line_helper.h @@ -21,6 +21,7 @@ public: uint get_cores(); bool get_available_game_types(); bool get_benchmark(); + bool get_streamliners(); std::vector get_resume(); uint64_t get_cache_capacity(); std::string get_describe_game_rules(); @@ -51,6 +52,7 @@ private: uint cores; bool available_game_types; bool benchmark; + bool streamliners; uint64_t cache_capacity; uint64_t timeout; }; -- cgit v1.2.1