[Avida-cvs] [Avida2-svn] r169 - in trunk:
documentation/content/using source/event source/main
dule at myxo.css.msu.edu
dule at myxo.css.msu.edu
Sun May 29 14:39:02 PDT 2005
Author: dule
Date: 2005-05-29 17:39:02 -0400 (Sun, 29 May 2005)
New Revision: 169
Modified:
trunk/documentation/content/using/events.html
trunk/documentation/content/using/inst_set.html
trunk/source/event/cPopulation.events
trunk/source/main/analyze_util.cc
trunk/source/main/analyze_util.hh
trunk/source/main/landscape.hh
Log:
Added dump_task_grid event (see documentation for full description). Also added docs for div-sex and related instructions
Modified: trunk/documentation/content/using/events.html
===================================================================
--- trunk/documentation/content/using/events.html 2005-05-27 19:57:17 UTC (rev 168)
+++ trunk/documentation/content/using/events.html 2005-05-29 21:39:02 UTC (rev 169)
@@ -116,7 +116,8 @@
<A HREF="#disconnect_cells">disconnect_cells</A><br>
<A HREF="#dump_fitness_grid">dump_fitness_grid</A><br>
<A HREF="#dump_genotype_grid">dump_genotype_grid</A><br>
- <A HREF="#dump_donor_grid">dump_donore_grid</A><br>
+ <A HREF="#dump_donor_grid">dump_task_grid</A><br>
+ <A HREF="#dump_donor_grid">dump_donor_grid</A><br>
<A HREF="#dump_receiver_grid">dump_receiver_grid</A><br>
<A HREF="#dump_historic_pop">dump_historic_pop</A> (<i>deprecated</i>)<br>
<A HREF="#dump_memory">dump_memory</A><br>
@@ -275,6 +276,12 @@
Print out the grid of genotype IDs into idgrid.*.out", where '*' is replaced by the
number of the current update.
<br>
+<li><b><A NAME="dump_task_grid">dump_task_grid</A></b> <br>
+ Print out the grid of takss that organisms do. For each organism, tasks are first
+ encoded as a binary string (e.g. 100000001 means that organism is doing NOT and EQU
+ and then reported as a base-10 number (257 in the example above).
+<br>
+
<li><b><A NAME="dump_donor_grid">dump_donor_pop</A></b> <br>
Print out the grid of organisms who donated their merit into the
"donor_grid.*.out", where '*' is replaced by the
Modified: trunk/documentation/content/using/inst_set.html
===================================================================
--- trunk/documentation/content/using/inst_set.html 2005-05-27 19:57:17 UTC (rev 168)
+++ trunk/documentation/content/using/inst_set.html 2005-05-29 21:39:02 UTC (rev 169)
@@ -1,7 +1,4 @@
-<html>
-<title>The Instruction Set File</title>
-<body
- bgcolor="#FFFFFF"
+<html> <title>The Instruction Set File</title> <body bgcolor="#FFFFFF"
text="#000000"
link="#0000AA"
alink="#0000FF"
@@ -235,7 +232,27 @@
it has made a full 360 degree turn, or else it finds an organism that
possesses the complement template.
+<p>
+<b><tt>div-asex</tt></b><br>
+Same as h-divide (added for symetry with the divide-sex).
+
+<p>
+<b><tt>div-sex</tt></b><br>
+Divide with recombination. After the offspring genome is created, it is not
+immediately placed into the population. Instead, it goes into "birth chamber".
+If there is already another genome there, they recombine. If not, it waits
+untill the next sexually produced genotype arrives. When another genome arrives
+ two random points are picked in the genome, and the area between them is
+swapped between the two genomes in the birth chamber. Then, they are both placed
+into the population.
+
+<p>
+<b><tt>div-asex-w</tt></b><br>
+Control for the effect of sexual genomes waiting in the birth chamber. There is
+no recombination here, but each genome must wait in the birth chamber until
+another one arrives before they are both placed into the population.
+
<br><hr>
Project hosted by:<br>
<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=46761&type=2" width="125" height="37" border="0" alt="SourceForge.net"/></a>
-
\ No newline at end of file
+
Modified: trunk/source/event/cPopulation.events
===================================================================
--- trunk/source/event/cPopulation.events 2005-05-27 19:57:17 UTC (rev 168)
+++ trunk/source/event/cPopulation.events 2005-05-29 21:39:02 UTC (rev 169)
@@ -1701,6 +1701,29 @@
fp << endl;
}
+dump_task_grid
+:descr:
+/**
+* Writes out a grid of tasks done by each organism
+* Tasks are encoded as a binary string first, and then converted into a
+* base 10 number
+**/
+:args:
+:body:
+cString filename;
+filename.Set("task_grid_%d.dat",population->GetUpdate());
+ofstream fp(filename());
+cAnalyzeUtil::TaskGrid( population, fp );
+
+/**
+* Writes out tasks done for all current organisms
+* output is the base 10 representation of 0-1 binary strings
+* representing the all tasks done, with NOT = 2^0, EQU = 2^8
+*
+* The output file is called "task_grid.*.out", where '*' is replaced by the
+* number of the current update.
+**/
+
dump_donor_grid
:descr:
/**
Modified: trunk/source/main/analyze_util.cc
===================================================================
--- trunk/source/main/analyze_util.cc 2005-05-27 19:57:17 UTC (rev 168)
+++ trunk/source/main/analyze_util.cc 2005-05-29 21:39:02 UTC (rev 169)
@@ -776,7 +776,30 @@
}
}
+void cAnalyzeUtil::TaskGrid(cPopulation * pop, ofstream & fp)
+{
+ for (int i = 0; i < pop->GetWorldX(); i++) {
+ for (int j = 0; j < pop->GetWorldY(); j++) {
+ int task_sum = 0;
+ if (pop->GetCell(i).IsOccupied() == true) {
+ cOrganism * organism = pop->GetCell(i).GetOrganism();
+ cCPUTestInfo test_info;
+ cTestCPU::TestGenome( test_info, organism->GetGenome() );
+ cPhenotype & test_phenotype = test_info.GetTestOrganism()->GetPhenotype();
+ int num_tasks = test_phenotype.GetEnvironment().GetTaskLib().GetSize();
+ for (int k = 0; k < num_tasks; k++) {
+ if (test_phenotype.GetLastTaskCount()[k]>0) {
+ task_sum = task_sum + (int)pow(2,k);
+ }
+ }
+ }
+ fp << task_sum << " ";
+ }
+ fp << endl;
+ }
+}
+
/**
* This function prints all the tasks that viable creatures have performed
* so far (compare with the event 'print_task_data', which prints all tasks.
Modified: trunk/source/main/analyze_util.hh
===================================================================
--- trunk/source/main/analyze_util.hh 2005-05-27 19:57:17 UTC (rev 168)
+++ trunk/source/main/analyze_util.hh 2005-05-29 21:39:02 UTC (rev 169)
@@ -56,6 +56,7 @@
const char * creature_name, bool save_creatures=false);
static void TaskSnapshot(cPopulation * pop, std::ofstream & fp);
+ static void TaskGrid(cPopulation * pop, std::ofstream & fp);
static void PrintViableTasksData(cPopulation *pop, std::ofstream &fp);
static void PrintTreeDepths(cPopulation * pop, std::ofstream & fp);
Modified: trunk/source/main/landscape.hh
===================================================================
--- trunk/source/main/landscape.hh 2005-05-27 19:57:17 UTC (rev 168)
+++ trunk/source/main/landscape.hh 2005-05-29 21:39:02 UTC (rev 169)
@@ -21,6 +21,8 @@
#include "tMatrix.hh"
#endif
+#include <fstream>
+
class cInstSet;
class cGenome; // aggregate
class cCPUTestInfo; // aggregate
More information about the Avida-cvs
mailing list