From 036fffa1167cea530efb2f67aca6f82bb005a2c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Salom=C3=A9=20Eriksson?= Date: Mon, 7 Oct 2024 15:00:22 +0200 Subject: [PATCH] [trivial] Update documentation regarding safety for tasks with axioms. --- src/search/heuristics/additive_heuristic.cc | 8 ++--- src/search/heuristics/cea_heuristic.cc | 6 +--- src/search/heuristics/cg_heuristic.cc | 6 +--- src/search/heuristics/ff_heuristic.cc | 8 ++--- src/search/heuristics/max_heuristic.cc | 8 ++--- .../landmark_cost_partitioning_heuristic.cc | 3 +- .../landmark_cost_partitioning_heuristic.h | 1 - src/search/landmarks/landmark_heuristic.cc | 11 ++----- src/search/landmarks/landmark_heuristic.h | 4 +-- .../landmarks/landmark_sum_heuristic.cc | 33 ++++++++++++------- src/search/landmarks/landmark_sum_heuristic.h | 3 +- src/search/tasks/default_value_axioms_task.cc | 4 +-- 12 files changed, 37 insertions(+), 58 deletions(-) diff --git a/src/search/heuristics/additive_heuristic.cc b/src/search/heuristics/additive_heuristic.cc index aff35d07be..943c2789c2 100644 --- a/src/search/heuristics/additive_heuristic.cc +++ b/src/search/heuristics/additive_heuristic.cc @@ -159,15 +159,11 @@ class AdditiveHeuristicFeature document_language_support("action costs", "supported"); document_language_support("conditional effects", "supported"); - document_language_support( - "axioms", - "supported (in the sense that the planner won't complain -- " - "handling of axioms might be very stupid " - "and even render the heuristic unsafe)"); + document_language_support("axioms", "supported"); document_property("admissible", "no"); document_property("consistent", "no"); - document_property("safe", "yes for tasks without axioms"); + document_property("safe", "yes"); document_property("preferred operators", "yes"); } diff --git a/src/search/heuristics/cea_heuristic.cc b/src/search/heuristics/cea_heuristic.cc index 952f905220..8f1c25f84d 100644 --- a/src/search/heuristics/cea_heuristic.cc +++ b/src/search/heuristics/cea_heuristic.cc @@ -458,11 +458,7 @@ class ContextEnhancedAdditiveHeuristicFeature document_language_support("action costs", "supported"); document_language_support("conditional effects", "supported"); - document_language_support( - "axioms", - "supported (in the sense that the planner won't complain -- " - "handling of axioms might be very stupid " - "and even render the heuristic unsafe)"); + document_language_support("axioms", "supported"); document_property("admissible", "no"); document_property("consistent", "no"); diff --git a/src/search/heuristics/cg_heuristic.cc b/src/search/heuristics/cg_heuristic.cc index a8dea593db..313f3e8ee7 100644 --- a/src/search/heuristics/cg_heuristic.cc +++ b/src/search/heuristics/cg_heuristic.cc @@ -303,11 +303,7 @@ class CGHeuristicFeature document_language_support("action costs", "supported"); document_language_support("conditional effects", "supported"); - document_language_support( - "axioms", - "supported (in the sense that the planner won't complain -- " - "handling of axioms might be very stupid " - "and even render the heuristic unsafe)"); + document_language_support("axioms", "supported"); document_property("admissible", "no"); document_property("consistent", "no"); diff --git a/src/search/heuristics/ff_heuristic.cc b/src/search/heuristics/ff_heuristic.cc index 39f727258c..3c98e97bca 100644 --- a/src/search/heuristics/ff_heuristic.cc +++ b/src/search/heuristics/ff_heuristic.cc @@ -84,15 +84,11 @@ class FFHeuristicFeature document_language_support("action costs", "supported"); document_language_support("conditional effects", "supported"); - document_language_support( - "axioms", - "supported (in the sense that the planner won't complain -- " - "handling of axioms might be very stupid " - "and even render the heuristic unsafe)"); + document_language_support("axioms", "supported"); document_property("admissible", "no"); document_property("consistent", "no"); - document_property("safe", "yes for tasks without axioms"); + document_property("safe", "yes"); document_property("preferred operators", "yes"); } diff --git a/src/search/heuristics/max_heuristic.cc b/src/search/heuristics/max_heuristic.cc index a0d78e2f8a..ee7691278a 100644 --- a/src/search/heuristics/max_heuristic.cc +++ b/src/search/heuristics/max_heuristic.cc @@ -113,15 +113,11 @@ class HSPMaxHeuristicFeature document_language_support("action costs", "supported"); document_language_support("conditional effects", "supported"); - document_language_support( - "axioms", - "supported (in the sense that the planner won't complain -- " - "handling of axioms might be very stupid " - "and even render the heuristic unsafe)"); + document_language_support("axioms", "supported"); document_property("admissible", "yes for tasks without axioms"); document_property("consistent", "yes for tasks without axioms"); - document_property("safe", "yes for tasks without axioms"); + document_property("safe", "yes"); document_property("preferred operators", "no"); } diff --git a/src/search/landmarks/landmark_cost_partitioning_heuristic.cc b/src/search/landmarks/landmark_cost_partitioning_heuristic.cc index b1adc45d0a..a66524ce8f 100644 --- a/src/search/landmarks/landmark_cost_partitioning_heuristic.cc +++ b/src/search/landmarks/landmark_cost_partitioning_heuristic.cc @@ -18,13 +18,12 @@ namespace landmarks { LandmarkCostPartitioningHeuristic::LandmarkCostPartitioningHeuristic( const shared_ptr &lm_factory, bool pref, bool prog_goal, bool prog_gn, bool prog_r, - tasks::AxiomHandlingType axioms, const shared_ptr &transform, bool cache_estimates, const string &description, utils::Verbosity verbosity, CostPartitioningMethod cost_partitioning, bool alm, lp::LPSolverType lpsolver) : LandmarkHeuristic( - axioms, pref, transform, cache_estimates, description, verbosity) { + pref, transform, cache_estimates, description, verbosity) { if (log.is_at_least_normal()) { log << "Initializing landmark cost partitioning heuristic..." << endl; } diff --git a/src/search/landmarks/landmark_cost_partitioning_heuristic.h b/src/search/landmarks/landmark_cost_partitioning_heuristic.h index fb57717c04..be64e867cd 100644 --- a/src/search/landmarks/landmark_cost_partitioning_heuristic.h +++ b/src/search/landmarks/landmark_cost_partitioning_heuristic.h @@ -26,7 +26,6 @@ class LandmarkCostPartitioningHeuristic : public LandmarkHeuristic { LandmarkCostPartitioningHeuristic( const std::shared_ptr &lm_factory, bool pref, bool prog_goal, bool prog_gn, bool prog_r, - tasks::AxiomHandlingType axioms, const std::shared_ptr &transform, bool cache_estimates, const std::string &description, utils::Verbosity verbosity, diff --git a/src/search/landmarks/landmark_heuristic.cc b/src/search/landmarks/landmark_heuristic.cc index cd0d75e1bf..d8a5a8d6dc 100644 --- a/src/search/landmarks/landmark_heuristic.cc +++ b/src/search/landmarks/landmark_heuristic.cc @@ -14,12 +14,10 @@ using namespace std; namespace landmarks { LandmarkHeuristic::LandmarkHeuristic( - tasks::AxiomHandlingType axioms, bool use_preferred_operators, + bool use_preferred_operators, const shared_ptr &transform, bool cache_estimates, const string &description, utils::Verbosity verbosity) - : Heuristic(tasks::get_default_value_axioms_task_if_needed( - transform, axioms), - cache_estimates, description, verbosity), + : Heuristic(transform, cache_estimates, description, verbosity), use_preferred_operators(use_preferred_operators), successor_generator(nullptr) { } @@ -228,7 +226,6 @@ void add_landmark_heuristic_options_to_feature( "prog_gn", "Use greedy-necessary ordering progression.", "true"); feature.add_option( "prog_r", "Use reasonable ordering progression.", "true"); - tasks::add_axioms_option_to_feature(feature); add_heuristic_options_to_feature(feature, description); feature.document_property("preferred operators", @@ -236,8 +233,7 @@ void add_landmark_heuristic_options_to_feature( } tuple, bool, bool, bool, bool, - tasks::AxiomHandlingType, shared_ptr, bool, string, - utils::Verbosity> + shared_ptr, bool, string, utils::Verbosity> get_landmark_heuristic_arguments_from_options( const plugins::Options &opts) { return tuple_cat( @@ -247,7 +243,6 @@ get_landmark_heuristic_arguments_from_options( opts.get("prog_goal"), opts.get("prog_gn"), opts.get("prog_r")), - tasks::get_axioms_arguments_from_options(opts), get_heuristic_arguments_from_options(opts)); } } diff --git a/src/search/landmarks/landmark_heuristic.h b/src/search/landmarks/landmark_heuristic.h index 55f0deab00..ab50bf9a03 100644 --- a/src/search/landmarks/landmark_heuristic.h +++ b/src/search/landmarks/landmark_heuristic.h @@ -46,7 +46,6 @@ class LandmarkHeuristic : public Heuristic { virtual int compute_heuristic(const State &ancestor_state) override; public: LandmarkHeuristic( - tasks::AxiomHandlingType axioms, bool use_preferred_operators, const std::shared_ptr &transform, bool cache_estimates, const std::string &description, @@ -66,8 +65,7 @@ class LandmarkHeuristic : public Heuristic { extern void add_landmark_heuristic_options_to_feature( plugins::Feature &feature, const std::string &description); extern std::tuple, bool, bool, bool, - bool, tasks::AxiomHandlingType, - std::shared_ptr, bool, std::string, + bool, std::shared_ptr, bool, std::string, utils::Verbosity> get_landmark_heuristic_arguments_from_options( const plugins::Options &opts); diff --git a/src/search/landmarks/landmark_sum_heuristic.cc b/src/search/landmarks/landmark_sum_heuristic.cc index 51f447a54f..08067e7707 100644 --- a/src/search/landmarks/landmark_sum_heuristic.cc +++ b/src/search/landmarks/landmark_sum_heuristic.cc @@ -31,14 +31,15 @@ static bool are_dead_ends_reliable( } LandmarkSumHeuristic::LandmarkSumHeuristic( - const shared_ptr &lm_factory, bool pref, - bool prog_goal, bool prog_gn, bool prog_r, - tasks::AxiomHandlingType axioms, + const shared_ptr &lm_factory, + bool pref, bool prog_goal, bool prog_gn, bool prog_r, const shared_ptr &transform, bool cache_estimates, - const string &description, utils::Verbosity verbosity) + const string &description, utils::Verbosity verbosity, + tasks::AxiomHandlingType axioms) : LandmarkHeuristic( - axioms, pref, transform, cache_estimates, - description, verbosity), + pref, + tasks::get_default_value_axioms_task_if_needed(transform, axioms), + cache_estimates, description, verbosity), dead_ends_reliable( are_dead_ends_reliable(lm_factory, task_proxy)) { if (log.is_at_least_normal()) { @@ -141,9 +142,17 @@ class LandmarkSumHeuristicFeature "39", "127-177", "2010")); - + /* + We usually have the options of base classes behind the options + of specific implementations. In the case of landmark + heuristics, we decided to have the common options at the front + because it feels more natural to specify the landmark factory + before the more specific arguments like the used LP solver in + the case of an optimal cost partitioning heuristic. + */ add_landmark_heuristic_options_to_feature( *this, "landmark_sum_heuristic"); + tasks::add_axioms_option_to_feature(*this); document_note( "Note on performance for satisficing planning", @@ -185,22 +194,22 @@ class LandmarkSumHeuristicFeature "conditional_effects", "supported if the LandmarkFactory supports them; otherwise " "ignored"); - document_language_support("axioms", "ignored"); + document_language_support("axioms", "supported"); document_property("admissible", "no"); document_property("consistent", "no"); document_property( "safe", - "yes except on tasks with axioms or on tasks with " - "conditional effects when using a LandmarkFactory " - "not supporting them"); + "yes except on tasks with conditional effects when " + "using a LandmarkFactory not supporting them"); } virtual shared_ptr create_component( const plugins::Options &opts, const utils::Context &) const override { return plugins::make_shared_from_arg_tuples( - get_landmark_heuristic_arguments_from_options(opts)); + get_landmark_heuristic_arguments_from_options(opts), + tasks::get_axioms_arguments_from_options(opts)); } }; diff --git a/src/search/landmarks/landmark_sum_heuristic.h b/src/search/landmarks/landmark_sum_heuristic.h index 70775e6587..9783f43bd3 100644 --- a/src/search/landmarks/landmark_sum_heuristic.h +++ b/src/search/landmarks/landmark_sum_heuristic.h @@ -19,10 +19,9 @@ class LandmarkSumHeuristic : public LandmarkHeuristic { LandmarkSumHeuristic( const std::shared_ptr &lm_factory, bool pref, bool prog_goal, bool prog_gn, bool prog_r, - tasks::AxiomHandlingType axioms, const std::shared_ptr &transform, bool cache_estimates, const std::string &description, - utils::Verbosity verbosity); + utils::Verbosity verbosity, tasks::AxiomHandlingType axioms); virtual bool dead_ends_are_reliable() const override; }; diff --git a/src/search/tasks/default_value_axioms_task.cc b/src/search/tasks/default_value_axioms_task.cc index 61241f7b59..e080bcf494 100644 --- a/src/search/tasks/default_value_axioms_task.cc +++ b/src/search/tasks/default_value_axioms_task.cc @@ -421,9 +421,9 @@ static plugins::TypedEnumPlugin _enum_plugin({ {"approximate_negative_cycles", "Overapproximate negated axioms for all derived variables which " "have cyclic dependencies by setting an empty condition, " - "indicating the default value can always be achieved for free." + "indicating the default value can always be achieved for free. " "For all other derived variables, the negated axioms are computed" "exactly. Note that this can potentially lead to a combinatorial " - "explosion"} + "explosion."} }); }