diff options
author | bpodgursky <bpodgursky@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-10-02 23:32:18 +0000 |
---|---|---|
committer | bpodgursky <bpodgursky@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-10-02 23:32:18 +0000 |
commit | 100a133a74e1a82c8db3958ea2d66bb0c765a2bc (patch) | |
tree | a33fb641e220a280719e7e020a959163cb4b7bb6 | |
parent | a65ff7adf82fe9bef4f74abf9b43dda4d60ce7d8 (diff) | |
download | ATCD-100a133a74e1a82c8db3958ea2d66bb0c765a2bc.tar.gz |
Fri Oct 2 23:31:27 UTC 2009 Ben Podgursky <bpodgursky@gmail.com>
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | SANet/SANet.cpp | 9 | ||||
-rw-r--r-- | SANet/SANetFileIn.cpp | 5 | ||||
-rw-r--r-- | SA_POP_Types.h | 2 | ||||
-rw-r--r-- | SA_PlanHeuristics.cpp | 5 | ||||
-rw-r--r-- | SA_WorkingPlan.cpp | 8 | ||||
-rw-r--r-- | TaskMapFileIn.cpp | 2 |
7 files changed, 31 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog index aa7a4092e2f..fc4b0628af1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,22 @@ +Fri Oct 2 23:31:27 UTC 2009 Ben Podgursky <bpodgursky@gmail.com> + + * SANet/SANet.cpp: + * SANet/SANetFileIn.cpp: + + * SA_POP_Types.h: + * SA_PlanHeuristics.cpp: + * SA_WorkingPlan.cpp: + * TaskMapFileIn.cpp: + + Init task renumbered + Thu Oct 1 21:33:24 UTC 2009 unknown <unknown@vanderbilt.edu> * SA_POP_Types.h: * SA_PlanStrategy.cpp: - * SA_SchedStrategy.cpp: + * SA_SchedStrategy.cpp: - Various cleanup + Various cleanup Thu Oct 1 20:10:38 UTC 2009 Daniel L.C. Mack <daniel.l.mack@vanderbilt.edu> diff --git a/SANet/SANet.cpp b/SANet/SANet.cpp index 61489ddc01b..981ff8e4d49 100644 --- a/SANet/SANet.cpp +++ b/SANet/SANet.cpp @@ -14,6 +14,7 @@ #include <map> #include <iostream> #include "SANet_Types.h" +#include "SA_POP_Types.h" #include "SANet.h" #include "SANode.h" #include "SANet_Exceptions.h" @@ -406,15 +407,15 @@ void SANet::Network::update (int max_steps) } } + //Until the initial task is not a task, we need to ensure that it always has a higher + //utility than anything else so it is considered first as a way to satisfy a task. double max_util = 0; for(TaskNodeMap::iterator it = task_nodes_.begin(); it != task_nodes_.end(); it++){ if(it->second->get_pos_util().utility > max_util){ max_util = it->second->get_pos_util().utility; - } - + } } - - task_nodes_.find(20)->second->set_pos_util(max_util*2); + task_nodes_.find(SA_POP::INIT_TASK_ID)->second->set_pos_util(max_util*2); }; diff --git a/SANet/SANetFileIn.cpp b/SANet/SANetFileIn.cpp index 5025f4091ed..a8c3c6da4a3 100644 --- a/SANet/SANetFileIn.cpp +++ b/SANet/SANetFileIn.cpp @@ -14,6 +14,7 @@ #include "SANet_Types.h" #include "SANetFileIn.h" +#include "SA_POP_Types.h" #if !defined (SANET_STANDALONE) #include "Builder.h" @@ -185,7 +186,7 @@ void SANetFileIn::build_net (std::string filename, SA_POP::Builder *builder) builder->add_task (nodeID, priorProb, name); } - builder->add_task(20, .5, "initact"); + builder->add_task(SA_POP::INIT_TASK_ID, .5, "initact"); // Get condition nodes. for (SANet::XML::Network::condNode_iterator iter = xml_net.begin_condNode (); @@ -207,7 +208,7 @@ void SANetFileIn::build_net (std::string filename, SA_POP::Builder *builder) else cond=::SA_POP::DATA; builder->add_cond (nodeID, utility, probTrue, name, cond); - builder->set_effect(20, nodeID, "", (probTrue-.5)*2); + builder->set_effect(SA_POP::INIT_TASK_ID, nodeID, "", (probTrue-.5)*2); } // Get precondition->task links. diff --git a/SA_POP_Types.h b/SA_POP_Types.h index 9efffe81c9c..c74cd776466 100644 --- a/SA_POP_Types.h +++ b/SA_POP_Types.h @@ -150,6 +150,8 @@ namespace SA_POP { /// Null task instance ID (for unknown/uninitialized task instances). const TaskInstID NULL_TASK_INST_ID = -2; + const TaskID INIT_TASK_ID = -5; + /// Type of a task implementation id. /// (must be unique across all task implementations). typedef std::string TaskImplID; diff --git a/SA_PlanHeuristics.cpp b/SA_PlanHeuristics.cpp index afd4561d09f..11599e60b79 100644 --- a/SA_PlanHeuristics.cpp +++ b/SA_PlanHeuristics.cpp @@ -223,7 +223,7 @@ TaskChoiceList SA_TaskStrategy::choose_task_fair (Condition open_cond) to_sort.note_instance(it->second); } - if(!(iter->second == 20 && this->planner_->init_added)){ + if(!(iter->second == INIT_TASK_ID && this->planner_->init_added)){ tasks_with_existing_instances.push_back(to_sort); } @@ -258,7 +258,7 @@ TaskChoiceList SA_TaskStrategy::choose_task (Condition open_cond) TaskSet tasks = this->planner_->get_satisfying_tasks (open_cond); if(this->planner_->init_added){ - tasks.erase(20); + tasks.erase(INIT_TASK_ID); } // Add tasks to map with EU (to sort). @@ -278,7 +278,6 @@ TaskChoiceList SA_TaskStrategy::choose_task (Condition open_cond) for(InstToTaskMap::iterator it = inst_task_map.begin(); it != inst_task_map.end(); it++){ - tasks_to_insts.insert(std::pair<TaskID, TaskInstID>(it->second, it->first)); } diff --git a/SA_WorkingPlan.cpp b/SA_WorkingPlan.cpp index 07e3cdcd7bc..8364de87682 100644 --- a/SA_WorkingPlan.cpp +++ b/SA_WorkingPlan.cpp @@ -600,12 +600,12 @@ void SA_WorkingPlan::execute (SA_AddTaskCmd *cmd) } else if(task_choice.choice == NEW_INST){ - if(task == 20 && this->planner_->init_added) + if(task == INIT_TASK_ID && this->planner_->init_added) { throw "Reached SA_WorkingPlan::execute (SA_AddTaskCmd *cmd) for Special Initial Action after it was already existing instance tried"; } - if(task == 20){ + if(task == INIT_TASK_ID){ this->planner_->init_added = true; } @@ -769,7 +769,7 @@ void SA_WorkingPlan::undo (SA_AddTaskCmd *cmd) if(cmd->last_task_choice_.choice == NEW_INST){ - if(cmd->last_task_ == 20){ + if(cmd->last_task_ == INIT_TASK_ID){ planner_->init_added = false; } @@ -957,7 +957,7 @@ bool SA_WorkingPlan::execute (SA_ResolveCLThreatCmd * cmd) Condition condition = cmd->condition; - if(task_insts_.find(cmd->second)->second == 20){ + if(task_insts_.find(cmd->second)->second == INIT_TASK_ID){ debug_text << "SA_WorkingPlan::execute (SA_ResolveCLThreatCmd * cmd): Cannot schedule before initial task"<<std::endl; SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, debug_text.str ()); diff --git a/TaskMapFileIn.cpp b/TaskMapFileIn.cpp index 37c89381d69..583a95c4551 100644 --- a/TaskMapFileIn.cpp +++ b/TaskMapFileIn.cpp @@ -164,7 +164,7 @@ void TaskMapFileIn::build_task_map (std::string filename, Builder *builder) builder->assoc_task_with_impl (taskID, implID, duration); } - builder->assoc_task_with_impl (20, "initact_impl", 1); + builder->assoc_task_with_impl (INIT_TASK_ID, "initact_impl", 1); // Get task implementation to resource associations. for (SA_POP::XML::TaskMap::implToResource_iterator iassocr_iter = |