Skip to content

Commit

Permalink
[trivial] Update documentation regarding safety for tasks with axioms.
Browse files Browse the repository at this point in the history
  • Loading branch information
salome-eriksson authored Oct 7, 2024
1 parent 3ff4081 commit 036fffa
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 58 deletions.
8 changes: 2 additions & 6 deletions src/search/heuristics/additive_heuristic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down
6 changes: 1 addition & 5 deletions src/search/heuristics/cea_heuristic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
6 changes: 1 addition & 5 deletions src/search/heuristics/cg_heuristic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
8 changes: 2 additions & 6 deletions src/search/heuristics/ff_heuristic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down
8 changes: 2 additions & 6 deletions src/search/heuristics/max_heuristic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down
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
33 changes: 21 additions & 12 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(
const shared_ptr<LandmarkFactory> &lm_factory, bool pref,
bool prog_goal, bool prog_gn, bool prog_r,
tasks::AxiomHandlingType axioms,
const shared_ptr<LandmarkFactory> &lm_factory,
bool pref, bool prog_goal, bool prog_gn, bool prog_r,
const shared_ptr<AbstractTask> &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()) {
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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<LandmarkSumHeuristic> create_component(
const plugins::Options &opts,
const utils::Context &) const override {
return plugins::make_shared_from_arg_tuples<LandmarkSumHeuristic>(
get_landmark_heuristic_arguments_from_options(opts));
get_landmark_heuristic_arguments_from_options(opts),
tasks::get_axioms_arguments_from_options(opts));
}
};

Expand Down
3 changes: 1 addition & 2 deletions src/search/landmarks/landmark_sum_heuristic.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ class LandmarkSumHeuristic : public LandmarkHeuristic {
LandmarkSumHeuristic(
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);
utils::Verbosity verbosity, tasks::AxiomHandlingType axioms);

virtual bool dead_ends_are_reliable() const override;
};
Expand Down
4 changes: 2 additions & 2 deletions src/search/tasks/default_value_axioms_task.cc
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,9 @@ static plugins::TypedEnumPlugin<AxiomHandlingType> _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."}
});
}

0 comments on commit 036fffa

Please sign in to comment.