From bd3c63647a42c9a5f103402615ca991d23a88d55 Mon Sep 17 00:00:00 2001 From: ClemensBuechner Date: Fri, 4 Aug 2023 13:52:09 +0200 Subject: [PATCH] [issue1089] Remove obedient-reasonable ordering type. We remove this landmark ordering type as it is no longer used after generating the orderings. --- src/search/landmarks/landmark_factory.cc | 7 +- .../landmark_factory_reasonable_orders_hps.cc | 65 +++++++++---------- .../landmark_factory_reasonable_orders_hps.h | 5 +- src/search/landmarks/landmark_graph.h | 9 ++- src/search/landmarks/util.cc | 3 - 5 files changed, 39 insertions(+), 50 deletions(-) diff --git a/src/search/landmarks/landmark_factory.cc b/src/search/landmarks/landmark_factory.cc index 654acd6efe..88fedd62a5 100644 --- a/src/search/landmarks/landmark_factory.cc +++ b/src/search/landmarks/landmark_factory.cc @@ -103,7 +103,7 @@ void LandmarkFactory::edge_add(LandmarkNode &from, LandmarkNode &to, */ assert(&from != &to); - if (type == EdgeType::REASONABLE || type == EdgeType::OBEDIENT_REASONABLE) { // simple cycle test + if (type == EdgeType::REASONABLE) { // simple cycle test if (from.parents.find(&to) != from.parents.end()) { // Edge in opposite direction exists if (log.is_at_least_debug()) { log << "edge in opposite direction exists" << endl; @@ -160,8 +160,7 @@ void LandmarkFactory::mk_acyclic_graph() { // the old method for this is no longer available. // assert(acyclic_node_set.size() == number_of_landmarks()); if (log.is_at_least_normal()) { - log << "Removed " << removed_edges - << " reasonable or obedient reasonable orders" << endl; + log << "Removed " << removed_edges << " reasonable orders" << endl; } } @@ -179,7 +178,7 @@ void LandmarkFactory::remove_first_weakest_cycle_edge( to = next(it2)->first; weakest_edge = edge; } - if (weakest_edge == EdgeType::OBEDIENT_REASONABLE) { + if (weakest_edge == EdgeType::REASONABLE) { break; } } diff --git a/src/search/landmarks/landmark_factory_reasonable_orders_hps.cc b/src/search/landmarks/landmark_factory_reasonable_orders_hps.cc index 5673fab9a9..9546f35ada 100644 --- a/src/search/landmarks/landmark_factory_reasonable_orders_hps.cc +++ b/src/search/landmarks/landmark_factory_reasonable_orders_hps.cc @@ -28,22 +28,14 @@ void LandmarkFactoryReasonableOrdersHPS::generate_landmarks(const shared_ptrget_nodes()) { const Landmark &landmark2 = node2_p->get_landmark(); if (landmark == landmark2 || landmark2.disjunctive) @@ -84,11 +76,10 @@ void LandmarkFactoryReasonableOrdersHPS::approximate_reasonable_orders( const EdgeType &edge = p.second; if (parent_node.get_landmark().disjunctive) continue; - if ((edge >= EdgeType::NATURAL || (obedient_orders && edge == EdgeType::REASONABLE)) && - &parent_node != node_p.get()) { + if (edge >= EdgeType::NATURAL && &parent_node != node_p.get()) { // find predecessors or parent and collect in "interesting nodes" interesting_nodes.insert(&parent_node); - collect_ancestors(interesting_nodes, parent_node, obedient_orders); + collect_ancestors(interesting_nodes, parent_node); } } } @@ -100,10 +91,7 @@ void LandmarkFactoryReasonableOrdersHPS::approximate_reasonable_orders( if (landmark == landmark2 || landmark2.disjunctive) continue; if (interferes(task_proxy, landmark2, landmark)) { - if (!obedient_orders) - edge_add(*node2_p, *node_p, EdgeType::REASONABLE); - else - edge_add(*node2_p, *node_p, EdgeType::OBEDIENT_REASONABLE); + edge_add(*node2_p, *node_p, EdgeType::REASONABLE); } } } @@ -221,8 +209,7 @@ bool LandmarkFactoryReasonableOrdersHPS::interferes( } void LandmarkFactoryReasonableOrdersHPS::collect_ancestors( - unordered_set &result, - LandmarkNode &node, bool use_reasonable) { + unordered_set &result, LandmarkNode &node) { /* Returns all ancestors in the landmark graph of landmark node "start" */ // There could be cycles if use_reasonable == true @@ -231,24 +218,21 @@ void LandmarkFactoryReasonableOrdersHPS::collect_ancestors( for (const auto &p : node.parents) { LandmarkNode &parent = *(p.first); const EdgeType &edge = p.second; - if (edge >= EdgeType::NATURAL || (use_reasonable && edge == EdgeType::REASONABLE)) - if (closed_nodes.count(&parent) == 0) { - open_nodes.push_back(&parent); - closed_nodes.insert(&parent); - result.insert(&parent); - } + if (edge >= EdgeType::NATURAL && closed_nodes.count(&parent) == 0) { + open_nodes.push_back(&parent); + closed_nodes.insert(&parent); + result.insert(&parent); + } } while (!open_nodes.empty()) { LandmarkNode &node2 = *(open_nodes.front()); for (const auto &p : node2.parents) { LandmarkNode &parent = *(p.first); const EdgeType &edge = p.second; - if (edge >= EdgeType::NATURAL || (use_reasonable && edge == EdgeType::REASONABLE)) { - if (closed_nodes.count(&parent) == 0) { - open_nodes.push_back(&parent); - closed_nodes.insert(&parent); - result.insert(&parent); - } + if (edge >= EdgeType::NATURAL && closed_nodes.count(&parent) == 0) { + open_nodes.push_back(&parent); + closed_nodes.insert(&parent); + result.insert(&parent); } } open_nodes.pop_front(); @@ -382,8 +366,7 @@ class LandmarkFactoryReasonableOrdersHPSFeature : public plugins::TypedFeature>("lm_factory"); add_landmark_factory_options_to_feature(*this); diff --git a/src/search/landmarks/landmark_factory_reasonable_orders_hps.h b/src/search/landmarks/landmark_factory_reasonable_orders_hps.h index f1b3787c59..b9628b3ce2 100644 --- a/src/search/landmarks/landmark_factory_reasonable_orders_hps.h +++ b/src/search/landmarks/landmark_factory_reasonable_orders_hps.h @@ -10,13 +10,12 @@ class LandmarkFactoryReasonableOrdersHPS : public LandmarkFactory { virtual void generate_landmarks(const std::shared_ptr &task) override; void approximate_reasonable_orders( - const TaskProxy &task_proxy, bool obedient_orders); + const TaskProxy &task_proxy); bool interferes( const TaskProxy &task_proxy, const Landmark &landmark_a, const Landmark &landmark_b) const; void collect_ancestors( - std::unordered_set &result, - LandmarkNode &node, bool use_reasonable); + std::unordered_set &result, LandmarkNode &node); bool effect_always_happens( const VariablesProxy &variables, const EffectsProxy &effects, std::set &eff) const; diff --git a/src/search/landmarks/landmark_graph.h b/src/search/landmarks/landmark_graph.h index 072522c638..f198bba02b 100644 --- a/src/search/landmarks/landmark_graph.h +++ b/src/search/landmarks/landmark_graph.h @@ -25,11 +25,10 @@ enum class EdgeType { special case of greedy-necessary, i.e., every necessary ordering is greedy-necessary, but not vice versa. */ - NECESSARY = 4, - GREEDY_NECESSARY = 3, - NATURAL = 2, - REASONABLE = 1, - OBEDIENT_REASONABLE = 0 + NECESSARY = 3, + GREEDY_NECESSARY = 2, + NATURAL = 1, + REASONABLE = 0 }; class LandmarkNode { diff --git a/src/search/landmarks/util.cc b/src/search/landmarks/util.cc index 442fdfc87e..9d1984dd54 100644 --- a/src/search/landmarks/util.cc +++ b/src/search/landmarks/util.cc @@ -130,9 +130,6 @@ static void dump_edge(int from, int to, EdgeType edge, utils::LogProxy &log) { case EdgeType::REASONABLE: cout << "\"r\", style=dashed"; break; - case EdgeType::OBEDIENT_REASONABLE: - cout << "\"o_r\", style=dashed"; - break; } cout << "];\n"; }