From c08369e5646b8eb47425282dd3db9073e73fadf1 Mon Sep 17 00:00:00 2001 From: Jendrik Seipp Date: Wed, 10 Jan 2024 13:20:14 +0100 Subject: [PATCH 1/2] [issue1131] Backport some small fixes and changes from Scorpion. The portfolio runner now prints the absolute time in addition to the relative time of each component. Thus, scripts that parse this output need to be adapted. --- driver/portfolio_runner.py | 9 +++++---- misc/style/run-all-style-checks.py | 2 +- misc/tox.ini | 1 - src/search/algorithms/int_packer.cc | 5 +++++ src/search/algorithms/named_vector.h | 4 ++++ src/search/operator_id.h | 4 ++++ 6 files changed, 19 insertions(+), 6 deletions(-) diff --git a/driver/portfolio_runner.py b/driver/portfolio_runner.py index 3f0a7a3f5..011ecff05 100644 --- a/driver/portfolio_runner.py +++ b/driver/portfolio_runner.py @@ -83,9 +83,10 @@ def compute_run_time(timeout, configs, pos): print("remaining time: {}".format(remaining_time)) relative_time = configs[pos][0] remaining_relative_time = sum(config[0] for config in configs[pos:]) - print("config {}: relative time {}, remaining {}".format( - pos, relative_time, remaining_relative_time)) - return limits.round_time_limit(remaining_time * relative_time / remaining_relative_time) + absolute_time_limit = limits.round_time_limit(remaining_time * relative_time / remaining_relative_time) + print("config {}: relative time {}, remaining time {}, absolute time {}".format( + pos, relative_time, remaining_relative_time, absolute_time_limit)) + return absolute_time_limit def run_sat_config(configs, pos, search_cost_type, heuristic_cost_type, @@ -120,7 +121,7 @@ def run_sat(configs, executable, sas_file, plan_manager, final_config, configs, pos, search_cost_type, heuristic_cost_type, executable, sas_file, plan_manager, timeout, memory) if exitcode is None: - return + continue yield exitcode if exitcode == returncodes.SEARCH_UNSOLVABLE: diff --git a/misc/style/run-all-style-checks.py b/misc/style/run-all-style-checks.py index 94a634767..b6ef8e433 100755 --- a/misc/style/run-all-style-checks.py +++ b/misc/style/run-all-style-checks.py @@ -25,7 +25,7 @@ def check_python_style(): "flake8", # https://flake8.pycqa.org/en/latest/user/error-codes.html "--extend-ignore", "E128,E129,E131,E261,E266,E301,E302,E305,E306,E402,E501,E741,F401", - "--exclude", "run-clang-tidy.py,txt2tags.py,.tox", + "--exclude", "run-clang-tidy.py,txt2tags.py,.tox,.venv", "src/translate/", "driver/", "misc/", "build.py", "build_configs.py", "fast-downward.py"], cwd=REPO) except FileNotFoundError: diff --git a/misc/tox.ini b/misc/tox.ini index afd0e2be3..4d1f03d86 100644 --- a/misc/tox.ini +++ b/misc/tox.ini @@ -70,7 +70,6 @@ commands = [testenv:clang-tidy] changedir = {toxinidir}/style/ -deps = PyYAML==6.0.1 commands = python run-clang-tidy.py diff --git a/src/search/algorithms/int_packer.cc b/src/search/algorithms/int_packer.cc index d98da2292..688815612 100644 --- a/src/search/algorithms/int_packer.cc +++ b/src/search/algorithms/int_packer.cc @@ -23,6 +23,11 @@ static IntPacker::Bin get_bit_mask(int from, int to) { } static int get_bit_size_for_range(int range) { + assert(range >= 1); + // Domains in domain-abstracted tasks may have size one. + if (range == 1) { + return 1; + } int num_bits = 0; while ((1U << num_bits) < static_cast(range)) ++num_bits; diff --git a/src/search/algorithms/named_vector.h b/src/search/algorithms/named_vector.h index 47f2cb71b..619053acf 100644 --- a/src/search/algorithms/named_vector.h +++ b/src/search/algorithms/named_vector.h @@ -28,6 +28,10 @@ class NamedVector { elements.push_back(element); } + void push_back(T &&element) { + elements.push_back(std::move(element)); + } + T &operator[](int index) { return elements[index]; } diff --git a/src/search/operator_id.h b/src/search/operator_id.h index 0e8f5f8b3..beb520ac5 100644 --- a/src/search/operator_id.h +++ b/src/search/operator_id.h @@ -45,6 +45,10 @@ class OperatorID { return !(*this == other); } + bool operator<(const OperatorID &other) const { + return index < other.index; + } + int hash() const { return index; } From 329c5fede2592e872fe118992b5b72b3c6c29b07 Mon Sep 17 00:00:00 2001 From: Jendrik Seipp Date: Wed, 10 Jan 2024 18:26:00 +0100 Subject: [PATCH 2/2] [issue1132] Fix txt2tags markup. Produce proper txt2tags markup instead of markup that only works for MoinMoin. --- src/search/plugins/doc_printer.cc | 10 +++++++--- src/search/utils/markup.cc | 12 ++++++------ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/search/plugins/doc_printer.cc b/src/search/plugins/doc_printer.cc index 1bfd36bfc..47a2e888a 100644 --- a/src/search/plugins/doc_printer.cc +++ b/src/search/plugins/doc_printer.cc @@ -118,7 +118,7 @@ void Txt2TagsPrinter::print_usage(const Feature &feature) const { argument_help_strings.push_back(arg_help); } os << utils::join(argument_help_strings, ", ") - << ")" << endl << endl << endl; + << ")" << endl; } } @@ -133,11 +133,12 @@ void Txt2TagsPrinter::print_arguments(const Feature &feature) const { if (arg_type.is_enum_type()) { for (const pair &explanation : arg_type.get_documented_enum_values()) { - os << " - ``" << explanation.first << "``: " + os << " - ``" << explanation.first << "``: " << explanation.second << endl; } } } + os << endl << endl; } void Txt2TagsPrinter::print_notes(const Feature &feature) const { @@ -153,10 +154,11 @@ void Txt2TagsPrinter::print_notes(const Feature &feature) const { void Txt2TagsPrinter::print_language_features(const Feature &feature) const { if (!feature.get_language_support().empty()) { - os << "Language features supported:" << endl; + os << "Supported language features:" << endl; for (const LanguageSupportInfo &ls : feature.get_language_support()) { os << "- **" << ls.feature << ":** " << ls.description << endl; } + os << endl << endl; } } @@ -166,6 +168,7 @@ void Txt2TagsPrinter::print_properties(const Feature &feature) const { for (const PropertyInfo &prop : feature.get_properties()) { os << "- **" << prop.property << ":** " << prop.description << endl; } + os << endl << endl; } } @@ -187,6 +190,7 @@ void Txt2TagsPrinter::print_category_synopsis(const string &synopsis, << "expressions but are deprecated." << endl; } + os << endl; } void Txt2TagsPrinter::print_category_footer() const { diff --git a/src/search/utils/markup.cc b/src/search/utils/markup.cc index d729f63d6..867ffd11d 100644 --- a/src/search/utils/markup.cc +++ b/src/search/utils/markup.cc @@ -32,9 +32,9 @@ string format_conference_reference( const string &year) { ostringstream ss; ss << "\n\n" - << " * " << format_authors(authors) << ".<
>\n" - << " [" << t2t_escape(title) << " " << url << "].<
>\n" - << " In //" << t2t_escape(conference) << "//"; + << format_authors(authors) << ".<
>\n" + << "[" << t2t_escape(title) << " " << url << "].<
>\n" + << "In //" << t2t_escape(conference) << "//"; if (!pages.empty()) ss << ", pp. " << t2t_escape(pages); ss << ". "; @@ -50,9 +50,9 @@ string format_journal_reference( const string &year) { ostringstream ss; ss << "\n\n" - << " * " << format_authors(authors) << ".<
>\n" - << " [" << t2t_escape(title) << " " << url << "].<
>\n" - << " //" << t2t_escape(journal) << "// " + << format_authors(authors) << ".<
>\n" + << "[" << t2t_escape(title) << " " << url << "].<
>\n" + << "//" << t2t_escape(journal) << "// " << t2t_escape(volume) << ":" << t2t_escape(pages) << ". " << t2t_escape(year) << ".\n\n\n"; return ss.str();