[Avida-SVN] r1672 - branches/uml/source/main

hjg at myxo.css.msu.edu hjg at myxo.css.msu.edu
Tue Jun 12 12:38:58 PDT 2007


Author: hjg
Date: 2007-06-12 15:38:58 -0400 (Tue, 12 Jun 2007)
New Revision: 1672

Modified:
   branches/uml/source/main/cTaskLib.cc
   branches/uml/source/main/cTaskLib.h
   branches/uml/source/main/cUMLModel.cc
Log:
Added support for evolving a 2nd state diagram. 


Modified: branches/uml/source/main/cTaskLib.cc
===================================================================
--- branches/uml/source/main/cTaskLib.cc	2007-06-12 17:38:24 UTC (rev 1671)
+++ branches/uml/source/main/cTaskLib.cc	2007-06-12 19:38:58 UTC (rev 1672)
@@ -393,6 +393,16 @@
 	  NewTask(name, "Successfully created trans 4", &cTaskLib::Task_Trans4);
   else if (name == "trans5") // 
 	  NewTask(name, "Successfully created trans 5", &cTaskLib::Task_Trans5);
+  else if (name == "trans6") // 
+	  NewTask(name, "Successfully created trans 6", &cTaskLib::Task_Trans6);
+  else if (name == "trans7") // 
+	  NewTask(name, "Successfully created trans 7", &cTaskLib::Task_Trans7);	  
+  else if (name == "trans8") // 
+	  NewTask(name, "Successfully created trans 8", &cTaskLib::Task_Trans8);
+  else if (name == "trans9") // 
+	  NewTask(name, "Successfully created trans 9", &cTaskLib::Task_Trans9);
+  else if (name == "trans10") // 
+	  NewTask(name, "Successfully created trans 10", &cTaskLib::Task_Trans10);	  
   else if (name == "numStates") // 
 	  NewTask(name, "Successfully created 5 states", &cTaskLib::Task_NumStates);  	  
   else if (name == "numTrans") // 
@@ -2734,6 +2744,96 @@
 
 }
 
