Skip to content

Commit

Permalink
Update ContextEnhancedAdditiveHeuristic
Browse files Browse the repository at this point in the history
  • Loading branch information
grucla committed Feb 7, 2024
1 parent 2e08173 commit 97246e8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/search/AAA_Mechanical_Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ search
│ ├── array_pool.h✅
│ ├── blind_search_heuristic.cc✅
│ ├── blind_search_heuristic.h✅
│ ├── cea_heuristic.cc
│ ├── cea_heuristic.h
│ ├── cea_heuristic.cc
│ ├── cea_heuristic.h
│ ├── cg_cache.cc
│ ├── cg_cache.h
│ ├── cg_heuristic.cc
Expand Down
16 changes: 13 additions & 3 deletions src/search/heuristics/cea_heuristic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,11 @@ int ContextEnhancedAdditiveHeuristic::compute_heuristic(
}

ContextEnhancedAdditiveHeuristic::ContextEnhancedAdditiveHeuristic(
const plugins::Options &opts)
: Heuristic(opts),
const shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const string &name,
utils::Verbosity verbosity)
: Heuristic(transform, cache_estimates, name, verbosity),
min_action_cost(task_properties::get_min_operator_cost(task_proxy)) {
if (log.is_at_least_normal()) {
log << "Initializing context-enhanced additive heuristic..." << endl;
Expand Down Expand Up @@ -448,7 +451,7 @@ class ContextEnhancedAdditiveHeuristicFeature : public plugins::TypedFeature<Eva
ContextEnhancedAdditiveHeuristicFeature() : TypedFeature("cea") {
document_title("Context-enhanced additive heuristic");

Heuristic::add_options_to_feature(*this);
Heuristic::add_options_to_feature(*this, "cea");

document_language_support("action costs", "supported");
document_language_support("conditional effects", "supported");
Expand All @@ -463,6 +466,13 @@ class ContextEnhancedAdditiveHeuristicFeature : public plugins::TypedFeature<Eva
document_property("safe", "no");
document_property("preferred operators", "yes");
}

virtual shared_ptr<ContextEnhancedAdditiveHeuristic> create_component(
const plugins::Options &opts, const utils::Context &) const override {
return plugins::make_shared_from_args_tuple_and_args<ContextEnhancedAdditiveHeuristic>(
Heuristic::get_heuristic_parameters_from_options(opts)
);
}
};

static plugins::FeaturePlugin<ContextEnhancedAdditiveHeuristicFeature> _plugin;
Expand Down
6 changes: 5 additions & 1 deletion src/search/heuristics/cea_heuristic.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ class ContextEnhancedAdditiveHeuristic : public Heuristic {
protected:
virtual int compute_heuristic(const State &ancestor_state) override;
public:
explicit ContextEnhancedAdditiveHeuristic(const plugins::Options &opts);
ContextEnhancedAdditiveHeuristic(
const std::shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const std::string &name,
utils::Verbosity verbosity);
~ContextEnhancedAdditiveHeuristic();
virtual bool dead_ends_are_reliable() const override;
};
Expand Down

0 comments on commit 97246e8

Please sign in to comment.