Skip to content

Commit

Permalink
Move axioms option from landmark_heuristic to landmark_sum_heuristic …
Browse files Browse the repository at this point in the history
…since landmark_cost_partitioning_heuristic does not support axioms.
  • Loading branch information
salome-eriksson committed Sep 17, 2024
1 parent e430a0f commit 56574b1
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 18 deletions.
3 changes: 1 addition & 2 deletions src/search/landmarks/landmark_cost_partitioning_heuristic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ namespace landmarks {
LandmarkCostPartitioningHeuristic::LandmarkCostPartitioningHeuristic(
const shared_ptr<LandmarkFactory> &lm_factory, bool pref,
bool prog_goal, bool prog_gn, bool prog_r,
tasks::AxiomHandlingType axioms,
const shared_ptr<AbstractTask> &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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class LandmarkCostPartitioningHeuristic : public LandmarkHeuristic {
LandmarkCostPartitioningHeuristic(
const std::shared_ptr<LandmarkFactory> &lm_factory, bool pref,
bool prog_goal, bool prog_gn, bool prog_r,
tasks::AxiomHandlingType axioms,
const std::shared_ptr<AbstractTask> &transform,
bool cache_estimates, const std::string &description,
utils::Verbosity verbosity,
Expand Down
11 changes: 3 additions & 8 deletions src/search/landmarks/landmark_heuristic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<AbstractTask> &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) {
}
Expand Down Expand Up @@ -228,16 +226,14 @@ void add_landmark_heuristic_options_to_feature(
"prog_gn", "Use greedy-necessary ordering progression.", "true");
feature.add_option<bool>(
"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",
"yes (if enabled; see ``pref`` option)");
}

tuple<shared_ptr<LandmarkFactory>, bool, bool, bool, bool,
tasks::AxiomHandlingType, shared_ptr<AbstractTask>, bool, string,
utils::Verbosity>
shared_ptr<AbstractTask>, bool, string, utils::Verbosity>
get_landmark_heuristic_arguments_from_options(
const plugins::Options &opts) {
return tuple_cat(
Expand All @@ -247,7 +243,6 @@ get_landmark_heuristic_arguments_from_options(
opts.get<bool>("prog_goal"),
opts.get<bool>("prog_gn"),
opts.get<bool>("prog_r")),
tasks::get_axioms_arguments_from_options(opts),
get_heuristic_arguments_from_options(opts));
}
}
4 changes: 1 addition & 3 deletions src/search/landmarks/landmark_heuristic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<AbstractTask> &transform,
bool cache_estimates, const std::string &description,
Expand All @@ -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<std::shared_ptr<LandmarkFactory>, bool, bool, bool,
bool, tasks::AxiomHandlingType,
std::shared_ptr<AbstractTask>, bool, std::string,
bool, std::shared_ptr<AbstractTask>, bool, std::string,
utils::Verbosity>
get_landmark_heuristic_arguments_from_options(
const plugins::Options &opts);
Expand Down
9 changes: 6 additions & 3 deletions src/search/landmarks/landmark_sum_heuristic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ static bool are_dead_ends_reliable(
}

LandmarkSumHeuristic::LandmarkSumHeuristic(
tasks::AxiomHandlingType axioms,
const shared_ptr<LandmarkFactory> &lm_factory, bool pref,
bool prog_goal, bool prog_gn, bool prog_r,
tasks::AxiomHandlingType axioms,
const shared_ptr<AbstractTask> &transform, bool cache_estimates,
const string &description, utils::Verbosity verbosity)
: 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()) {
Expand Down Expand Up @@ -142,6 +143,7 @@ class LandmarkSumHeuristicFeature
"127-177",
"2010"));

tasks::add_axioms_option_to_feature(*this);
add_landmark_heuristic_options_to_feature(
*this, "landmark_sum_heuristic");

Expand Down Expand Up @@ -199,6 +201,7 @@ class LandmarkSumHeuristicFeature
const plugins::Options &opts,
const utils::Context &) const override {
return plugins::make_shared_from_arg_tuples<LandmarkSumHeuristic>(
tasks::get_axioms_arguments_from_options(opts),
get_landmark_heuristic_arguments_from_options(opts));
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/search/landmarks/landmark_sum_heuristic.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ class LandmarkSumHeuristic : public LandmarkHeuristic {
int get_heuristic_value(const State &ancestor_state) override;
public:
LandmarkSumHeuristic(
tasks::AxiomHandlingType axioms,
const std::shared_ptr<LandmarkFactory> &lm_factory, bool pref,
bool prog_goal, bool prog_gn, bool prog_r,
tasks::AxiomHandlingType axioms,
const std::shared_ptr<AbstractTask> &transform,
bool cache_estimates, const std::string &description,
utils::Verbosity verbosity);
Expand Down

0 comments on commit 56574b1

Please sign in to comment.