From 185b9931cdc61c8ecee17e2c12cc05fdbc67140a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mart=C3=ADnez?= <dmartinez@iri.upc.edu> Date: Sun, 27 Mar 2016 21:05:21 +0200 Subject: [PATCH] Set planner methods to non-const as planner is now modified to get next action. --- src/ippc_wrapper/ippc_planner.cpp | 6 +++--- src/ippc_wrapper/ippc_planner.h | 12 ++++++------ src/rexd/planner.cpp | 4 ++-- src/rexd/planner.h | 8 ++++---- src/rexd/prada_planner.cpp | 4 ++-- src/rexd/prada_planner.h | 4 ++-- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/ippc_wrapper/ippc_planner.cpp b/src/ippc_wrapper/ippc_planner.cpp index 8897a3c2..67c64a46 100755 --- a/src/ippc_wrapper/ippc_planner.cpp +++ b/src/ippc_wrapper/ippc_planner.cpp @@ -40,7 +40,7 @@ int IppcPlanner::estimate_distance_to_finish(const RexdScenario &rexd_scenario) } -bool IppcPlanner::plan_n_actions(const RexdScenario& rexd_scenario, std::vector<TypedAtom>& plan_result, const bool thoroughly, const int verbose, const uint n_actions, const bool force_effect) const +bool IppcPlanner::plan_n_actions(const RexdScenario& rexd_scenario, std::vector<TypedAtom>& plan_result, const bool thoroughly, const int verbose, const uint n_actions, const bool force_effect) { RexdScenario updated_scenario(rexd_scenario); TypedAtomOpt current_action_opt; @@ -108,7 +108,7 @@ bool IppcPlanner::plan_n_actions(const RexdScenario& rexd_scenario, std::vector< } -TypedAtomOpt IppcPlanner::plan(const RexdScenario& rexd_scenario, const bool rules_changed, const bool thoroughly, const int verbose, float& planning_result) const +TypedAtomOpt IppcPlanner::plan(const RexdScenario& rexd_scenario, const bool rules_changed, const bool thoroughly, const int verbose, float& planning_result) { TypedAtomOpt resulting_plan; @@ -133,7 +133,7 @@ TypedAtomOpt IppcPlanner::plan(const RexdScenario& rexd_scenario, const bool rul } -TypedAtomOpt IppcPlanner::ippcPlan(const RexdScenario& rexd_scenario, const bool rules_changed, const bool thoroughly, const int verbose, float& planning_result) const +TypedAtomOpt IppcPlanner::ippcPlan(const RexdScenario& rexd_scenario, const bool rules_changed, const bool thoroughly, const int verbose, float& planning_result) { if (rexd_scenario.get_planning_horizon() == 0) { planning_result = 0; diff --git a/src/ippc_wrapper/ippc_planner.h b/src/ippc_wrapper/ippc_planner.h index 81780484..7ff05cce 100755 --- a/src/ippc_wrapper/ippc_planner.h +++ b/src/ippc_wrapper/ippc_planner.h @@ -51,12 +51,12 @@ public: ~IppcPlanner(); using Planner::plan; // Once you overload a function from Base class in Derived class all functions with the same name in the Base class get hidden in Derived class. - virtual TypedAtomOpt plan(const RexdScenario& rexd_scenario, const bool rules_changed, const bool thoroughly, const int verbose, float& planning_result) const; + virtual TypedAtomOpt plan(const RexdScenario& rexd_scenario, const bool rules_changed, const bool thoroughly, const int verbose, float& planning_result); virtual bool plan_n_actions(const RexdScenario& rexd_scenario, std::vector<TypedAtom>& plan, const bool thoroughly = true, const int verbose = 0, const uint n_actions = std::numeric_limits<uint>::max(), - const bool force_effect = false) const; + const bool force_effect = false); virtual int estimate_distance_to_finish(const RexdScenario &rexd_scenario); @@ -66,11 +66,11 @@ protected: private: bool noop_actions_allowed; - mutable bool planner_running = false; - mutable boost::shared_ptr<RexdScenario> running_scenario_ptr; - mutable boost::shared_ptr<XMLServer_t> ippcserver_ptr; + bool planner_running = false; + boost::shared_ptr<RexdScenario> running_scenario_ptr; + boost::shared_ptr<XMLServer_t> ippcserver_ptr; - TypedAtomOpt ippcPlan(const RexdScenario& rexd_scenario, const bool rules_changed, const bool thoroughly, const int verbose, float& planning_result) const; + TypedAtomOpt ippcPlan(const RexdScenario& rexd_scenario, const bool rules_changed, const bool thoroughly, const int verbose, float& planning_result); virtual void execute_planner_command(const bool rules_changed, const bool thoroughly, const int verbose) const =0; virtual void write_problem_files(const RexdScenario& rexd_scenario) const =0; diff --git a/src/rexd/planner.cpp b/src/rexd/planner.cpp index 6f15c579..99e596bd 100755 --- a/src/rexd/planner.cpp +++ b/src/rexd/planner.cpp @@ -5,7 +5,7 @@ Planner::Planner(): dev_null_ofs(new std::ofstream("/dev/null")) { } -TypedAtomOpt Planner::plan(RexdScenario rexd_scenario, const bool thoroughly, const int verbose) const +TypedAtomOpt Planner::plan(RexdScenario rexd_scenario, const bool thoroughly, const int verbose) { float planning_result; return plan(rexd_scenario, true, thoroughly, verbose, planning_result); @@ -23,7 +23,7 @@ void Planner::stream_restore(std::ostream& ostream, std::streambuf* ostream_sbuf ostream.rdbuf(ostream_sbuf); // restore the original stream buffer } -float Planner::get_expected_action_success_probability(const RexdScenario& rexd_scenario, const TypedAtom& action, const bool check_only_dangerous_effects) const +float Planner::get_expected_action_success_probability(const RexdScenario& rexd_scenario, const TypedAtom& action, const bool check_only_dangerous_effects) { float dead_end_probability = 0.0; diff --git a/src/rexd/planner.h b/src/rexd/planner.h index b66e323b..87fe9525 100755 --- a/src/rexd/planner.h +++ b/src/rexd/planner.h @@ -60,7 +60,7 @@ public: \return planned action, false if no plan was found */ TypedAtomOpt plan(RexdScenario rexd_scenario, - const bool thoroughly = true, const int verbose = 0) const; + const bool thoroughly = true, const int verbose = 0); /*! \brief plans an action in the scenario @@ -75,7 +75,7 @@ public: */ virtual TypedAtomOpt plan(const RexdScenario& rexd_scenario, const bool rules_changed, const bool thoroughly, const int verbose, - float& planning_result) const =0; + float& planning_result) =0; /*! \brief plans a sequence of actions @@ -96,7 +96,7 @@ public: std::vector<TypedAtom>& plan, const bool thoroughly = true, const int verbose = 0, const uint n_actions = std::numeric_limits<uint>::max(), - const bool force_effect = false) const =0; + const bool force_effect = false) =0; /*! \brief Gets the probability that a plan that reaches the goal exists if the action is applied @@ -108,7 +108,7 @@ public: \param check_only_dangerous_effects true if only dangerous effects should be checked to speed up \return probability of reaching a goal */ - float get_expected_action_success_probability(const RexdScenario& rexd_scenario, const TypedAtom& action, const bool check_only_dangerous_effects) const; + float get_expected_action_success_probability(const RexdScenario& rexd_scenario, const TypedAtom& action, const bool check_only_dangerous_effects); protected: /*! diff --git a/src/rexd/prada_planner.cpp b/src/rexd/prada_planner.cpp index ea0e6585..8ae956aa 100755 --- a/src/rexd/prada_planner.cpp +++ b/src/rexd/prada_planner.cpp @@ -58,7 +58,7 @@ int PradaPlanner::estimate_distance_to_finish(const RexdScenario &rexd_scenario) /** * Actual method to prepare planning */ -TypedAtomOpt PradaPlanner::plan(const RexdScenario& rexd_scenario, const bool rules_changed, const bool thoroughly, const int verbose, float& planning_result) const +TypedAtomOpt PradaPlanner::plan(const RexdScenario& rexd_scenario, const bool rules_changed, const bool thoroughly, const int verbose, float& planning_result) { rexd_scenario.get_state().write_to_file(prada_state_filename); Typed::RuleSet simplified_rules(rexd_scenario.get_rules()); @@ -94,7 +94,7 @@ TypedAtomOpt PradaPlanner::plan(const RexdScenario& rexd_scenario, const bool ru } -bool PradaPlanner::plan_n_actions(const RexdScenario& rexd_scenario, std::vector<TypedAtom>& resulting_plan, const bool thoroughly, const int verbose, const uint n_actions, const bool force_effect) const +bool PradaPlanner::plan_n_actions(const RexdScenario& rexd_scenario, std::vector<TypedAtom>& resulting_plan, const bool thoroughly, const int verbose, const uint n_actions, const bool force_effect) { rexd_scenario.get_state().write_to_file(prada_state_filename); Typed::RuleSet simplified_rules(rexd_scenario.get_rules()); diff --git a/src/rexd/prada_planner.h b/src/rexd/prada_planner.h index 7a5d2003..029065b1 100755 --- a/src/rexd/prada_planner.h +++ b/src/rexd/prada_planner.h @@ -50,13 +50,13 @@ public: virtual TypedAtomOpt plan(const RexdScenario& rexd_scenario, const bool rules_changed, const bool thoroughly, const int verbose, - float& planning_result) const; + float& planning_result); virtual bool plan_n_actions(const RexdScenario& rexd_scenario, std::vector<TypedAtom>& plan, const bool thoroughly = true, const int verbose = 0, const uint n_actions = std::numeric_limits<uint>::max(), - const bool force_effect = false) const; + const bool force_effect = false); virtual int estimate_distance_to_finish(const RexdScenario &rexd_scenario); -- GitLab