From 8b8247a86f9f8d3b3bfefe852d8808064e917c8e Mon Sep 17 00:00:00 2001 From: Simon Dold Date: Fri, 16 Feb 2024 09:55:03 +0100 Subject: [PATCH] style --- .../diverse_potential_heuristics.cc | 36 ++++++++--------- .../potentials/diverse_potential_heuristics.h | 15 ++++--- src/search/potentials/potential_heuristic.cc | 12 +++--- src/search/potentials/potential_heuristic.h | 12 +++--- .../potentials/potential_max_heuristic.cc | 10 ++--- .../potentials/potential_max_heuristic.h | 10 ++--- src/search/potentials/potential_optimizer.cc | 18 ++++----- src/search/potentials/potential_optimizer.h | 7 ++-- .../sample_based_potential_heuristics.cc | 32 +++++++-------- .../potentials/single_potential_heuristics.cc | 40 +++++++++---------- src/search/potentials/util.cc | 8 ++-- 11 files changed, 98 insertions(+), 102 deletions(-) diff --git a/src/search/potentials/diverse_potential_heuristics.cc b/src/search/potentials/diverse_potential_heuristics.cc index c292528a5f..bcf721b2f7 100644 --- a/src/search/potentials/diverse_potential_heuristics.cc +++ b/src/search/potentials/diverse_potential_heuristics.cc @@ -16,18 +16,18 @@ using namespace std; namespace potentials { DiversePotentialHeuristics::DiversePotentialHeuristics( - int num_samples, - int max_num_heuristics, - double max_potential, - lp::LPSolverType lpsolver, - const shared_ptr &transform, - int random_seed, - utils::Verbosity verbosity - ) + int num_samples, + int max_num_heuristics, + double max_potential, + lp::LPSolverType lpsolver, + const shared_ptr &transform, + int random_seed, + utils::Verbosity verbosity + ) : optimizer( - transform, - lpsolver, - max_potential), + transform, + lpsolver, + max_potential), max_num_heuristics(max_num_heuristics), num_samples(num_samples), rng(utils::get_rng(random_seed)), @@ -179,7 +179,7 @@ class DiversePotentialMaxHeuristicFeature : public plugins::TypedFeature create_component(const plugins::Options &opts, const utils::Context &) const override { return make_shared( // TODO issue1082 use make_shared_from_arg_tuples - DiversePotentialHeuristics( + DiversePotentialHeuristics( opts.get("num_samples"), opts.get("max_num_heuristics"), opts.get("max_potential"), @@ -187,12 +187,12 @@ class DiversePotentialMaxHeuristicFeature : public plugins::TypedFeature>("transform"), opts.get("random_seed"), opts.get("verbosity") - ).find_functions(), - opts.get>("transform"), - opts.get("cache_estimates"), - opts.get("description"), - opts.get("verbosity") - ); + ).find_functions(), + opts.get>("transform"), + opts.get("cache_estimates"), + opts.get("description"), + opts.get("verbosity") + ); } }; diff --git a/src/search/potentials/diverse_potential_heuristics.h b/src/search/potentials/diverse_potential_heuristics.h index eee8b9fd42..a51e0c078c 100644 --- a/src/search/potentials/diverse_potential_heuristics.h +++ b/src/search/potentials/diverse_potential_heuristics.h @@ -55,14 +55,13 @@ class DiversePotentialHeuristics { public: DiversePotentialHeuristics( - int num_samples, - int max_num_heuristics, - double max_potential, - lp::LPSolverType lpsolver, - const std::shared_ptr &transform, - int random_seed, - utils::Verbosity verbosity - ); + int num_samples, + int max_num_heuristics, + double max_potential, + lp::LPSolverType lpsolver, + const std::shared_ptr &transform, + int random_seed, + utils::Verbosity verbosity); ~DiversePotentialHeuristics() = default; // Sample states, then cover them. diff --git a/src/search/potentials/potential_heuristic.cc b/src/search/potentials/potential_heuristic.cc index 1a05aee796..659bb514f0 100644 --- a/src/search/potentials/potential_heuristic.cc +++ b/src/search/potentials/potential_heuristic.cc @@ -8,12 +8,12 @@ using namespace std; namespace potentials { PotentialHeuristic::PotentialHeuristic( - unique_ptr function, - const shared_ptr &transform, - bool cache_estimates, - const string &description, - utils::Verbosity verbosity -) + unique_ptr function, + const shared_ptr &transform, + bool cache_estimates, + const string &description, + utils::Verbosity verbosity + ) : Heuristic(transform, cache_estimates, description, verbosity), function(move(function)) { } diff --git a/src/search/potentials/potential_heuristic.h b/src/search/potentials/potential_heuristic.h index d6a6758cbb..8e2a25a30d 100644 --- a/src/search/potentials/potential_heuristic.h +++ b/src/search/potentials/potential_heuristic.h @@ -19,13 +19,11 @@ class PotentialHeuristic : public Heuristic { public: explicit PotentialHeuristic( - std::unique_ptr function, - const std::shared_ptr &transform, - bool cache_estimates, - const std::string &description, - utils::Verbosity verbosity - ); - + std::unique_ptr function, + const std::shared_ptr &transform, + bool cache_estimates, + const std::string &description, + utils::Verbosity verbosity); }; } diff --git a/src/search/potentials/potential_max_heuristic.cc b/src/search/potentials/potential_max_heuristic.cc index b5cd5b136f..af13f542d8 100644 --- a/src/search/potentials/potential_max_heuristic.cc +++ b/src/search/potentials/potential_max_heuristic.cc @@ -8,11 +8,11 @@ using namespace std; namespace potentials { PotentialMaxHeuristic::PotentialMaxHeuristic( - vector> &&functions, - const shared_ptr &transform, - bool cache_estimates, - const string &description, - utils::Verbosity verbosity) + vector> &&functions, + const shared_ptr &transform, + bool cache_estimates, + const string &description, + utils::Verbosity verbosity) : Heuristic(transform, cache_estimates, description, verbosity), functions(move(functions)) { } diff --git a/src/search/potentials/potential_max_heuristic.h b/src/search/potentials/potential_max_heuristic.h index cae6c44614..ff7e207adf 100644 --- a/src/search/potentials/potential_max_heuristic.h +++ b/src/search/potentials/potential_max_heuristic.h @@ -20,11 +20,11 @@ class PotentialMaxHeuristic : public Heuristic { public: PotentialMaxHeuristic( - std::vector> &&functions, - const std::shared_ptr &transform, - bool cache_estimates, - const std::string &description, - utils::Verbosity verbosity); + std::vector> &&functions, + const std::shared_ptr &transform, + bool cache_estimates, + const std::string &description, + utils::Verbosity verbosity); }; } diff --git a/src/search/potentials/potential_optimizer.cc b/src/search/potentials/potential_optimizer.cc index c866160e2e..94a098cf7d 100644 --- a/src/search/potentials/potential_optimizer.cc +++ b/src/search/potentials/potential_optimizer.cc @@ -20,15 +20,15 @@ static int get_undefined_value(VariableProxy var) { } PotentialOptimizer::PotentialOptimizer( - const shared_ptr &transform, - lp::LPSolverType lpsolver, - double max_potential - ) - : task(transform), - task_proxy(*task), - lp_solver(lpsolver), - max_potential(max_potential), - num_lp_vars(0) { + const shared_ptr &transform, + lp::LPSolverType lpsolver, + double max_potential + ) + : task(transform), + task_proxy(*task), + lp_solver(lpsolver), + max_potential(max_potential), + num_lp_vars(0) { task_properties::verify_no_axioms(task_proxy); task_properties::verify_no_conditional_effects(task_proxy); initialize(); diff --git a/src/search/potentials/potential_optimizer.h b/src/search/potentials/potential_optimizer.h index 49234fe6a5..580f71a1f4 100644 --- a/src/search/potentials/potential_optimizer.h +++ b/src/search/potentials/potential_optimizer.h @@ -58,10 +58,9 @@ class PotentialOptimizer { public: PotentialOptimizer( - const std::shared_ptr &transform, - lp::LPSolverType lpsolver, - double max_potential - ); + const std::shared_ptr &transform, + lp::LPSolverType lpsolver, + double max_potential); ~PotentialOptimizer() = default; std::shared_ptr get_task() const; diff --git a/src/search/potentials/sample_based_potential_heuristics.cc b/src/search/potentials/sample_based_potential_heuristics.cc index 72381b7fe7..e1e74998ac 100644 --- a/src/search/potentials/sample_based_potential_heuristics.cc +++ b/src/search/potentials/sample_based_potential_heuristics.cc @@ -41,13 +41,13 @@ static void optimize_for_samples( sets of samples. */ static vector> create_sample_based_potential_functions( - int num_samples, - int num_heuristics, - double max_potential, - lp::LPSolverType lpsolver, - const shared_ptr &transform, - int random_seed - ) { + int num_samples, + int num_heuristics, + double max_potential, + lp::LPSolverType lpsolver, + const shared_ptr &transform, + int random_seed + ) { vector> functions; PotentialOptimizer optimizer(transform, lpsolver, @@ -84,19 +84,19 @@ class SampleBasedPotentialMaxHeuristicFeature : public plugins::TypedFeature create_component(const plugins::Options &opts, const utils::Context &) const override { return make_shared( // TODO issue1082 use make_shared_from_arg_tuples - create_sample_based_potential_functions( - opts.get("num_samples"), + create_sample_based_potential_functions( + opts.get("num_samples"), opts.get("num_heuristics"), opts.get("max_potential"), opts.get("lpsolver"), opts.get>("transform"), - opts.get("random_seed") - ), - opts.get>("transform"), - opts.get("cache_estimates"), - opts.get("description"), - opts.get("verbosity") - ); + opts.get("random_seed") + ), + opts.get>("transform"), + opts.get("cache_estimates"), + opts.get("description"), + opts.get("verbosity") + ); } }; diff --git a/src/search/potentials/single_potential_heuristics.cc b/src/search/potentials/single_potential_heuristics.cc index ee7ca13aec..961ae60436 100644 --- a/src/search/potentials/single_potential_heuristics.cc +++ b/src/search/potentials/single_potential_heuristics.cc @@ -15,14 +15,14 @@ enum class OptimizeFor { }; static unique_ptr create_potential_function( - const shared_ptr &transform, - lp::LPSolverType lpsolver, - double max_potential, - OptimizeFor opt_func) { + const shared_ptr &transform, + lp::LPSolverType lpsolver, + double max_potential, + OptimizeFor opt_func) { PotentialOptimizer optimizer( - transform, - lpsolver, - max_potential); + transform, + lpsolver, + max_potential); const AbstractTask &task = *transform; TaskProxy task_proxy(task); switch (opt_func) { @@ -50,16 +50,16 @@ class InitialStatePotentialHeuristicFeature : public plugins::TypedFeature create_component(const plugins::Options &opts, const utils::Context &) const override { return make_shared( - create_potential_function( - opts.get>("transform"), - opts.get("lpsolver"), - opts.get("max_potential"), - OptimizeFor::INITIAL_STATE), + create_potential_function( opts.get>("transform"), - opts.get("cache_estimates"), - opts.get("description"), - opts.get("verbosity") - ); + opts.get("lpsolver"), + opts.get("max_potential"), + OptimizeFor::INITIAL_STATE), + opts.get>("transform"), + opts.get("cache_estimates"), + opts.get("description"), + opts.get("verbosity") + ); } }; @@ -77,10 +77,10 @@ class AllStatesPotentialHeuristicFeature : public plugins::TypedFeature create_component(const plugins::Options &opts, const utils::Context &) const override { return make_shared(create_potential_function( - opts.get>("transform"), - opts.get("lpsolver"), - opts.get("max_potential"), - OptimizeFor::ALL_STATES), + opts.get>("transform"), + opts.get("lpsolver"), + opts.get("max_potential"), + OptimizeFor::ALL_STATES), opts.get>("transform"), opts.get("cache_estimates"), opts.get("description"), diff --git a/src/search/potentials/util.cc b/src/search/potentials/util.cc index 6159d5df2f..bcafbaafd1 100644 --- a/src/search/potentials/util.cc +++ b/src/search/potentials/util.cc @@ -69,9 +69,9 @@ void add_admissible_potentials_options_to_feature(plugins::Feature &feature, con tuple, bool, string, utils::Verbosity> get_admissible_potential_arguments_from_options(const plugins::Options &opts) { return tuple_cat( - make_tuple(opts.get("max_potential")), - lp::get_lp_solver_arguments_from_options(opts), - get_heuristic_arguments_from_options(opts) - ); + make_tuple(opts.get("max_potential")), + lp::get_lp_solver_arguments_from_options(opts), + get_heuristic_arguments_from_options(opts) + ); } }