Skip to content

Commit

Permalink
fixing constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
guicho271828 committed Jan 14, 2025
1 parent 7c2e2fa commit 8f720b8
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 15 deletions.
26 changes: 24 additions & 2 deletions src/search/search_algorithm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,15 @@ static successor_generator::SuccessorGenerator &get_successor_generator(
}

SearchAlgorithm::SearchAlgorithm(
OperatorCost cost_type, int bound, double max_time,
OperatorCost cost_type, int bound,
double min_gen,
double min_eval,
double min_exp,
double min_time,
double max_gen,
double max_eval,
double max_exp,
double max_time,
const string &description, utils::Verbosity verbosity)
: description(description),
status(IN_PROGRESS),
Expand All @@ -55,6 +63,13 @@ SearchAlgorithm::SearchAlgorithm(
bound(bound),
cost_type(cost_type),
is_unit_cost(task_properties::is_unit_cost(task_proxy)),
min_gen(min_gen),
min_eval(min_eval),
min_exp(min_exp),
min_time(min_time),
max_gen(max_gen),
max_eval(max_eval),
max_exp(max_exp),
max_time(max_time) {
if (bound < 0) {
cerr << "error: negative cost bound " << bound << endl;
Expand Down Expand Up @@ -295,13 +310,20 @@ void add_search_algorithm_options_to_feature(
utils::add_log_options_to_feature(feature);
}

tuple<OperatorCost, int, double, string, utils::Verbosity>
tuple<OperatorCost, int, double, double, double, double, double, double, double, double, string, utils::Verbosity>
get_search_algorithm_arguments_from_options(
const plugins::Options &opts) {
return tuple_cat(
::get_cost_type_arguments_from_options(opts),
make_tuple(
opts.get<int>("bound"),
opts.get<double>("min_gen"),
opts.get<double>("min_eval"),
opts.get<double>("min_exp"),
opts.get<double>("min_time"),
opts.get<double>("max_gen"),
opts.get<double>("max_eval"),
opts.get<double>("max_exp"),
opts.get<double>("max_time"),
opts.get<string>("description")
),
Expand Down
5 changes: 3 additions & 2 deletions src/search/search_algorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ class SearchAlgorithm {
int get_adjusted_cost(const OperatorProxy &op) const;
public:
SearchAlgorithm(
OperatorCost cost_type, int bound, double max_time,
OperatorCost cost_type, int bound,
double, double, double, double, double, double, double, double,
const std::string &description, utils::Verbosity verbosity);
explicit SearchAlgorithm(const plugins::Options &opts); // TODO options object is needed for iterated search, the prototype for issue559 resolves this
virtual ~SearchAlgorithm();
Expand Down Expand Up @@ -104,7 +105,7 @@ get_search_pruning_arguments_from_options(const plugins::Options &opts);
extern void add_search_algorithm_options_to_feature(
plugins::Feature &feature, const std::string &description);
extern std::tuple<
OperatorCost, int, double, std::string, utils::Verbosity>
OperatorCost, int, double, double, double, double, double, double, double, double, std::string, utils::Verbosity>
get_search_algorithm_arguments_from_options(
const plugins::Options &opts);
extern void add_successors_order_options_to_feature(
Expand Down
26 changes: 23 additions & 3 deletions src/search/search_algorithms/eager_search.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,28 @@ EagerSearch::EagerSearch(
const vector<shared_ptr<Evaluator>> &preferred,
const shared_ptr<PruningMethod> &pruning,
const shared_ptr<Evaluator> &lazy_evaluator, OperatorCost cost_type,
int bound, double max_time, const string &description,
int bound,
double min_gen,
double min_eval,
double min_exp,
double min_time,
double max_gen,
double max_eval,
double max_exp,
double max_time,
const string &description,
utils::Verbosity verbosity)
: SearchAlgorithm(
cost_type, bound, max_time, description, verbosity),
cost_type, bound,
min_gen,
min_eval,
min_exp,
min_time,
max_gen,
max_eval,
max_exp,
max_time,
description, verbosity),
reopen_closed_nodes(reopen_closed),
open_list(open->create_state_open_list()),
f_evaluator(f_eval), // default nullptr
Expand Down Expand Up @@ -319,7 +337,9 @@ void add_eager_search_options_to_feature(
}

tuple<shared_ptr<PruningMethod>, shared_ptr<Evaluator>, OperatorCost,
int, double, string, utils::Verbosity>
int,
double, double, double, double, double, double, double, double,
string, utils::Verbosity>
get_eager_search_arguments_from_options(const plugins::Options &opts) {
return tuple_cat(
get_search_pruning_arguments_from_options(opts),
Expand Down
6 changes: 4 additions & 2 deletions src/search/search_algorithms/eager_search.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ class EagerSearch : public SearchAlgorithm {
const std::vector<std::shared_ptr<Evaluator>> &preferred,
const std::shared_ptr<PruningMethod> &pruning,
const std::shared_ptr<Evaluator> &lazy_evaluator,
OperatorCost cost_type, int bound, double max_time,
OperatorCost cost_type, int bound,
double, double, double, double, double, double, double, double,
const std::string &description, utils::Verbosity verbosity);

virtual void print_statistics() const override;
Expand All @@ -54,7 +55,8 @@ class EagerSearch : public SearchAlgorithm {
extern void add_eager_search_options_to_feature(
plugins::Feature &feature, const std::string &description);
extern std::tuple<std::shared_ptr<PruningMethod>,
std::shared_ptr<Evaluator>, OperatorCost, int, double,
std::shared_ptr<Evaluator>, OperatorCost, int,
double, double, double, double, double, double, double, double,
std::string, utils::Verbosity>
get_eager_search_arguments_from_options(const plugins::Options &opts);
}
Expand Down
21 changes: 19 additions & 2 deletions src/search/search_algorithms/enforced_hill_climbing_search.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,27 @@ static shared_ptr<OpenListFactory> create_ehc_open_list_factory(
EnforcedHillClimbingSearch::EnforcedHillClimbingSearch(
const shared_ptr<Evaluator> &h, PreferredUsage preferred_usage,
const vector<shared_ptr<Evaluator>> &preferred,
OperatorCost cost_type, int bound, double max_time,
OperatorCost cost_type, int bound,
double min_gen,
double min_eval,
double min_exp,
double min_time,
double max_gen,
double max_eval,
double max_exp,
double max_time,
const string &description, utils::Verbosity verbosity)
: SearchAlgorithm(
cost_type, bound, max_time, description, verbosity),
cost_type, bound,
min_gen,
min_eval,
min_exp,
min_time,
max_gen,
max_eval,
max_exp,
max_time,
description, verbosity),
evaluator(h),
preferred_operator_evaluators(preferred),
preferred_usage(preferred_usage),
Expand Down
10 changes: 9 additions & 1 deletion src/search/search_algorithms/enforced_hill_climbing_search.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,15 @@ class EnforcedHillClimbingSearch : public SearchAlgorithm {
const std::shared_ptr<Evaluator> &h,
PreferredUsage preferred_usage,
const std::vector<std::shared_ptr<Evaluator>> &preferred,
OperatorCost cost_type, int bound, double max_time,
OperatorCost cost_type, int bound,
double min_gen,
double min_eval,
double min_exp,
double min_time,
double max_gen,
double max_eval,
double max_exp,
double max_time,
const std::string &description, utils::Verbosity verbosity);

virtual void print_statistics() const override;
Expand Down
20 changes: 18 additions & 2 deletions src/search/search_algorithms/lazy_search.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,26 @@ LazySearch::LazySearch(
const shared_ptr<OpenListFactory> &open, bool reopen_closed,
const vector<shared_ptr<Evaluator>> &preferred,
bool randomize_successors, bool preferred_successors_first,
int random_seed, OperatorCost cost_type, int bound, double max_time,
int random_seed, OperatorCost cost_type, int bound,
double min_gen,
double min_eval,
double min_exp,
double min_time,
double max_gen,
double max_eval,
double max_exp,
double max_time,
const string &description, utils::Verbosity verbosity)
: SearchAlgorithm(
cost_type, bound, max_time, description, verbosity),
cost_type, bound,
min_gen,
min_eval,
min_exp,
min_time,
max_gen,
max_eval,
max_exp,
max_time, description, verbosity),
open_list(open->create_edge_open_list()),
reopen_closed_nodes(reopen_closed),
randomize_successors(randomize_successors),
Expand Down
10 changes: 9 additions & 1 deletion src/search/search_algorithms/lazy_search.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,15 @@ class LazySearch : public SearchAlgorithm {
const std::vector<std::shared_ptr<Evaluator>> &evaluators,
bool randomize_successors, bool preferred_successors_first,
int random_seed, OperatorCost cost_type, int bound,
double max_time, const std::string &description,
double min_gen,
double min_eval,
double min_exp,
double min_time,
double max_gen,
double max_eval,
double max_exp,
double max_time,
const std::string &description,
utils::Verbosity verbosity);

virtual void print_statistics() const override;
Expand Down

0 comments on commit 8f720b8

Please sign in to comment.