Skip to content

Commit

Permalink
[issue1082] add more indirection to RelaxationHeuristics to mathc the…
Browse files Browse the repository at this point in the history
… pattern.
  • Loading branch information
SimonDold committed Feb 7, 2024
1 parent 72b0915 commit a956c83
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/search/heuristics/additive_heuristic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ void AdditiveHeuristic::compute_heuristic_for_cegar(const State &state) {
compute_heuristic(state);
}

shared_ptr<tuple<shared_ptr<AbstractTask>, bool, string, utils::Verbosity>> get_additive_heuristic_parameters_from_options(const plugins::Options &opts) {
return relaxation_heuristic::get_relaxation_heuristic_parameters_from_options(opts);
}

class AdditiveHeuristicFeature : public plugins::TypedFeature<Evaluator, AdditiveHeuristic> {
public:
AdditiveHeuristicFeature() : TypedFeature("add") {
Expand Down
4 changes: 4 additions & 0 deletions src/search/heuristics/additive_heuristic.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ class AdditiveHeuristic : public relaxation_heuristic::RelaxationHeuristic {
return get_proposition(var, value)->cost;
}
};

extern std::shared_ptr<std::tuple<std::shared_ptr<AbstractTask>, bool, std::string, utils::Verbosity>> get_additive_heuristic_parameters_from_options(const plugins::Options &opts);


}

#endif
2 changes: 1 addition & 1 deletion src/search/heuristics/ff_heuristic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class FFHeuristicFeature : public plugins::TypedFeature<Evaluator, FFHeuristic>
virtual shared_ptr<FFHeuristic> create_component(
const plugins::Options &opts, const utils::Context &) const override {
return plugins::make_shared_from_args_tuple_and_args<FFHeuristic>(
Heuristic::get_heuristic_parameters_from_options(opts)
additive_heuristic::get_additive_heuristic_parameters_from_options(opts)
);
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/search/heuristics/max_heuristic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class HSPMaxHeuristicFeature : public plugins::TypedFeature<Evaluator, HSPMaxHeu
virtual shared_ptr<HSPMaxHeuristic> create_component(
const plugins::Options &opts, const utils::Context &) const override {
return plugins::make_shared_from_args_tuple_and_args<HSPMaxHeuristic>(
Heuristic::get_heuristic_parameters_from_options(opts));
relaxation_heuristic::get_relaxation_heuristic_parameters_from_options(opts));
}
};

Expand Down
5 changes: 5 additions & 0 deletions src/search/heuristics/relaxation_heuristic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -305,4 +305,9 @@ void RelaxationHeuristic::simplify() {
log << " done! [" << unary_operators.size() << " unary operators]" << endl;
}
}

shared_ptr<tuple<shared_ptr<AbstractTask>, bool, string, utils::Verbosity>> get_relaxation_heuristic_parameters_from_options(const plugins::Options &opts) {
return Heuristic::get_heuristic_parameters_from_options(opts);
}

}
2 changes: 2 additions & 0 deletions src/search/heuristics/relaxation_heuristic.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ class RelaxationHeuristic : public Heuristic {

virtual bool dead_ends_are_reliable() const override;
};

std::shared_ptr<std::tuple<std::shared_ptr<AbstractTask>, bool, std::string, utils::Verbosity>> get_relaxation_heuristic_parameters_from_options(const plugins::Options &opts);
}

#endif

0 comments on commit a956c83

Please sign in to comment.