[Avida-SVN] r1810 - branches/uml/source/main
hjg at myxo.css.msu.edu
hjg at myxo.css.msu.edu
Tue Jul 17 05:20:06 PDT 2007
Author: hjg
Date: 2007-07-17 08:20:06 -0400 (Tue, 17 Jul 2007)
New Revision: 1810
Modified:
branches/uml/source/main/cUMLStateDiagram.cc
Log:
Modified scenario path to start from state 0. Addtrans ok w/ disconnect
Modified: branches/uml/source/main/cUMLStateDiagram.cc
===================================================================
--- branches/uml/source/main/cUMLStateDiagram.cc 2007-07-16 14:02:47 UTC (rev 1809)
+++ branches/uml/source/main/cUMLStateDiagram.cc 2007-07-17 12:20:06 UTC (rev 1810)
@@ -38,26 +38,31 @@
int num_vert = num_vertices(sd0);
std::deque<std::string> p_temp = p;
-
-
- // Must start at state 0.
- // Must check each state.
- while (!p.empty()) {
-
- for (int i = 0; i<num_vert; i++) {
- len = checkForPathStep(p, vertex(i, sd0), 0);
- // check to see if this path is longer than other paths....
- if (len > path_dist) {
- path_dist = len;
+ // Entire path must start at state 0.
+ len = checkForPathStep(p, vertex(0, sd0), 0);
+ // If this returns a length, then the path is found & we can exit.
+ if (len > 0) {
+ path_dist = len;
+ } else {
+ // Else, check for partial paths, which can start from anywhere...
+ p.pop_front();
+ // Must check each state other than state 0.
+ while (!p.empty()) {
+ for (int i = 1; i<num_vert; i++) {
+ len = checkForPathStep(p, vertex(i, sd0), 0);
+ // check to see if this path is longer than other paths....
+ if (len > path_dist) {
+ path_dist = len;
+ }
}
- }
- p.pop_front();
+ p.pop_front();
- if (len > p.size()) break;
- }
+ if (len > p.size()) break;
+ }
+
+ }
+
return path_dist;
-
-
}
int cUMLStateDiagram::checkForPathStep(std::deque<std::string> path,
@@ -386,12 +391,14 @@
return false;
}
+/* // Removed on 7/17/2007 - The scenarios should take care of this problem.
// Check that the origin state of the transition is reachable.
boost::graph_traits<state_diagram>::in_edge_iterator in_start, in_end;
tie (in_start, in_end) = in_edges(orig, sd0);
if ((in_start == in_end) && (orig != vertex(0, sd0))) {
return false;
}
+*/
// Check that there is not a duplicate transition
if (findTrans(orig, dest, trigger_index, guard_index, action_index)) {
More information about the Avida-cvs
mailing list