[Avida-SVN] r1938 - in branches/uml/source: cpu main
hjg at myxo.css.msu.edu
hjg at myxo.css.msu.edu
Wed Aug 15 09:50:47 PDT 2007
Author: hjg
Date: 2007-08-15 12:50:47 -0400 (Wed, 15 Aug 2007)
New Revision: 1938
Modified:
branches/uml/source/cpu/cHardwareCPU.cc
branches/uml/source/main/cUMLModel.cc
branches/uml/source/main/cUMLStateDiagram.cc
Log:
Strengthened non-determinism task.
Modified: branches/uml/source/cpu/cHardwareCPU.cc
===================================================================
--- branches/uml/source/cpu/cHardwareCPU.cc 2007-08-15 16:40:34 UTC (rev 1937)
+++ branches/uml/source/cpu/cHardwareCPU.cc 2007-08-15 16:50:47 UTC (rev 1938)
@@ -2725,6 +2725,9 @@
// these checks should be done, but currently they make some assumptions
// that crash when evaluating this kind of organism -- JEB
+ organism->modelCheck(ctx);
+
+
// Setup child
cCPUMemory& child_genome = organism->ChildGenome();
child_genome = GetMemory();
Modified: branches/uml/source/main/cUMLModel.cc
===================================================================
--- branches/uml/source/main/cUMLModel.cc 2007-08-15 16:40:34 UTC (rev 1937)
+++ branches/uml/source/main/cUMLModel.cc 2007-08-15 16:50:47 UTC (rev 1938)
@@ -102,6 +102,7 @@
int num_states;
int num_sd = 0;
int cur_sd = -1;
+ bool include_trans = 0;
std::string tr_l, tr_o, gu, act, temp;
int trig_i, guard_i, act_i, orig_i, dest_i;
std::ifstream infile;
@@ -120,6 +121,9 @@
} else if (line == "=HYDRA=====================") {
line.erase();
infile >> hydraMode;
+ } else if (line == "=INCLUDE-TRANSITIONS=======") {
+ line.erase();
+ infile >> include_trans;
} else if (line == "=STATE-DIAGRAM=============") {
line.erase();
infile >> num_sd;
@@ -155,7 +159,9 @@
infile >> temp;
while (temp != "-END---------------------------") {
infile >> orig_i >> dest_i >> trig_i >> guard_i >> act_i;
- state_diagrams[cur_sd].addTransitionTotal(orig_i, dest_i, trig_i, guard_i, act_i);
+ if (include_trans) {
+ state_diagrams[cur_sd].addTransitionTotal(orig_i, dest_i, trig_i, guard_i, act_i);
+ }
infile >> temp;
}
} else if (line == "-SCENARIO----------------------") {
Modified: branches/uml/source/main/cUMLStateDiagram.cc
===================================================================
--- branches/uml/source/main/cUMLStateDiagram.cc 2007-08-15 16:40:34 UTC (rev 1937)
+++ branches/uml/source/main/cUMLStateDiagram.cc 2007-08-15 16:50:47 UTC (rev 1938)
@@ -26,7 +26,8 @@
{
}
-
+// Technically, this does not actually return the number of non-deterministic states, but rather
+// returns >0 if it is non-deterministic and 0 if it is deterministic.
unsigned int cUMLStateDiagram::getNumberOfNonDeterministicStates() {
std::string tt, tg, ta, ts;
unsigned int numNonD=0;
@@ -57,7 +58,15 @@
// combination is duplicated at least once.
++numNonD;
}
+
}
+
+ // if there is an empty trigger / guard pair AND there are multiple
+ // transitions leaving this state, then increment the number of non-deterministic
+ // states
+ ts = "[]";
+ if ((tnames.find(ts) != tnames.end()) && (tnames.size() > 1)) ++numNonD;
+
}
return numNonD;
}
More information about the Avida-cvs
mailing list