Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue1126 #195

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/search/landmarks/landmark.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "../task_proxy.h"

#include <set>
#include <unordered_set>

namespace landmarks {
class Landmark {
Expand Down Expand Up @@ -31,8 +31,8 @@ class Landmark {
bool is_true_in_goal;
bool is_derived;

std::set<int> first_achievers;
std::set<int> possible_achievers;
std::unordered_set<int> first_achievers;
std::unordered_set<int> possible_achievers;

bool is_true_in_state(const State &state) const;
};
Expand Down
10 changes: 5 additions & 5 deletions src/search/landmarks/landmark_cost_partitioning_algorithms.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ CostPartitioningAlgorithm::CostPartitioningAlgorithm(
: lm_graph(graph), operator_costs(operator_costs) {
}

const set<int> &CostPartitioningAlgorithm::get_achievers(
const unordered_set<int> &CostPartitioningAlgorithm::get_achievers(
const Landmark &landmark, bool past) const {
// Return relevant achievers of the landmark according to its status.
if (past) {
Expand Down Expand Up @@ -60,7 +60,7 @@ double UniformCostPartitioningAlgorithm::get_cost_partitioned_heuristic_value(
for (auto &node : nodes) {
int id = node->get_id();
if (future.test(id)) {
const set<int> &achievers =
const unordered_set<int> &achievers =
get_achievers(node->get_landmark(), past.test(id));
if (achievers.empty())
return numeric_limits<double>::max();
Expand Down Expand Up @@ -93,7 +93,7 @@ double UniformCostPartitioningAlgorithm::get_cost_partitioned_heuristic_value(
for (auto &node : nodes) {
int id = node->get_id();
if (future.test(id)) {
const set<int> &achievers =
const unordered_set<int> &achievers =
get_achievers(node->get_landmark(), past.test(id));
bool covered_by_action_lm = false;
for (int op_id : achievers) {
Expand All @@ -120,7 +120,7 @@ double UniformCostPartitioningAlgorithm::get_cost_partitioned_heuristic_value(
// TODO: Iterate over Landmarks instead of LandmarkNodes
int id = node->get_id();
assert(future.test(id));
const set<int> &achievers =
const unordered_set<int> &achievers =
get_achievers(node->get_landmark(), past.test(id));
double min_cost = numeric_limits<double>::max();
for (int op_id : achievers) {
Expand Down Expand Up @@ -216,7 +216,7 @@ double OptimalCostPartitioningAlgorithm::get_cost_partitioned_heuristic_value(
for (int lm_id = 0; lm_id < num_cols; ++lm_id) {
const Landmark &landmark = lm_graph.get_node(lm_id)->get_landmark();
if (future.test(lm_id)) {
const set<int> &achievers =
const unordered_set<int> &achievers =
get_achievers(landmark, past.test(lm_id));
if (achievers.empty())
return numeric_limits<double>::max();
Expand Down
4 changes: 2 additions & 2 deletions src/search/landmarks/landmark_cost_partitioning_algorithms.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "../lp/lp_solver.h"

#include <set>
#include <unordered_set>
#include <vector>

class OperatorsProxy;
Expand All @@ -21,7 +21,7 @@ class CostPartitioningAlgorithm {
const LandmarkGraph &lm_graph;
const std::vector<int> operator_costs;

const std::set<int> &get_achievers(
const std::unordered_set<int> &get_achievers(
const Landmark &landmark, bool past) const;
public:
CostPartitioningAlgorithm(const std::vector<int> &operator_costs,
Expand Down
2 changes: 1 addition & 1 deletion src/search/landmarks/landmark_sum_heuristic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ LandmarkSumHeuristic::LandmarkSumHeuristic(const plugins::Options &opts)
}

int LandmarkSumHeuristic::get_min_cost_of_achievers(
const set<int> &achievers) const {
const unordered_set<int> &achievers) const {
int min_cost = numeric_limits<int>::max();
for (int id : achievers) {
OperatorProxy op = get_operator_or_axiom(task_proxy, id);
Expand Down
3 changes: 2 additions & 1 deletion src/search/landmarks/landmark_sum_heuristic.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class LandmarkSumHeuristic : public LandmarkHeuristic {
std::vector<int> min_first_achiever_costs;
std::vector<int> min_possible_achiever_costs;

int get_min_cost_of_achievers(const std::set<int> &achievers) const;
int get_min_cost_of_achievers(
const std::unordered_set<int> &achievers) const;
void compute_landmark_costs();

int get_heuristic_value(const State &ancestor_state) override;
Expand Down