From 557ea46dc33edd880bd523d3aa920389d179aa9b Mon Sep 17 00:00:00 2001 From: dmack Date: Wed, 1 Jul 2009 22:14:23 +0000 Subject: Wed Jul 1 22:13:25 UTC 2009 Daniel L.C. Mack --- ChangeLog | 11 +++++++++-- SA_PlanStrategy.cpp | 6 ++++++ SA_WorkingPlan.cpp | 27 +++++++++++++++++++-------- 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index b4932e9a125..0be39f7c072 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,16 @@ +Wed Jul 1 22:13:25 UTC 2009 Daniel L.C. Mack + + * SA_PlanStrategy.cpp: + * SA_WorkingPlan.cpp: + Updated to allow for goal_task_inst to be part of threats. + Small aesthetic changes + Tue Jun 30 20:10:07 UTC 2009 Daniel L.C. Mack * SA_PlanStrategy.cpp: * SA_SchedStrategy.cpp: - Modified undo for removing open conds to match the breadth first search. - Indented some of ankits code for readability. + Modified undo for removing open conds to match the breadth first search. + Indented some of ankits code for readability. Mon Jun 29 21:52:33 UTC 2009 Ben Podgursky diff --git a/SA_PlanStrategy.cpp b/SA_PlanStrategy.cpp index 899b9ba47d6..ea55dcdacc8 100644 --- a/SA_PlanStrategy.cpp +++ b/SA_PlanStrategy.cpp @@ -245,6 +245,12 @@ bool SA_PlanStrategy::satisfy_everything(){ this->cur_task_inst_ = assoc_impl_cmd->get_task_inst (); + //TEMP*** + //if(this->cur_task_inst_ == 10) + //{ + // throw "At the 10th task instance"; + //} + while (this->planner_->try_next (assoc_impl_cmd->get_id ())) { diff --git a/SA_WorkingPlan.cpp b/SA_WorkingPlan.cpp index 045655b30ef..5bb69a959aa 100644 --- a/SA_WorkingPlan.cpp +++ b/SA_WorkingPlan.cpp @@ -652,12 +652,13 @@ void SA_WorkingPlan::generate_all_threats(void) debug_text << "SA_WorkingPlan::generate_all_threats: All Causal Threats: " << std::endl; - + //Iterate through task instances for(InstToTaskMap::iterator iterator = this->task_insts_.begin(); iterator != this->task_insts_.end(); iterator++){ TaskInstID threat_possibility = iterator->first; TaskID threat_possibility_taskid = iterator->second; CondSet set = this->planner_->get_effects(threat_possibility_taskid); - + + //Iterate through the effects of each task instance for(CondSet::iterator arr = set.begin(); arr != set.end(); arr++){ Condition condition = (*arr); @@ -667,7 +668,7 @@ void SA_WorkingPlan::generate_all_threats(void) CondToCLinksMap::iterator > ret = this->causal_links_.equal_range(condition); - + //Iterates through causal links for(CondToCLinksMap::iterator nit = ret.first; nit != ret.second; nit++){ CausalLink causal_threatened = (*nit).second; @@ -679,18 +680,28 @@ void SA_WorkingPlan::generate_all_threats(void) if((threat_effect > 0 && causal_effect < 0 )|| (threat_effect < 0 && causal_effect > 0)){ - if(causal_threatened.first != threat_possibility && causal_threatened.second != threat_possibility - && causal_threatened.second != -1) + if(causal_threatened.first != threat_possibility && causal_threatened.second != threat_possibility) { - TaskID threatened_task1 = this->task_insts_.find(causal_threatened.first)->second; - TaskID threatened_task2 = this->task_insts_.find(causal_threatened.second)->second; + CLThreat new_threat; new_threat.clink = causal_threatened; new_threat.threat = threat_possibility; threat_set.insert(new_threat); - debug_text <<" Causal link from Task ("<< threatened_task1 <<") Inst ("<< causal_threatened.first <<") to Task ("<< threatened_task2 <<") Inst ("<< causal_threatened.second <<") using condition "<task_insts_.find(causal_threatened.first)->second; + if(causal_threatened.second != SA_POP::GOAL_TASK_INST_ID) + { + TaskID threatened_task2 = this->task_insts_.find(causal_threatened.second)->second; + debug_text <<" Causal link from Task ("<< threatened_task1 <<") Inst ("<< causal_threatened.first <<") to Task ("<< threatened_task2 <<") Inst ("<< causal_threatened.second <<") using condition "<