Skip to content

Commit

Permalink
[issue1082] Jendriks requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonDold committed Feb 1, 2024
1 parent f03ba76 commit af6f95a
Show file tree
Hide file tree
Showing 16 changed files with 66 additions and 60 deletions.
13 changes: 7 additions & 6 deletions src/search/evaluator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@
using namespace std;


Evaluator::Evaluator(bool use_for_reporting_minima,
bool use_for_boosting,
bool use_for_counting_evaluations,
const string &name,
utils::Verbosity verbosity)
Evaluator::Evaluator(
bool use_for_reporting_minima,
bool use_for_boosting,
bool use_for_counting_evaluations,
const string &name,
utils::Verbosity verbosity)
: name(name),
use_for_reporting_minima(use_for_reporting_minima),
use_for_boosting(use_for_boosting),
use_for_counting_evaluations(use_for_counting_evaluations),
log(utils::get_log_from_verbosity(verbosity)) {
log(utils::get_log_for_verbosity(verbosity)) {
}


Expand Down
2 changes: 1 addition & 1 deletion src/search/evaluator.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Evaluator {
protected:
mutable utils::LogProxy log;
public:
explicit Evaluator(
Evaluator(
bool use_for_reporting_minima,
bool use_for_boosting,
bool use_for_counting_evaluations,
Expand Down
3 changes: 1 addition & 2 deletions src/search/heuristic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ Heuristic::Heuristic(
shared_ptr<AbstractTask> transform,
bool cache_estimates,
const string &name,
utils::Verbosity verbosity
)
utils::Verbosity verbosity)
: Evaluator(true, true, true, name, verbosity),
heuristic_cache(HEntry(NO_VALUE, true)), //TODO: is true really a good idea here?
cache_evaluator_values(cache_estimates),
Expand Down
9 changes: 5 additions & 4 deletions src/search/heuristic.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,11 @@ class Heuristic : public Evaluator {
State convert_ancestor_state(const State &ancestor_state) const;

public:
explicit Heuristic(std::shared_ptr<AbstractTask> transform,
bool cache_estimates,
const std::string &name,
utils::Verbosity verbosity);
Heuristic(
std::shared_ptr<AbstractTask> transform,
bool cache_estimates,
const std::string &name,
utils::Verbosity verbosity);
explicit Heuristic(const plugins::Options &opts);
virtual ~Heuristic() override;

Expand Down
10 changes: 5 additions & 5 deletions src/search/heuristics/additive_heuristic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ using namespace std;
namespace additive_heuristic {
const int AdditiveHeuristic::MAX_COST_VALUE;

AdditiveHeuristic::AdditiveHeuristic(const shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const string &name,
utils::Verbosity verbosity
)
AdditiveHeuristic::AdditiveHeuristic(
const shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const string &name,
utils::Verbosity verbosity)
: RelaxationHeuristic(transform, cache_estimates, name, verbosity),
did_write_overflow_warning(false) {
if (log.is_at_least_normal()) {
Expand Down
9 changes: 5 additions & 4 deletions src/search/heuristics/additive_heuristic.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ class AdditiveHeuristic : public relaxation_heuristic::RelaxationHeuristic {
// Common part of h^add and h^ff computation.
int compute_add_and_ff(const State &state);
public:
AdditiveHeuristic(const std::shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const std::string &name,
utils::Verbosity verbosity);
AdditiveHeuristic(
const std::shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const std::string &name,
utils::Verbosity verbosity);

/*
TODO: The two methods below are temporarily needed for the CEGAR
Expand Down
10 changes: 5 additions & 5 deletions src/search/heuristics/blind_search_heuristic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
using namespace std;

namespace blind_search_heuristic {
BlindSearchHeuristic::BlindSearchHeuristic(const shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const string &name,
utils::Verbosity verbosity
)
BlindSearchHeuristic::BlindSearchHeuristic(
const shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const string &name,
utils::Verbosity verbosity)
: Heuristic(transform, cache_estimates, name, verbosity),
min_operator_cost(task_properties::get_min_operator_cost(task_proxy)) {
if (log.is_at_least_normal()) {
Expand Down
9 changes: 5 additions & 4 deletions src/search/heuristics/blind_search_heuristic.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ class BlindSearchHeuristic : public Heuristic {
protected:
virtual int compute_heuristic(const State &ancestor_state) override;
public:
BlindSearchHeuristic(const std::shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const std::string &name,
utils::Verbosity verbosity);
BlindSearchHeuristic(
const std::shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const std::string &name,
utils::Verbosity verbosity);
~BlindSearchHeuristic();
};
}
Expand Down
10 changes: 5 additions & 5 deletions src/search/heuristics/ff_heuristic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ using namespace std;

namespace ff_heuristic {
// construction and destruction
FFHeuristic::FFHeuristic(const shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const string &name,
utils::Verbosity verbosity
)
FFHeuristic::FFHeuristic(
const shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const string &name,
utils::Verbosity verbosity)
: AdditiveHeuristic(transform, cache_estimates, name, verbosity),
relaxed_plan(task_proxy.get_operators().size(), false) {
if (log.is_at_least_normal()) {
Expand Down
9 changes: 5 additions & 4 deletions src/search/heuristics/ff_heuristic.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ class FFHeuristic : public additive_heuristic::AdditiveHeuristic {
protected:
virtual int compute_heuristic(const State &ancestor_state) override;
public:
explicit FFHeuristic(const std::shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const std::string &name,
utils::Verbosity verbosity);
FFHeuristic(
const std::shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const std::string &name,
utils::Verbosity verbosity);
};
}

Expand Down
10 changes: 5 additions & 5 deletions src/search/heuristics/max_heuristic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ namespace max_heuristic {
*/

// construction and destruction
HSPMaxHeuristic::HSPMaxHeuristic(const shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const string &name,
utils::Verbosity verbosity
)
HSPMaxHeuristic::HSPMaxHeuristic(
const shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const string &name,
utils::Verbosity verbosity)
: RelaxationHeuristic(transform, cache_estimates, name, verbosity) {
if (log.is_at_least_normal()) {
log << "Initializing HSP max heuristic..." << endl;
Expand Down
9 changes: 5 additions & 4 deletions src/search/heuristics/max_heuristic.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ class HSPMaxHeuristic : public relaxation_heuristic::RelaxationHeuristic {
protected:
virtual int compute_heuristic(const State &ancestor_state) override;
public:
explicit HSPMaxHeuristic(const std::shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const std::string &name,
utils::Verbosity verbosity);
HSPMaxHeuristic(
const std::shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const std::string &name,
utils::Verbosity verbosity);
};
}

Expand Down
10 changes: 5 additions & 5 deletions src/search/heuristics/relaxation_heuristic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ UnaryOperator::UnaryOperator(


// construction and destruction
RelaxationHeuristic::RelaxationHeuristic(const shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const string &name,
utils::Verbosity verbosity
)
RelaxationHeuristic::RelaxationHeuristic(
const shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const string &name,
utils::Verbosity verbosity)
: Heuristic(transform, cache_estimates, name, verbosity) {
// Build propositions.
propositions.resize(task_properties::get_num_facts(task_proxy));
Expand Down
9 changes: 5 additions & 4 deletions src/search/heuristics/relaxation_heuristic.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,11 @@ class RelaxationHeuristic : public Heuristic {
Proposition *get_proposition(int var, int value);
Proposition *get_proposition(const FactProxy &fact);
public:
RelaxationHeuristic(const std::shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const std::string &name,
utils::Verbosity verbosity);
RelaxationHeuristic(
const std::shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const std::string &name,
utils::Verbosity verbosity);

virtual bool dead_ends_are_reliable() const override;
};
Expand Down
2 changes: 1 addition & 1 deletion src/search/utils/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void add_log_options_to_feature(plugins::Feature &feature) {
"normal");
}

LogProxy get_log_from_verbosity(const Verbosity &verbosity) {
LogProxy get_log_for_verbosity(const Verbosity &verbosity) {
if (verbosity == Verbosity::NORMAL) {
return LogProxy(global_log);
}
Expand Down
2 changes: 1 addition & 1 deletion src/search/utils/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class LogProxy {
extern LogProxy g_log;

extern void add_log_options_to_feature(plugins::Feature &feature);
extern LogProxy get_log_from_verbosity(const Verbosity &verbosity);
extern LogProxy get_log_for_verbosity(const Verbosity &verbosity);
extern LogProxy get_log_from_options(const plugins::Options &options);
extern LogProxy get_silent_log();

Expand Down

0 comments on commit af6f95a

Please sign in to comment.