From 846b14a50952e78728b3c1e62bb77789b4fec161 Mon Sep 17 00:00:00 2001 From: Jendrik Seipp Date: Wed, 10 Jan 2024 12:11:50 +0100 Subject: [PATCH] Adjust get_bit_size_for_range() for size-1 domains. --- src/search/algorithms/int_packer.cc | 8 +++++--- src/search/task_utils/task_properties.cc | 8 +++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/search/algorithms/int_packer.cc b/src/search/algorithms/int_packer.cc index c7ec0eb28a..6888156122 100644 --- a/src/search/algorithms/int_packer.cc +++ b/src/search/algorithms/int_packer.cc @@ -1,6 +1,5 @@ #include "int_packer.h" -#include #include using namespace std; @@ -24,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; @@ -84,8 +88,6 @@ void IntPacker::set(Bin *buffer, int var, int value) const { void IntPacker::pack_bins(const vector &ranges) { assert(var_infos.empty()); - assert(all_of(ranges.begin(), ranges.end(), - [](int range) {return range > 1;})); int num_vars = ranges.size(); var_infos.resize(num_vars); diff --git a/src/search/task_utils/task_properties.cc b/src/search/task_utils/task_properties.cc index e55c7c6cfe..145e0e9c79 100644 --- a/src/search/task_utils/task_properties.cc +++ b/src/search/task_utils/task_properties.cc @@ -173,11 +173,9 @@ PerTaskInformation g_state_packers( vector variable_ranges; variable_ranges.reserve(variables.size()); for (VariableProxy var : variables) { - /* IntPacker expects all variables to have at least a domain size of - two. This is not the case for some domain-abstracted tasks. */ - int domain_size = max(2, var.get_domain_size()); - variable_ranges.push_back(domain_size); + variable_ranges.push_back(var.get_domain_size()); } return utils::make_unique_ptr(variable_ranges); - }); + } + ); }