+
+double cTaskLib::Task_Trans6(cTaskContext& ctx) const
+{
+	double bonus = 0.0;
+//	if (ctx.organism->currTrans(1, -1, -1, -1, -1, "^TempSensor.getOpState()")) {		
+//	if (ctx.organism->currTrans(1, -1, -1, -1, -1, 1)) {		
+//	if (ctx.organism->getUMLModel()->getStateDiagram(1)->findTrans(-1, -1, -1, -1, 1))
+	if (ctx.organism->getUMLModel()->getStateDiagram(1)->findTrans(0, 4, 2, 1, 0))
+	{
+
+
+		ctx.task_success_complete = 1;	
+		bonus = 1.0;
+	}
+	
+	ctx.task_success_complete = 0;	
+	return bonus;
+}
+
+double cTaskLib::Task_Trans7(cTaskContext& ctx) const
+{
+	double bonus = 0.0;
+//	if (ctx.organism->currTrans(0, -1, -1, "setTempOpState", -1, -1)) {		
+//	if (ctx.organism->currTrans(1, -1, -1, 1, -1, -1)) {		
+//	if (ctx.organism->getUMLModel()->getStateDiagram(1)->findTrans(-1, -1, 1, -1, -1))
+	if (ctx.organism->getUMLModel()->getStateDiagram(1)->findTrans(4, 1, 0, 1, 0))
+	{
+
+
+			ctx.task_success_complete += 1;	
+			bonus = 1.0;
+	}
+	
+	return bonus;
+
+}
+
+double cTaskLib::Task_Trans8(cTaskContext& ctx) const
+{
+	double bonus = 0.0;
+//	if (ctx.organism->currTrans(0, -1, -1, "getOpState", -1, -1)) {		
+//	if (ctx.organism->currTrans(0, -1, -1, 1, -1, -1)) {		
+//	if (ctx.organism->getUMLModel()->getStateDiagram(0)->findTrans(-1, -1, 1, -1, -1))
+	if (ctx.organism->getUMLModel()->getStateDiagram(1)->findTrans(1, 3, 1, 1, 1))
+	{
+
+
+			bonus = 1.0;
+			ctx.task_success_complete += 1;	
+	}
+	
+	return bonus;
+
+}
+
+double cTaskLib::Task_Trans9(cTaskContext& ctx) const
+{
+	double bonus = 0.0;
+//	if (ctx.organism->currTrans(0, -1, -1, -1, -1, "op_state:=1")) {		
+//	if (ctx.organism->currTrans(0, -1, -1, -1, -1, 3)) {		
+//	if (ctx.organism->getUMLModel()->getStateDiagram(0)->findTrans(-1, -1, -1, -1, 3))
+	if (ctx.organism->getUMLModel()->getStateDiagram(1)->findTrans(3, 2, 2, 0, 3))
+	{
+
+			ctx.task_success_complete += 1;	
+			bonus = 1.0;
+	}
+	
+	return bonus;
+
+}
+  
+double cTaskLib::Task_Trans10(cTaskContext& ctx) const
+{
+	double bonus = 0.0;
+//	if (ctx.organism->currTrans(0, -1, -1, -1, -1, "^SoftwareSensor.setTempOpState(op_state)")) {		
+	//if (ctx.organism->currTrans(0, -1, -1, -1, -1, 1)) 
+//	if (ctx.organism->getUMLModel()->getStateDiagram(0)->findTrans(-1, -1, -1, -1, 1))
+	if (ctx.organism->getUMLModel()->getStateDiagram(1)->findTrans(2, 4, 3, 2, 1))
+	{		
+
+
+			ctx.task_success_complete += 1;	
+			bonus = 1.0;
+	}
+	
+	return bonus;
+
+}
+
 double cTaskLib::Task_NumStates(cTaskContext& ctx) const
 {
 	double ns = (double) ctx.organism->getStateDiagram()->numStates();

Modified: branches/uml/source/main/cTaskLib.h
===================================================================
--- branches/uml/source/main/cTaskLib.h	2007-06-12 17:38:24 UTC (rev 1671)
+++ branches/uml/source/main/cTaskLib.h	2007-06-12 19:38:58 UTC (rev 1672)
@@ -282,6 +282,11 @@
   double Task_Trans3(cTaskContext& ctx) const;
   double Task_Trans4(cTaskContext& ctx) const;   
   double Task_Trans5(cTaskContext& ctx) const;
+  double Task_Trans6(cTaskContext& ctx) const;
+  double Task_Trans7(cTaskContext& ctx) const;
+  double Task_Trans8(cTaskContext& ctx) const;
+  double Task_Trans9(cTaskContext& ctx) const;   
+  double Task_Trans10(cTaskContext& ctx) const;
   double Task_NumStates(cTaskContext& ctx) const;
   double Task_NumTrans(cTaskContext& ctx) const;
   double Task_Hydra(cTaskContext& ctx) const;

Modified: branches/uml/source/main/cUMLModel.cc
===================================================================
--- branches/uml/source/main/cUMLModel.cc	2007-06-12 17:38:24 UTC (rev 1671)
+++ branches/uml/source/main/cUMLModel.cc	2007-06-12 19:38:58 UTC (rev 1672)
@@ -92,7 +92,12 @@
  temp->addTransitionLabel(2, 1, 2);
  temp->addTransitionLabel(3, 0, 0);
  
- 
+ cUMLStateDiagram* temp1 = getStateDiagram(1);
+ temp1->addTransitionLabel(3, 2, 1);
+ temp1->addTransitionLabel(0, 1, 0);
+ temp1->addTransitionLabel(2, 0, 3);
+ temp1->addTransitionLabel(2, 1, 0);
+ temp1->addTransitionLabel(1, 1, 1); 
  // Used for Temperature Sensor / MultiSensor example.
 /*    
   // For the first state diagram... 




More information about the Avida-cvs mailing list