summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbpodgursky <bpodgursky@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-01-15 06:57:33 +0000
committerbpodgursky <bpodgursky@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-01-15 06:57:33 +0000
commitdc92c6c5d6c2eb97c73bb8de0c0958cf0a587bfc (patch)
treed979d249ba927afc8a4bc654a87d4b46b46237f9
parent0a33250a5d8d60f66a44f079adbe81df90eaf8b9 (diff)
downloadATCD-dc92c6c5d6c2eb97c73bb8de0c0958cf0a587bfc.tar.gz
Fri Jan 15 06:40:02 UTC 2010 Ben Podgursky <bpodgursky@gmail.com>
-rw-r--r--SA_POP/ChangeLog13
-rw-r--r--SA_POP/SA_POP_Types.h13
-rw-r--r--SA_POP/SA_PlanHeuristics.cpp18
-rw-r--r--SA_POP/SA_PlanStrategy.cpp2
-rw-r--r--SA_POP/SA_PlanStrategy.h6
-rwxr-xr-xSA_POP/utils/SANetGenerator/Net_Complete.py38
6 files changed, 52 insertions, 38 deletions
diff --git a/SA_POP/ChangeLog b/SA_POP/ChangeLog
index 8028821c607..616ce86f485 100644
--- a/SA_POP/ChangeLog
+++ b/SA_POP/ChangeLog
@@ -1,3 +1,16 @@
+Fri Jan 15 06:40:02 UTC 2010 Ben Podgursky <bpodgursky@gmail.com>
+
+ * SA_POP_Types.h:
+ * SA_PlanHeuristics.cpp:
+ * SA_PlanStrategy.h:
+ * SA_PlanStrategy.cpp:
+
+ * utils/SANetGenerator/Net_Complete.py:
+
+ --Script generates task map
+ --No task limiter
+ --Uses choose task once strategy
+
Thu Jan 14 23:23:05 UTC 2010 John S. Kinnebrew <john.s.kinnebrew@vanderbilt.edu>
* LogGraphOut.cpp:
diff --git a/SA_POP/SA_POP_Types.h b/SA_POP/SA_POP_Types.h
index bc82b7839db..cf834909e5a 100644
--- a/SA_POP/SA_POP_Types.h
+++ b/SA_POP/SA_POP_Types.h
@@ -203,6 +203,9 @@ namespace SA_POP {
+
+ //A struct used in a task choice strategy specifying whether a selected task
+ //is new or reused
enum TaskChoiceType{REUSE_INST, NEW_INST};
struct TaskChoice {
@@ -218,9 +221,7 @@ namespace SA_POP {
/// Map from Task Instance IDs to Task IDs.
typedef std::map <TaskInstID, TaskID> InstToTaskMap;
-
-//*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****
- // WHAT DOES THIS STRUCT DO / HOW IS IT USED?
+ //Allows the sorting of tasks by the age of their most recent instance
// NOT A GENERIC SIMPLE TYPE IN SA-POP SO SHOULD BE MOVED TO FILES OF WHATEVER SPECIFIC CLASSES USE IT.
struct SortTaskByTime{
@@ -234,6 +235,9 @@ namespace SA_POP {
}
// IS THE LESS THAN OPERATOR REALLY SUPPOSED TO COMPARE INSTANCES BY GREATER THAN?
+ //Well it made sense at the time, since the instance # is a way of checking
+ //their relative ages. Smaller instance numbers mean older task instances, which is the reverse
+ //of how I was looking to order the list.
bool operator<(const SortTaskByTime & s) const {
return this->last_instance > s.last_instance;
}
@@ -244,9 +248,6 @@ namespace SA_POP {
return this->last_instance == s.last_instance;
}
};
-//*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****
-
-
/// Type of an implementation parameter.
struct ImplParam {
diff --git a/SA_POP/SA_PlanHeuristics.cpp b/SA_POP/SA_PlanHeuristics.cpp
index d34b2ac32af..db2e8119f97 100644
--- a/SA_POP/SA_PlanHeuristics.cpp
+++ b/SA_POP/SA_PlanHeuristics.cpp
@@ -146,19 +146,13 @@ SA_TaskStrategy::~SA_TaskStrategy (void)
};
-
+//A task choice which tries a new task, if the highest EU task instance has already been tried
+//(instead of creating a new instance of the highest EU task)
TaskChoiceList SA_TaskStrategy::choose_task_fair (Condition open_cond)
{
TaskSet tasks;
- // if(this->planner_->get_working_plan()->get_all_insts().size() > 8){
-
-// TaskChoiceList s;
- // s.clear();
-// return s;
- // }
-
tasks = this->planner_->get_satisfying_tasks (open_cond);
@@ -233,18 +227,14 @@ TaskChoiceList SA_TaskStrategy::choose_task_fair (Condition open_cond)
to_sort.note_instance(it->second);
}
- // if(!(iter->second == INIT_TASK_ID && this->planner_->init_added)){
- tasks_with_existing_instances.push_back(to_sort);
- // }
-
+ tasks_with_existing_instances.push_back(to_sort);
+
}
}
std::sort(tasks_with_existing_instances.begin(), tasks_with_existing_instances.end());
for(std::vector<SortTaskByTime>::iterator it = tasks_with_existing_instances.begin(); it != tasks_with_existing_instances.end(); it++){
-
-
TaskChoice task_choice;
task_choice.choice = NEW_INST;
diff --git a/SA_POP/SA_PlanStrategy.cpp b/SA_POP/SA_PlanStrategy.cpp
index 10c1b76fe5d..1d0c1baf884 100644
--- a/SA_POP/SA_PlanStrategy.cpp
+++ b/SA_POP/SA_PlanStrategy.cpp
@@ -579,7 +579,7 @@ AddTaskCmd *SA_PlanStrategy::satisfy_cond (Condition open_cond)
// Get add task command.
AddTaskCmd *add_task_cmd =
static_cast<AddTaskCmd *> (this->add_task_cmd_->clone ());
- TaskChoiceList task_list = this->task_choice_->choose_task_fair (open_cond);
+ TaskChoiceList task_list = this->task_choice_->choose_task_once (open_cond);
add_task_cmd->set_id (this->get_next_cmd_id ());
add_task_cmd->set_tasks (task_list);
diff --git a/SA_POP/SA_PlanStrategy.h b/SA_POP/SA_PlanStrategy.h
index b3933ffe964..7f294319c33 100644
--- a/SA_POP/SA_PlanStrategy.h
+++ b/SA_POP/SA_PlanStrategy.h
@@ -295,12 +295,6 @@ namespace SA_POP {
// Internal helper methods.
// ************************************************************************
- /// Recursively satisfy all open causal link threats and continue planning.
- /**
- * @return True if planning succeeded, false otherwise.
- */
-// virtual bool satisfy_open_threats (void);
-
/// Satisfy an open condition with an appropriate task.
/**
* @param open_cond Open condition to be satisfied.
diff --git a/SA_POP/utils/SANetGenerator/Net_Complete.py b/SA_POP/utils/SANetGenerator/Net_Complete.py
index 7986eabe903..09bc5362d6a 100755
--- a/SA_POP/utils/SANetGenerator/Net_Complete.py
+++ b/SA_POP/utils/SANetGenerator/Net_Complete.py
@@ -18,8 +18,10 @@ outname = sys.argv[6]
output = outname + ".dot"
outSAN = outname + ".xml"
+outTM = outname + ".tm" + ".xml"
ofile = open(output, 'w')
+tfile = open(outTM, 'w')
ofile.write("strict digraph testGraph {\n")
SANet = nx.DiGraph()
@@ -77,24 +79,38 @@ for each in tasks:
cnode = 2001
for each in conds:
ctonum[each] = cnode
- nfile.write("\n\t<condNode>\n\t\t<nodeID>" + str(cnode) + "</nodeID>\n\t\t<name>" + each + "</name>\n\t\t<probTrue>" + str(0) + "</priorProb>\n\t\t<utility>0</utility>\n\t\t<kind />\n\t\t<attenFactor />\n\t</condNode>\n" )
+ nfile.write("\n\t<condNode>\n\t\t<nodeID>" + str(cnode) + "</nodeID>\n\t\t<name>" + each + "</name>\n\t\t<probTrue>" + str(0) + "</probTrue>\n\t\t<utility>0</utility>\n\t\t<kind />\n\t\t<attenFactor />\n\t</condNode>\n" )
cnode += 1
for each in conds:
- plinks = ParamInfo[2][each]
- for link in plinks:
- nfile.write("\n\t<precondLink>\n\t\t<condID>" + str(ctonum[each]) + "</condID>\n\t\t<taskID>" + str(ttonum[link[0]]) + "</taskID>\n\t\t<portID>Port</portID>\n\t\t<trueProb>" + str(link[1]) + "</trueProb>\n\t\t<falseProb>0</falseProb>\n\t\t</precondLink>\n")
+ if each in ParamInfo[2]:
+ plinks = ParamInfo[2][each]
+ for link in plinks:
+ nfile.write("\n\t<precondLink>\n\t\t<condID>" + str(ctonum[each]) + "</condID>\n\t\t<taskID>" + str(ttonum[link[0]]) + "</taskID>\n\t\t<portID>Port</portID>\n\t\t<trueProb>" + str(link[1]) + "</trueProb>\n\t\t<falseProb>0</falseProb>\n\t\t</precondLink>\n")
for each in tasks:
- elinks = ParamInfo[3][each]
- for link in elinks:
- nfile.write("\n\t<effectLink>\n\t\t<taskID>" + str(ttonum[each]) + "</taskID>\n\t\t<condID>" + str(ctonum[link[0]]) + "</condID>\n\t\t<portID>Port</portID>\n\t\t<weight>" + str(link[1]) + "</weight>\n\t</effectLink>\n")
+ if each in ParamInfo[3]:
+ elinks = ParamInfo[3][each]
+ for link in elinks:
+ nfile.write("\n\t<effectLink>\n\t\t<taskID>" + str(ttonum[each]) + "</taskID>\n\t\t<condID>" + str(ctonum[link[0]]) + "</condID>\n\t\t<portID>Port</portID>\n\t\t<weight>" + str(link[1]) + "</weight>\n\t</effectLink>\n")
nfile.write("</SANet:network>")
nfile.close()
-
-
+tfile.write("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<SA-POP:taskMap\n\txmlns:SA-POP=\"http://www.vanderbilt.edu/SA-POP\"\n")
+tfile.write("\txmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n\txsi:schemaLocation=\"http://www.vanderbilt.edu/SA-POP Task_Map.xsd\"\n\txmlns=\"http://www.vanderbilt.edu/SA-POP\">")
+tfile.write("\n\n\t")
+
+for each in tasks:
+ tfile.write("\n\t<taskImpl>\n\t\t<implID>" + each + "_1" + "</implID>\n\t\t<param>\n\t\t\t<paramID></paramID>\n\t\t\t<kind></kind>\n\t\t\t<value></value>\n\t\t</param>\n\t</taskImpl>\n" )
-
- \ No newline at end of file
+tfile.write("\n\t<resource>\n\t\t<resourceID>Dack</resourceID>\n\t\t<kind>DISCRETE</kind>\n\t\t<capacity>1</capacity>\n\t</resource>\n")
+
+for each in tasks:
+ tfile.write("\n\t<taskToImpl>\n\t\t<taskID>" + str(ttonum[each]) + "</taskID>\n\t\t<implID>" + each + "_1" + "</implID>\n\t\t<duration>1</duration>\n\t</taskToImpl>\n")
+
+for each in tasks:
+ tfile.write("\n\t<implToResource>\n\t\t<implID>" + each + "_1</implID>\n\t\t<resourceID>Dack</resourceID>\n\t\t<utilization>1</utilization>\n\t</implToResource>")
+
+tfile.write("</SA-POP:taskMap>")
+tfile.close() \ No newline at end of file