diff --git a/src/search/parser/abstract_syntax_tree.cc b/src/search/parser/abstract_syntax_tree.cc index 5aecdb7290..280174b645 100644 --- a/src/search/parser/abstract_syntax_tree.cc +++ b/src/search/parser/abstract_syntax_tree.cc @@ -183,6 +183,7 @@ void FunctionCallNode::collect_keyword_arguments( DecorateContext &context, CollectedArguments &arguments) const { unordered_map argument_infos_by_key; for (const plugins::ArgumentInfo &arg_info : argument_infos) { + assert(!argument_infos_by_key.contains(arg_info.key)); argument_infos_by_key.insert({arg_info.key, arg_info}); } diff --git a/src/search/pdbs/pattern_collection_generator_hillclimbing.cc b/src/search/pdbs/pattern_collection_generator_hillclimbing.cc index 74609dc173..441a664140 100644 --- a/src/search/pdbs/pattern_collection_generator_hillclimbing.cc +++ b/src/search/pdbs/pattern_collection_generator_hillclimbing.cc @@ -552,7 +552,6 @@ static void add_hillclimbing_options(plugins::Feature &feature) { "infinity", plugins::Bounds("0.0", "infinity")); utils::add_rng_options(feature); - add_generator_options_to_feature(feature); } static void check_hillclimbing_options( @@ -596,6 +595,7 @@ class PatternCollectionGeneratorHillclimbingFeature : public plugins::TypedFeatu "optimized for the Evaluator#Canonical_PDB heuristic. It it described " "in the following paper:" + paper_references()); add_hillclimbing_options(*this); + add_generator_options_to_feature(*this); } virtual shared_ptr create_component(const plugins::Options &options, const utils::Context &context) const override { diff --git a/src/search/plugins/raw_registry.cc b/src/search/plugins/raw_registry.cc index 4c652a8266..67e9cc5f06 100644 --- a/src/search/plugins/raw_registry.cc +++ b/src/search/plugins/raw_registry.cc @@ -118,28 +118,28 @@ SubcategoryPlugins RawRegistry::collect_subcategory_plugins( Features RawRegistry::collect_features( const SubcategoryPlugins &subcategory_plugins, vector &errors) const { Features features; - unordered_map key_occurrences; + unordered_map feature_key_occurrences; for (const Plugin *plugin : plugins) { shared_ptr feature = plugin->create_feature(); - string key = feature->get_key(); - key_occurrences[key]++; - features[key] = move(feature); + string feature_key = feature->get_key(); + feature_key_occurrences[feature_key]++; + features[feature_key] = move(feature); } - // Check that keys are unique - for (const auto &pair : key_occurrences) { - const string &key = pair.first; + // Check that feature_keys are unique + for (const auto &pair : feature_key_occurrences) { + const string &feature_key = pair.first; int occurrences = pair.second; if (occurrences > 1) { errors.push_back( to_string(occurrences) + " Features are defined for the key '" + - key + "'."); + feature_key + "'."); } } // Check that all subcategories used in features are defined for (const auto &item : features) { - const string &key = item.first; + const string &feature_key = item.first; const Feature &feature = *item.second; string subcategory = feature.get_subcategory(); @@ -147,27 +147,39 @@ Features RawRegistry::collect_features( const Type &type = feature.get_type(); errors.push_back( "Missing SubcategoryPlugin '" + subcategory + "' for Plugin '" + - key + "' of type " + type.name()); + feature_key + "' of type " + type.name()); } } // Check that all types used in features are defined unordered_set missing_types; for (const auto &item : features) { - const string &key = item.first; + const string &feature_key = item.first; const Feature &feature = *item.second; const Type &type = feature.get_type(); if (type == TypeRegistry::NO_TYPE) { errors.push_back( - "Missing Plugin for type of feature '" + key + "'."); + "Missing Plugin for type of feature '" + feature_key + "'."); } + unordered_map parameter_occurrences; for (const ArgumentInfo &arg_info : feature.get_arguments()) { if (arg_info.type == TypeRegistry::NO_TYPE) { errors.push_back( - "Missing Plugin for type of argument '" + arg_info.key - + "' of feature '" + key + "'."); + "Missing Plugin for type of parameter '" + arg_info.key + + "' of feature '" + feature_key + "'."); + } + ++parameter_occurrences[arg_info.key]; + } + // Check that parameters are unique + for (const auto &pair : parameter_occurrences) { + const string ¶meter = pair.first; + int parameter_occurrence = pair.second; + if (parameter_occurrence > 1) { + errors.push_back( + "The parameter '" + parameter + "' in '" + feature_key + "' is defined " + + to_string(parameter_occurrence) + " times."); } } }