aboutsummaryrefslogtreecommitdiff
path: root/src/main/input-output/input/command_line_helper.cpp
diff options
context:
space:
mode:
authorthecharlesblake2018-04-05 22:16:10 +0100
committerthecharlesblake2018-04-06 10:06:13 +0100
commit74764b8f8a17cb4c0379380acfe5152d60e80f2a (patch)
tree829c6f93370e4f75c38eff98ad8a59095c512a49 /src/main/input-output/input/command_line_helper.cpp
parentMerge pull request #49 from thecharlesblake/add-more-games (diff)
downloadmetasol-74764b8f8a17cb4c0379380acfe5152d60e80f2a.tar.gz
metasol-74764b8f8a17cb4c0379380acfe5152d60e80f2a.zip

Add benchmark cmd line option

Diffstat (limited to 'src/main/input-output/input/command_line_helper.cpp')
-rw-r--r--src/main/input-output/input/command_line_helper.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/main/input-output/input/command_line_helper.cpp b/src/main/input-output/input/command_line_helper.cpp
index 5518f1f..e3af0cd 100644
--- a/src/main/input-output/input/command_line_helper.cpp
+++ b/src/main/input-output/input/command_line_helper.cpp
@@ -35,15 +35,19 @@ command_line_helper::command_line_helper()
"to be solved. Must supply either 'type' or 'custom-rules' option")
("random", po::value<int>(), "create and solve a random solitaire "
"deal based on a seed. Must supply either 'random',"
- "'solvability' or list of deals to be solved.")
+ "'solvability', 'benchmark' or list of deals to be solved.")
+ ("classify", "outputs a simple 'solvable/not solvable' "
+ "classification")
("shortest-sols", "for each instance returns the shortest possible "
"solution. cannot be supplied alongside '--solvability'")
("solvability", "calculates the solvability "
"percentage of the supplied solitaire game. Must supply "
- "either 'random', 'solvability' or list of deals to be "
+ "either 'random', 'benchmark', 'solvability' or list of deals to be "
"solved.")
- ("classify", "outputs a simple 'solvable/not solvable' "
- "classification");
+ ("benchmark", "outputs performance statistics for the solver on the "
+ "supplied solitaire game. Must supply "
+ "either 'random', 'benchmark', 'solvability' or list of deals to be "
+ "solved.");
po::options_description hidden_options("Hidden options");
hidden_options.add_options()
@@ -102,6 +106,8 @@ bool command_line_helper::parse(int argc, const char* argv[]) {
solvability = (vm.count("solvability") != 0);
+ benchmark = (vm.count("benchmark") != 0);
+
shortest_sols = (vm.count("shortest-sols") != 0);
// Handle logic error scenarios
@@ -117,8 +123,8 @@ bool command_line_helper::assess_errors() {
if (available_game_types || !describe_game_rules.empty()) return true;
// The user must either supply input files, a random seed, or ask for the
- // solvability percentage
- int opt_count = (random_deal != -1) + !input_files.empty() + solvability;
+ // solvability percentage, or benchmark
+ int opt_count = (random_deal != -1) + !input_files.empty() + solvability + benchmark;
if (opt_count > 1) {
print_too_many_opts_error();
@@ -166,7 +172,7 @@ void command_line_helper::print_help() {
void command_line_helper::print_no_opts_error() {
LOG_ERROR ("Error: User must supply input file(s), the '--random' "
- "option, or the '--solvability' option");
+ "option, the 'benchmark' option, or the '--solvability' option");
print_help();
}
@@ -177,7 +183,7 @@ void command_line_helper::print_sol_type_rules_error() {
}
void command_line_helper::print_too_many_opts_error() {
- LOG_ERROR ("Error: User must supply input file(s), the '--random' option, "
+ LOG_ERROR ("Error: User must supply input file(s), the '--random' option, the 'benchmark' option,, "
"or the '--solvability' option, not multiple");
print_help();
}
@@ -226,3 +232,7 @@ string command_line_helper::get_describe_game_rules() {
bool command_line_helper::get_short_sols() {
return shortest_sols;
}
+
+bool command_line_helper::get_benchmark() {
+ return benchmark;
+}