[Avida-SVN] r1945 - branches/uml/source/main
hjg at myxo.css.msu.edu
hjg at myxo.css.msu.edu
Thu Aug 16 05:50:57 PDT 2007
Author: hjg
Date: 2007-08-16 08:50:56 -0400 (Thu, 16 Aug 2007)
New Revision: 1945
Modified:
branches/uml/source/main/cTaskLib.cc
branches/uml/source/main/cTaskLib.h
branches/uml/source/main/cUMLModel.cc
branches/uml/source/main/cUMLModel.h
Log:
added pseudo-hydra task
Modified: branches/uml/source/main/cTaskLib.cc
===================================================================
--- branches/uml/source/main/cTaskLib.cc 2007-08-16 12:22:44 UTC (rev 1944)
+++ branches/uml/source/main/cTaskLib.cc 2007-08-16 12:50:56 UTC (rev 1945)
@@ -428,6 +428,8 @@
NewTask(name, "Minimizing edges", &cTaskLib::Task_MinTrans);
else if (name == "non-determinism")
NewTask(name, "Non-determinism", &cTaskLib::Task_Nondeterminism);
+ else if (name == "export-xmi")
+ NewTask(name, "Export XMI", &cTaskLib::Task_ExportXMI);
/* else if (name == "mult_trans") //
NewTask(name, "Successfully completed multiple transitions", &cTaskLib::Task_MultTrans);*/
@@ -3298,3 +3300,28 @@
return !bonus;
}
+
+// This task will be used to see if an organism meets the criteria for
+// running hydra. If so, the task will export the XMI. It is designed to make it possible
+// for the tasks to run on non-class 5 machines.
+double cTaskLib::Task_ExportXMI(cTaskContext& ctx) const {
+ cOrganism* organism = ctx.getOrganism();
+ std::string temp, file_name;
+ double bonus = 0.0;
+
+ temp = organism->getUMLModel()->getXMI();
+
+ // call hydra when a // all scenario hits its max?
+ // all are non-zero?
+ if (organism->getUMLModel()->readyForHydra()) {
+ // print the file to output...
+ file_name = m_world->GetStats().GetUpdate() + "." + ctx.getOrganism()->GetID();
+ organism->getUMLModel()->printUMLModelToFile(file_name);
+ bonus = 1.0;
+ }
+
+ return bonus;
+}
+
+
+
Modified: branches/uml/source/main/cTaskLib.h
===================================================================
--- branches/uml/source/main/cTaskLib.h 2007-08-16 12:22:44 UTC (rev 1944)
+++ branches/uml/source/main/cTaskLib.h 2007-08-16 12:50:56 UTC (rev 1945)
@@ -301,6 +301,8 @@
double Task_MinTrans(cTaskContext& ctx) const;
// double Task_MultTrans(cTaskContext& ctx) const;
double Task_Nondeterminism(cTaskContext& ctx) const;
+ double Task_ExportXMI(cTaskContext& ctx) const;
+
};
Modified: branches/uml/source/main/cUMLModel.cc
===================================================================
--- branches/uml/source/main/cUMLModel.cc 2007-08-16 12:22:44 UTC (rev 1944)
+++ branches/uml/source/main/cUMLModel.cc 2007-08-16 12:50:56 UTC (rev 1945)
@@ -357,4 +357,23 @@
return ret_val;
}
+void cUMLModel::printUMLModelToFile(std::string file_name)
+{
+ // open outfile.
+ std::ofstream outfile;
+// outfile.open(file_name.c_str());
+ outfile.open("out.xmi");
+ assert(outfile.is_open());
+
+ // export xmi to outfile.
+ outfile << xmi << endl;
+
+ // close outfile.
+ outfile.close();
+
+ return;
+
+}
+
+
Modified: branches/uml/source/main/cUMLModel.h
===================================================================
--- branches/uml/source/main/cUMLModel.h 2007-08-16 12:22:44 UTC (rev 1944)
+++ branches/uml/source/main/cUMLModel.h 2007-08-16 12:50:56 UTC (rev 1945)
@@ -38,7 +38,8 @@
// Used to generate and access the XMI version of the model.
std::string getXMI(); // get the XMI version of the model.
- void printXMI(); // create the XMI version of the model.
+ void printXMI(); // create the XMI version of the model.
+ void printUMLModelToFile(std::string); // print the UML model to a file.
// Used to update and get the max number of trans.
int getMaxTrans() { return max_trans; }
More information about the Avida-cvs
mailing list