summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordmack <dmack@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-10-01 20:14:53 +0000
committerdmack <dmack@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-10-01 20:14:53 +0000
commitf67fd045446205f489273f4977799e399b41b07a (patch)
treea75d071f5830222c39757d917a3ba8c437248052
parent56289ef0c32e282d66e81340ba4f76deb7d83ec6 (diff)
downloadATCD-f67fd045446205f489273f4977799e399b41b07a.tar.gz
Thu Oct 1 20:10:38 UTC 2009 Daniel L.C. Mack <daniel.l.mack@vanderbilt.edu>
-rw-r--r--C2W/C2W_Demo.cpp4
-rw-r--r--ChangeLog20
-rw-r--r--LogGraphOut.cpp292
-rw-r--r--LogGraphOut.h18
-rw-r--r--SANet/SANet.cpp37
-rw-r--r--SANet/SANet.h4
-rw-r--r--SA_PlanStrategy.cpp6
7 files changed, 183 insertions, 198 deletions
diff --git a/C2W/C2W_Demo.cpp b/C2W/C2W_Demo.cpp
index 2ad8c0355e8..cf53993bb9a 100644
--- a/C2W/C2W_Demo.cpp
+++ b/C2W/C2W_Demo.cpp
@@ -211,7 +211,7 @@ int main (int argc, char* argv[])
SA_POP::Planner *planner = 0;
- SA_POP::LogGraphOut graph_out (std::cout, 1);
+ SA_POP::LogGraphOut graph_out (std::cout, false);
@@ -258,7 +258,7 @@ int main (int argc, char* argv[])
planner->add_out_adapter (&graph_out);
//SA_POP::SchemaOut s_out (std::cout, *kconds);
//planner->add_out_adapter (&s_out);
- planner->add_out_adapter (&screen_out);
+ //planner->add_out_adapter (&screen_out);
planner->plan (15, goal);
diff --git a/ChangeLog b/ChangeLog
index 3ee453d8d7b..85bf55f1213 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+Thu Oct 1 20:10:38 UTC 2009 Daniel L.C. Mack <daniel.l.mack@vanderbilt.edu>
+
+ * C2W/C2W_Demo.cpp:
+ Modified the graph_out adapter call to take advantage of the new function call.
+
+ * LogGraphOut.h:
+ * LogGraphOut.cpp:
+ Refactored some of the code that draws the graph, improved visualization of non-stepping graph
+
+ * SANet/SANet.h:
+ * SANet/SANet.cpp:
+ Simplified the print_graphviz function to remove outside logging code. Takes a default color.
+
+ * SA_PlanStrategy.cpp:
+ Resolved conflict about the task restrictor.
+
Thu Oct 1 17:25:36 UTC 2009 Ben Podgursky <bpodgursky@gmail.com>
* C2W/C2W_Demo.cpp:
@@ -22,8 +38,8 @@ Thu Oct 1 17:25:36 UTC 2009 Ben Podgursky <bpodgursky@gmail.com>
* utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/PDDL_Translator.java:
* utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/SAN_Data/TaskNode.java:
-
- Various changes to the PDDL parser
+
+ Various changes to the PDDL parser
Wed Aug 12 19:15:30 UTC 2009 Ben Podgursky <bpodgursky@gmail.com>
diff --git a/LogGraphOut.cpp b/LogGraphOut.cpp
index b7edb97aeeb..c22c4d9a50e 100644
--- a/LogGraphOut.cpp
+++ b/LogGraphOut.cpp
@@ -33,12 +33,20 @@
using namespace SA_POP;
// Constructor.
-LogGraphOut::LogGraphOut (std::ostream &out, int startstep)
+LogGraphOut::LogGraphOut (std::ostream &out, bool startstep)
: out_ (out)
{
- graphn = startstep;
+ // Set up the current step
+ if(startstep)
+ {
+ curStep = 1;
+ }
+ else
+ {
+ curStep = 0;
+ }
+ byStep = startstep;
hasTracks = false;
- // Nothing to do.
}
// Destructor.
@@ -91,16 +99,8 @@ void LogGraphOut::notify_plan (SA_POP::Planner *planner)
time_t cur_time = time(0);
bool done = false;
- /*
- GVC_t *gvc;
- graph_t *g;
- FILE *fp;
- mfg::DrawGraph * graph;
- */
-
- //gvc = gvContext();
- //This
+ //This sends planning info not included in the graph to the console, about timing windows.
this->out_ << std::endl;
this->out_ << "Plan (" << plan.name << ") Changed at " << std::endl;
this->out_ << ctime (&cur_time) << std::endl;
@@ -118,7 +118,7 @@ void LogGraphOut::notify_plan (SA_POP::Planner *planner)
//Make sure we don't run out of bounds
int lastime = 0;
int plansize = 0;
- if(graphn > 0)
+ if(byStep)
{
for (PlanInstSet::iterator inst_iter = plan.task_insts.begin ();
inst_iter != plan.task_insts.end ();
@@ -127,11 +127,11 @@ void LogGraphOut::notify_plan (SA_POP::Planner *planner)
PlanTaskInst inst = *inst_iter;
startimes.push_back(inst.start_window.first);
}
-
+ //Sort the tasks and grab the current latest time
std::sort(startimes.begin(), startimes.end());
- if(graphn < startimes.size())
+ if(curStep < startimes.size())
{
- lastime = startimes[graphn];
+ lastime = startimes[curStep];
}
else
{
@@ -147,163 +147,101 @@ void LogGraphOut::notify_plan (SA_POP::Planner *planner)
gfile.open("GViz.dot");
- gfile << "strict digraph graph" << graphn << " {\n";
+ gfile << "strict digraph graph" << curStep << " {\n";
- if(graphn == 0)
+ //Just draw out the graph from the causal links from the plan.
+ if(!byStep)
{
+ //Print out the entire graph first.
planner->print_graph(gfile, graphmap);
+ //Now print out the graph of the causal links in the plan.
for (CLSet::iterator cl_iter = plan.causal_links.begin ();
cl_iter != plan.causal_links.end ();
cl_iter++)
{
- CausalLink clink = *cl_iter;
- //this->out_ << "Build Graph from links.." << std::endl;
- gfile << "\t" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << "[shape=box];\n";
- gfile << "\t" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " -> ";
- gfile << planner->get_cond_name (clink.cond.id) << ";\n";
- gfile << "\t" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << "[shape=box];\n";
- gfile << "\t" << planner->get_cond_name (clink.cond.id) << " -> ";
- gfile << planner->get_task_name (
- planner->get_task_from_inst (clink.second)) << "\n";
+ CausalLink clink = *cl_iter;
+ gfile << "\t" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << "[shape=box];\n";
+ gfile << "\t" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " -> ";
+ gfile << planner->get_cond_name (clink.cond.id) << ";\n";
+ gfile << "\t" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << "[shape=box];\n";
+ gfile << "\t" << planner->get_cond_name (clink.cond.id) << " -> ";
+ gfile << planner->get_task_name (planner->get_task_from_inst (clink.second)) << "\n";
}
}
- else if(graphn == 1)
+ // Draw out the graph as if taking the plan step by step
+ else if(byStep)
{
+ //Format a dot file with the entire graph to get the entire structure ready to print.
planner->print_graph(gfile, graphmap);
- for (CLSet::iterator cl_iter = plan.causal_links.begin ();
- cl_iter != plan.causal_links.end ();
- cl_iter++)
- {
- CausalLink clink = *cl_iter;
- //this->out_ << "Build Graph from links.." << std::endl;
-
- if(planner->get_start_window (clink.first).first <= lastime)
- {
- if(planner->get_start_window (clink.first).first == lastime && !done)
- {
- std::map<std::string, std::string>::iterator citer = graphmap.find(planner->get_task_name (planner->get_task_from_inst (clink.first)));
- if(citer != graphmap.end())
- {
- (*citer).second = "green";
- }
- citer = graphmap.find(planner->get_cond_name (clink.cond.id));
- if(citer != graphmap.end())
- {
- (*citer).second = "green";
- }
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << "[shape=box, color= green];\n";
- gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << " [shape=box, style=filled ,color = orange];\n";
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << " -> ";
- gfile << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << ";\n";
- }
- else
- {
- std::map<std::string, std::string>::iterator citer = graphmap.find(planner->get_task_name (planner->get_task_from_inst (clink.first)));
- if(citer != graphmap.end())
- {
- (*citer).second = "blue";
- }
- citer = graphmap.find(planner->get_cond_name (clink.cond.id));
- if(citer != graphmap.end())
- {
- (*citer).second = "blue";
- }
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << "[shape=box, color= turquoise1];\n";
- gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[style=filled, color = turquoise1];\n";
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << " -> ";
- gfile << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << ";\n";
- }
-
- if(planner->get_start_window (clink.second).first <= lastime)
- {
- if(planner->get_start_window (clink.second).first == lastime && !done)
+ //Propogate the image of taking a step in the plan by modifying the colors of the nodes.
+ color_step(planner);
+ //Use the timing to find the current step and color as necessary
+ for (CLSet::iterator cl_iter = plan.causal_links.begin ();cl_iter != plan.causal_links.end ();cl_iter++)
+ {
+ CausalLink clink = *cl_iter;
+ if(planner->get_start_window (clink.first).first <= lastime)
+ {
+ //Color the current step green
+ if(planner->get_start_window (clink.first).first == lastime && !done)
{
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << "[shape=box, color = green];\n";
- //gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[color = green];\n";
- gfile << "\t" << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << " -> ";
- gfile << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << ";\n";
+ std::map<std::string, std::string>::iterator citer = graphmap.find(planner->get_task_name (planner->get_task_from_inst (clink.first)));
+ if(citer != graphmap.end())
+ {
+ (*citer).second = "green";
+ }
+ citer = graphmap.find(planner->get_cond_name (clink.cond.id));
+ if(citer != graphmap.end())
+ {
+ (*citer).second = "green";
+ }
+ gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << "[shape=box, color= green];\n";
+ gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << " [style=filled ,color = orange];\n";
+ gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << " -> ";
+ gfile << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << ";\n";
}
else
{
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << "[shape=box, color = turquoise1];\n";
- gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[color = turquoise1];\n";
- gfile << "\t" << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << " -> ";
- gfile << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << ";\n";
-
- }
- }
- }
- }
- }
- else
- {
- for (CLSet::iterator cl_iter = plan.causal_links.begin ();
- cl_iter != plan.causal_links.end ();
- cl_iter++)
- {
- CausalLink clink = *cl_iter;
- //this->out_ << "Build Graph from links.." << std::endl;
-
- if(planner->get_start_window (clink.first).first <= lastime)
- {
- if(planner->get_start_window (clink.first).first == lastime && !done)
- {
- std::map<std::string, std::string>::iterator citer = graphmap.find(planner->get_task_name (planner->get_task_from_inst (clink.first)));
- if(citer != graphmap.end())
- {
- (*citer).second = "green";
+ //Go through and color the path to the current step blue.
+ std::map<std::string, std::string>::iterator citer = graphmap.find(planner->get_task_name (planner->get_task_from_inst (clink.first)));
+ if(citer != graphmap.end())
+ {
+ (*citer).second = "blue";
+ }
+ citer = graphmap.find(planner->get_cond_name (clink.cond.id));
+ if(citer != graphmap.end())
+ {
+ (*citer).second = "blue";
+ }
+ gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << "[shape=box, color= turquoise1];\n";
+ gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[style=filled, color = turquoise1];\n";
+ gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << " -> ";
+ gfile << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << ";\n";
}
- citer = graphmap.find(planner->get_cond_name (clink.cond.id));
- if(citer != graphmap.end())
- {
- (*citer).second = "green";
- }
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << "[shape=box, style=filled ,color= green];\n";
- gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[ style=filled , color = orange];\n";
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << " -> ";
- gfile << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << ";\n";
- }
- else
- {
- std::map<std::string, std::string>::iterator citer = graphmap.find(planner->get_task_name (planner->get_task_from_inst (clink.first)));
- if(citer != graphmap.end())
- {
- (*citer).second = "blue";
- }
- citer = graphmap.find(planner->get_cond_name (clink.cond.id));
- if(citer != graphmap.end())
- {
- (*citer).second = "blue";
- }
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << "[shape=box, style=filled ,color= turquoise1];\n";
- gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[ style=filled ,color = turquoise1];\n";
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << " -> ";
- gfile << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << ";\n";
- }
- if(planner->get_start_window (clink.second).first <= lastime)
- {
- if(planner->get_start_window (clink.second).first == lastime && !done)
- {
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << "[shape=box, style=filled , color = green];\n";
- //gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[color = green];\n";
- gfile << "\t" << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << " -> ";
- gfile << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << ";\n";
+ //Otherwise print the graph with colors that indicate that the graph has been traversed through all the steps in the plan.
+ if(planner->get_start_window (clink.second).first <= lastime)
+ {
+ if(planner->get_start_window (clink.second).first == lastime && !done)
+ {
+ gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << "[shape=box, color = green];\n";
+ //gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[color = green];\n";
+ gfile << "\t" << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << " -> ";
+ gfile << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << ";\n";
+ }
+ else
+ {
+ gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << "[shape=box, color = turquoise1];\n";
+ gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[color = turquoise1];\n";
+ gfile << "\t" << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << " -> ";
+ gfile << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << ";\n";
+
+ }
}
- else
- {
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << "[shape=box, style=filled , color = turquoise1];\n";
- gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[style=filled , color = turquoise1];\n";
- gfile << "\t" << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << " -> ";
- gfile << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << ";\n";
-
- }
- }
- }
- }
- }
-
+ }
+ }
+ }
+ //If we are tracking conditions not controlled by the plan, but that impact it(such as environmental conditions
if(hasTracks)
{
for(int i = 0; i < tracks.size(); i++)
@@ -320,6 +258,8 @@ void LogGraphOut::notify_plan (SA_POP::Planner *planner)
}
}
}
+
+ // If we are actually done with the graph, color the goal as true, and done.
if(done)
{
SA_POP::GoalMap curgoals = planner->get_goals();
@@ -347,6 +287,7 @@ void LogGraphOut::notify_plan (SA_POP::Planner *planner)
//system("dot -Tgif GViz.dot -o step.gif");
//system("step.gif");
+ //This is debug output to the console about scheduling links
for (SchedLinkSet::iterator sched_iter = plan.sched_links.begin ();
sched_iter != plan.sched_links.end ();
sched_iter++)
@@ -366,13 +307,50 @@ void LogGraphOut::notify_plan (SA_POP::Planner *planner)
this->out_ << std::endl;
};
-
+//Advance a step
void LogGraphOut::moveStep()
{
- graphn++;
+ curStep++;
};
+//Reset current step
void LogGraphOut::resetStep()
{
- graphn = 1;
+ curStep = 1;
+};
+
+// Uses a color pattern to effect the nodes in the plan to give the impression that they are the pervious step
+void LogGraphOut::color_step(SA_POP::Planner *planner)
+{
+ Plan plan = planner->get_plan ();
+ for (CLSet::iterator cl_iter = plan.causal_links.begin (); cl_iter != plan.causal_links.end (); cl_iter++)
+ {
+ CausalLink clink = *cl_iter;
+ std::map<std::string, std::string>::iterator titer = graphmap.find(planner->get_task_name (planner->get_task_from_inst (clink.first)));
+ if(titer != graphmap.end())
+ {
+ if((*titer).second == "blue" )
+ {
+ (*titer).second = "cornflowerblue";
+
+ }
+ else if((*titer).second == "green")
+ {
+ (*titer).second = "red";
+ }
+ }
+ std::map<std::string, std::string>::iterator citer = graphmap.find(planner->get_cond_name (clink.cond.id));
+ if(citer != graphmap.end())
+ {
+ if((*citer).second == "blue" )
+ {
+ (*citer).second = "cornflowerblue";
+
+ }
+ else if((*citer).second == "green")
+ {
+ (*citer).second = "red";
+ }
+ }
+ }
}; \ No newline at end of file
diff --git a/LogGraphOut.h b/LogGraphOut.h
index 900c50c1be8..3ccd2cf40ee 100644
--- a/LogGraphOut.h
+++ b/LogGraphOut.h
@@ -37,7 +37,7 @@ namespace SA_POP {
/**
* @param strm Output stream to log to.
*/
- LogGraphOut (std::ostream &out, int startStep);
+ LogGraphOut (std::ostream &out, bool startStep);
/// Destructor.
virtual ~LogGraphOut (void);
@@ -72,10 +72,20 @@ namespace SA_POP {
*/
void addTracking(std::vector<SANet::CondID> checks);
+ /// Color the graph to immitate the nextstep
+ /**
+ *
+ */
+ void color_step(SA_POP::Planner *planner);
+
protected:
- /// Output stream to log to.
- std::ostream &out_;
- int graphn;
+ /// Output stream to log to.
+ std::ostream &out_;
+ // Utilize the graphviz layout to fake taking steps?
+ bool byStep;
+
+ // Utilized for the step needed to isolate
+ int curStep;
bool hasTracks;
std::map<std::string, std::string> graphmap;
std::vector<SANet::CondID> tracks;
diff --git a/SANet/SANet.cpp b/SANet/SANet.cpp
index 02432326a9c..61489ddc01b 100644
--- a/SANet/SANet.cpp
+++ b/SANet/SANet.cpp
@@ -223,54 +223,33 @@ void SANet::Network::update_effect_link(TaskID task_ID, CondID cond_ID,
};
-void SANet::Network::print_graphviz(std::basic_ostream<char, std::char_traits<char> >& strm, std::map<std::string, std::string>& graphmap)
+void SANet::Network::print_graphviz(std::basic_ostream<char, std::char_traits<char> >& strm, std::map<std::string, std::string>& graphmap, std::string defaultColor)
{
+ //Go through the task nodes, and if it's without a color, then give it the default. Then write it to the stream.
for (TaskNodeMap::iterator node_iter = task_nodes_.begin ();
node_iter != task_nodes_.end (); node_iter++)
{
std::map<std::string, std::string>::iterator titer = graphmap.find(node_iter->second->get_name());
- if(titer != graphmap.end())
+ if(titer == graphmap.end())
{
- if((*titer).second == "blue" )
- {
- (*titer).second = "cornflowerblue";
-
- }
- else if((*titer).second == "green")
- {
- (*titer).second = "red";
- }
- }
- else
- {
- graphmap[node_iter->second->get_name()] = "grey";
+ graphmap[node_iter->second->get_name()] = defaultColor;
}
strm << "\t" << "\"" << node_iter->second->get_name() << " " << node_iter->first << "\" " << "[shape=box, style=filled, color = " << graphmap[node_iter->second->get_name()] <<"];\n";
}
+ //Go through the cond nodes, and if it's without a color, then give it the default. Then write it to the stream.
for (CondNodeMap::iterator node_iter = cond_nodes_.begin ();
node_iter != cond_nodes_.end (); node_iter++)
{
std::map<std::string, std::string>::iterator citer = graphmap.find(node_iter->second->get_name());
- if(citer != graphmap.end())
- {
- if((*citer).second == "blue" )
- {
- (*citer).second = "cornflowerblue";
-
- }
- else if((*citer).second == "green")
- {
- (*citer).second = "red";
- }
- }
- else
+ if(citer == graphmap.end())
{
- graphmap[node_iter->second->get_name()] = "grey";
+ graphmap[node_iter->second->get_name()] = defaultColor;
}
strm << "\t" << "\"" << node_iter->second->get_name() << " " << node_iter->first << "\" " << "[style=filled, color = " << graphmap[node_iter->second->get_name()] << "];\n";
}
+ //Go through the effect and preconds for the task nodes and link them in the stream
for (TaskNodeMap::iterator node_iter = task_nodes_.begin ();
node_iter != task_nodes_.end (); node_iter++)
{
diff --git a/SANet/SANet.h b/SANet/SANet.h
index fc0810aabf4..7368037de24 100644
--- a/SANet/SANet.h
+++ b/SANet/SANet.h
@@ -180,8 +180,10 @@ namespace SANet {
/// Print Graphviz network representation to stream.
/**
* @param strm Output stream on which to print network representation.
+ * @param graphmap The color mapping being used.
+ * @param defaultColor The default color if it's not in the mapping.
*/
- virtual void print_graphviz (std::basic_ostream<char, std::char_traits<char> >& strm, std::map<std::string, std::string>& graphmap);
+ virtual void print_graphviz (std::basic_ostream<char, std::char_traits<char> >& strm, std::map<std::string, std::string>& graphmap, std::string defaultColor = "grey");
diff --git a/SA_PlanStrategy.cpp b/SA_PlanStrategy.cpp
index b3b517598c4..9b6b2192dd6 100644
--- a/SA_PlanStrategy.cpp
+++ b/SA_PlanStrategy.cpp
@@ -142,9 +142,9 @@ CommandID SA_PlanStrategy::get_next_cmd_id (void)
// scheduling constraint satisfaction through call back).
bool SA_PlanStrategy::satisfy_open_conds (void)
{
- // If all open conditions have been satisfied, then return true for success.
- if (this->open_conds_.empty ())
- return this->planner_->full_sched();
+ // If all open conditions have been satisfied, then return true for success.
+ if (this->open_conds_.empty ())
+ return this->planner_->full_sched();
//Note: change this number to limit the size of the final plan. Set true for unlimited
//!(this->planner_->get_working_plan()->get_all_insts().size() > 12)