aboutsummaryrefslogtreecommitdiff
path: root/src/main/input-output
diff options
context:
space:
mode:
authorCharlie Blake2018-06-20 15:43:21 +0100
committerCharlie Blake2018-06-20 15:43:21 +0100
commitfea5d4c3a84e3d83ed761579a7a7cc31279cc165 (patch)
tree3d3d89a07d0bea82eaa75a862cd9e554adfe91bc /src/main/input-output
parentMerge pull request #64 from thecharlesblake/solvability-csv-output (diff)
downloadmetasol-fea5d4c3a84e3d83ed761579a7a7cc31279cc165.tar.gz
metasol-fea5d4c3a84e3d83ed761579a7a7cc31279cc165.zip

Set solver seed limit

Diffstat (limited to 'src/main/input-output')
-rw-r--r--src/main/input-output/input/command_line_helper.cpp15
-rw-r--r--src/main/input-output/input/command_line_helper.h2
2 files changed, 15 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 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<uint64_t>(), "sets an upper bound on the number of states allowed in "
+ ("cache-capacity", po::value<int>(), "sets an upper bound on the number of states allowed in "
"the cache")
("solvability", po::value<int>(), "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<uint64_t>(), "adds a per-game timeout to the solvability percentage generation")
("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 ...]")
@@ -121,6 +122,12 @@ bool command_line_helper::parse(int argc, const char* argv[]) {
solvability = -1;
}
+ if (vm.count("timeout")) {
+ timeout = vm["timeout"].as<uint64_t>();
+ } else {
+ timeout = 604800000; // 1 week in milliseconds
+ }
+
if (vm.count("cores")) {
cores = vm["cores"].as<uint>();
} else {
@@ -248,6 +255,10 @@ int command_line_helper::get_solvability() {
return solvability;
}
+uint64_t command_line_helper::get_timeout() {
+ return timeout;
+}
+
vector<int> 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<int> 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