diff --git a/src/search/landmarks/landmark_sum_heuristic.cc b/src/search/landmarks/landmark_sum_heuristic.cc index f0ef13334a..01a037d4e5 100644 --- a/src/search/landmarks/landmark_sum_heuristic.cc +++ b/src/search/landmarks/landmark_sum_heuristic.cc @@ -31,8 +31,8 @@ static bool are_dead_ends_reliable( } LandmarkSumHeuristic::LandmarkSumHeuristic( - tasks::AxiomHandlingType axioms, - const shared_ptr &lm_factory, bool pref, + const shared_ptr &lm_factory, + tasks::AxiomHandlingType axioms, bool pref, bool prog_goal, bool prog_gn, bool prog_r, const shared_ptr &transform, bool cache_estimates, const string &description, utils::Verbosity verbosity) @@ -115,6 +115,61 @@ bool LandmarkSumHeuristic::dead_ends_are_reliable() const { return dead_ends_reliable; } + +void add_landmark_sum_heuristic_options_to_feature( + plugins::Feature &feature, const string &description) { + feature.document_synopsis( + "Landmark progression is implemented according to the following paper:" + + utils::format_conference_reference( + {"Clemens Büchner", "Thomas Keller", "Salomé Eriksson", "Malte Helmert"}, + "Landmarks Progression in Heuristic Search", + "https://ai.dmi.unibas.ch/papers/buechner-et-al-icaps2023.pdf", + "Proceedings of the Thirty-Third International Conference on " + "Automated Planning and Scheduling (ICAPS 2023)", + "70-79", + "AAAI Press", + "2023")); + + feature.add_option>( + "lm_factory", + "the set of landmarks to use for this heuristic. " + "The set of landmarks can be specified here, " + "or predefined (see LandmarkFactory)."); + tasks::add_axioms_option_to_feature(feature); + feature.add_option( + "pref", + "enable preferred operators (see note below)", + "false"); + /* TODO: Do we really want these options or should we just always progress + everything we can? */ + feature.add_option( + "prog_goal", "Use goal progression.", "true"); + feature.add_option( + "prog_gn", "Use greedy-necessary ordering progression.", "true"); + feature.add_option( + "prog_r", "Use reasonable ordering progression.", "true"); + add_heuristic_options_to_feature(feature, description); + + feature.document_property("preferred operators", + "yes (if enabled; see ``pref`` option)"); +} + +tuple, tasks::AxiomHandlingType, bool, bool, bool, + bool, shared_ptr, bool, string, utils::Verbosity> +get_landmark_sum_heuristic_arguments_from_options( + const plugins::Options &opts) { + return tuple_cat( + make_tuple( + opts.get>("lm_factory")), + tasks::get_axioms_arguments_from_options(opts), + make_tuple( + opts.get("pref"), + opts.get("prog_goal"), + opts.get("prog_gn"), + opts.get("prog_r")), + get_heuristic_arguments_from_options(opts)); +} + class LandmarkSumHeuristicFeature : public plugins::TypedFeature { public: @@ -143,8 +198,7 @@ class LandmarkSumHeuristicFeature "127-177", "2010")); - tasks::add_axioms_option_to_feature(*this); - add_landmark_heuristic_options_to_feature( + add_landmark_sum_heuristic_options_to_feature( *this, "landmark_sum_heuristic"); document_note( @@ -201,8 +255,7 @@ class LandmarkSumHeuristicFeature const plugins::Options &opts, const utils::Context &) const override { return plugins::make_shared_from_arg_tuples( - tasks::get_axioms_arguments_from_options(opts), - get_landmark_heuristic_arguments_from_options(opts)); + get_landmark_sum_heuristic_arguments_from_options(opts)); } }; diff --git a/src/search/landmarks/landmark_sum_heuristic.h b/src/search/landmarks/landmark_sum_heuristic.h index c71dda4908..e19f1459d6 100644 --- a/src/search/landmarks/landmark_sum_heuristic.h +++ b/src/search/landmarks/landmark_sum_heuristic.h @@ -17,8 +17,8 @@ class LandmarkSumHeuristic : public LandmarkHeuristic { int get_heuristic_value(const State &ancestor_state) override; public: LandmarkSumHeuristic( - tasks::AxiomHandlingType axioms, - const std::shared_ptr &lm_factory, bool pref, + const std::shared_ptr &lm_factory, + tasks::AxiomHandlingType axioms, bool pref, bool prog_goal, bool prog_gn, bool prog_r, const std::shared_ptr &transform, bool cache_estimates, const std::string &description, @@ -26,6 +26,14 @@ class LandmarkSumHeuristic : public LandmarkHeuristic { virtual bool dead_ends_are_reliable() const override; }; + +extern void add_landmark_sum_heuristic_options_to_feature( + plugins::Feature &feature, const std::string &description); +extern std::tuple, tasks::AxiomHandlingType, + bool, bool, bool, bool, std::shared_ptr, bool, + std::string, utils::Verbosity> +get_landmark_sum_heuristic_arguments_from_options( + const plugins::Options &opts); } #endif