From 400303c26b3f45a36e6e8574ba676d30d4e92e38 Mon Sep 17 00:00:00 2001 From: bpodgursky Date: Mon, 29 Jun 2009 21:04:05 +0000 Subject: Mon Jun 29 21:02:05 UTC 2009 Ben Podgursky --- ChangeLog | 34 +++++++++++++++++++++++----------- PlanCommands.h | 2 +- Planner.cpp | 3 +++ SA_PlanStrategy.cpp | 9 +++------ SA_PlanStrategy.h | 6 +++--- SA_SchedStrategy.cpp | 2 ++ SA_SchedStrategy.h | 2 +- SA_WorkingPlan.cpp | 10 ++++++++++ 8 files changed, 46 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4198d970f46..d66f97a2c2f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,27 +1,39 @@ +Mon Jun 29 21:02:05 UTC 2009 Ben Podgursky + + * PlanCommands.h: + * Planner.cpp: + * SA_PlanStrategy.h: + * SA_PlanStrategy.cpp: + * SA_SchedStrategy.h: + * SA_SchedStrategy.cpp: + * SA_WorkingPlan.cpp: + + Decision points numbered wrong + Mon Jun 29 16:59:21 UTC 2009 Ben Podgursky * SA_PlanCommands.cpp: - In execute next of AddTaskCmd, was a bug in checking for tasks_.front()==20 if - tasks is null. Swapped with returning false if tasks is empty to return first. + In execute next of AddTaskCmd, was a bug in checking for tasks_.front()==20 if + tasks is null. Swapped with returning false if tasks is empty to return first. * SA_PlanHeuristics.cpp: - Bug here where tasks were being stored in a map with the EU as the key. Tasks with the - same EU were erasing previous tasks. Changed to multimap. + Bug here where tasks were being stored in a map with the EU as the key. Tasks with the + same EU were erasing previous tasks. Changed to multimap. * SA_PlanStrategy.cpp: - Undo the assoc_impl_cmd if it fails. + Undo the assoc_impl_cmd if it fails. * SA_SchedStrategy.cpp: - Bug in satisfy sched. If energy prop or time balance prop failed, it called undo_through - the adjust min times cmds it created, but if recurse plan failed, it left those not undone - causing problems in the level down. Changed to if recurse_plan fails undoing all - commands created here. + Bug in satisfy sched. If energy prop or time balance prop failed, it called undo_through + the adjust min times cmds it created, but if recurse plan failed, it left those not undone + causing problems in the level down. Changed to if recurse_plan fails undoing all + commands created here. * SA_WorkingPlan.cpp: - Bug in undo of AddTaskCmd regarding ordering links fixed. - Made sure that causal links don't have goal targets in generate threats. + Bug in undo of AddTaskCmd regarding ordering links fixed. + Made sure that causal links don't have goal targets in generate threats. Fri Jun 26 21:53:02 UTC 2009 Daniel L.C. Mack diff --git a/PlanCommands.h b/PlanCommands.h index a9f96e18e6b..3754ab5d4be 100644 --- a/PlanCommands.h +++ b/PlanCommands.h @@ -58,7 +58,7 @@ namespace SA_POP { /** * @param prev Pointer to the previous command. */ - virtual void set_prev (PlanCommand *prev) { this->prev_ = prev; }; + virtual void set_prev (PlanCommand *prev) { this->prev_ = prev;}; /// Get pointer to previous command. /** diff --git a/Planner.cpp b/Planner.cpp index e4f552a5a36..2e82ee21fd5 100644 --- a/Planner.cpp +++ b/Planner.cpp @@ -302,6 +302,9 @@ void Planner::undo_through (CommandID id) PlanCommand *temp = this->cur_cmd_; temp->undo (); this->cur_cmd_ = temp->get_prev (); + + + this->undo_through (id); }; /// Get the current command id. diff --git a/SA_PlanStrategy.cpp b/SA_PlanStrategy.cpp index 00dcebbc2eb..ffbfab467f7 100644 --- a/SA_PlanStrategy.cpp +++ b/SA_PlanStrategy.cpp @@ -235,7 +235,7 @@ bool SA_PlanStrategy::satisfy_everything(){ TaskImplList impl_list; // Choose a task implementation. - assoc_impl_cmd = + assoc_impl_cmd = static_cast (this->assoc_impl_cmd_->clone ()); if(!this->planner_->inst_exists(this->cur_task_inst_)) impl_list = this->impl_choice_->choose_impl (this->cur_task_inst_); else impl_list.push_back(this->planner_->get_impl_id(this->cur_task_inst_)); @@ -243,12 +243,11 @@ bool SA_PlanStrategy::satisfy_everything(){ assoc_impl_cmd->set_assoc (this->cur_task_inst_, impl_list); this->planner_->add_command (assoc_impl_cmd); - TaskInstID prev_task_inst = this->cur_task_inst_; - this->cur_task_inst_ = assoc_impl_cmd->get_task_inst (); while (this->planner_->try_next (assoc_impl_cmd->get_id ())) { + if(this->get_next_threat_resolution()){ return true; } @@ -256,7 +255,6 @@ bool SA_PlanStrategy::satisfy_everything(){ //this->planner_->undo_command(assoc_impl_cmd->get_id()); this->cur_decision_pt_ = SA_PlanStrategy::IMPL_DECISION; - // this->cur_task_inst_ = assoc_impl_cmd->get_task_inst (); } // assoc_impl_cmd = // static_cast (this->assoc_impl_cmd_->clone ()); @@ -273,7 +271,6 @@ bool SA_PlanStrategy::satisfy_everything(){ //Undo the AssocImplCmd planner_->undo_command(assoc_impl_cmd->get_id()); -// this->cur_task_inst_ = prev_task_inst; return false; } @@ -288,7 +285,7 @@ bool SA_PlanStrategy::satisfy_schedule(void){ if (this->planner_->recurse_sched (this->cur_task_inst_)) return true; - this->cur_decision_pt_ = SA_PlanStrategy::THREAT_DECISION; +// this->cur_decision_pt_ = SA_PlanStrategy::THREAT_DECISION; return false; } diff --git a/SA_PlanStrategy.h b/SA_PlanStrategy.h index 1ef51953a1e..1cab88cf5e7 100644 --- a/SA_PlanStrategy.h +++ b/SA_PlanStrategy.h @@ -232,13 +232,13 @@ namespace SA_POP { static const int TASK_DECISION = 1; /// Causal link threat handling is second decision point. - static const int THREAT_DECISION = 2; + static const int THREAT_DECISION = 3; /// Task implementation choice is third decision point. - static const int IMPL_DECISION = 3; + static const int IMPL_DECISION = 2; /// Scheduling is fourth decision point. - static const int SCHEDULE_DECISION = 3; + static const int SCHEDULE_DECISION = 4; diff --git a/SA_SchedStrategy.cpp b/SA_SchedStrategy.cpp index 697a783b8bb..8567ecae208 100644 --- a/SA_SchedStrategy.cpp +++ b/SA_SchedStrategy.cpp @@ -90,6 +90,7 @@ bool SA_SchedStrategy::satisfy_sched (TaskInstID task_inst) // Get the current command id to backtrack to. CommandID cur_cmd_id = this->planner_->cur_command_id(); this->cur_seq_num_=1; + // Do the energy propogation for this task instance // This function automatically does this for the task instances before and after it. @@ -147,6 +148,7 @@ bool SA_SchedStrategy::satisfy_sched (TaskInstID task_inst) return false; } + if(!this->planner_->recurse_plan ()){ this->planner_->undo_through(cur_cmd_id); return false; diff --git a/SA_SchedStrategy.h b/SA_SchedStrategy.h index 89c55a9f8fa..95b9e74fd2a 100644 --- a/SA_SchedStrategy.h +++ b/SA_SchedStrategy.h @@ -168,7 +168,7 @@ namespace SA_POP { // ************************************************************************ /// Scheduling is fourth decision point. - static const int SCHEDULE_DECISION = 3; + static const int SCHEDULE_DECISION = 4; // ************************************************************************ // Prototypes of commands that work on other objects. diff --git a/SA_WorkingPlan.cpp b/SA_WorkingPlan.cpp index bb1c6a56bf3..1a071a09536 100644 --- a/SA_WorkingPlan.cpp +++ b/SA_WorkingPlan.cpp @@ -174,6 +174,7 @@ add_threats_cmd_ (0) //this->durations.insert(std::make_pair(16,0)); //this->durations.insert(std::make_pair(17,0)); +/* this->init_start.insert(std::make_pair(1,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME))); this->init_end.insert(std::make_pair(1,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME))); this->init_start.insert(std::make_pair(2,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME))); @@ -240,6 +241,14 @@ this->init_start.insert(std::make_pair(31,(TimeWindow)std::make_pair(NULL_TIME,N this->init_end.insert(std::make_pair(31,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME))); this->init_start.insert(std::make_pair(32,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME))); this->init_end.insert(std::make_pair(32,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME))); + +*/ + +for(int i = 0; i < 100; i++){ + this->init_start.insert(std::make_pair(i,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME))); + this->init_end.insert(std::make_pair(i,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME))); +} + }; // Destructor. @@ -1044,6 +1053,7 @@ bool SA_WorkingPlan::execute (SA_AssocTaskImplCmd *cmd) } */ + return this->init_prec_insert(cmd->task_inst_,cmd); }; -- cgit v1.2.1