[Avida-SVN] r1235 - in extras: . source/testsuites

avidaedward at myxo.css.msu.edu avidaedward at myxo.css.msu.edu
Sat Jan 27 22:18:13 PST 2007


Author: avidaedward
Date: 2007-01-28 01:18:13 -0500 (Sun, 28 Jan 2007)
New Revision: 1235

Modified:
   extras/
   extras/source/testsuites/nAnalyze.cpp
Log:
 r1259 at clearly:  kaben | 2007-01-27 22:49:41 -0500
 Cleanup of brainstorm of COMPETE analyze command : removing some unused
 code.



Property changes on: extras
___________________________________________________________________
Name: svk:merge
   - 079b078a-dbed-46b9-b3da-37668d4295ca:/avida/local/extras:1258
   + 079b078a-dbed-46b9-b3da-37668d4295ca:/avida/local/extras:1259

Modified: extras/source/testsuites/nAnalyze.cpp
===================================================================
--- extras/source/testsuites/nAnalyze.cpp	2007-01-28 06:18:10 UTC (rev 1234)
+++ extras/source/testsuites/nAnalyze.cpp	2007-01-28 06:18:13 UTC (rev 1235)
@@ -896,6 +896,25 @@
 
   /* cAnalyze_Brainstorm_SynchronousVsContinuous {{{2 */
   namespace Brainstorm_SynchronousVsContinuous {
+  void Compete(cAnalyze &a, cString cur_string)
+  {
+    if (cur_string.GetSize() == 0) {
+      cerr << "Duplicate Error: Must include from ID!" << endl;
+      if (a.exit_on_error) exit(1);
+    }
+    int batch_from = cur_string.PopWord().AsInt();
+    
+    int batch_to = a.cur_batch;
+    if (cur_string.GetSize() > 0) batch_to = cur_string.PopWord().AsInt();
+    
+    if (a.m_world->GetVerbosity() >= VERBOSE_ON) {
+      cout << "Duplicating from batch " << batch_from << " to batch " << batch_to << "." << endl;
+    }
+  
+
+    return;
+  }
+
     void test(cTestSettings &settings){
       /* Check settings. {{{3 */
       if(
@@ -1015,7 +1034,7 @@
         a.Send("DETAIL archive_0/detail.dat id parent_id num_cpus fitness viable length sequence");
 
         /* 'num_gens' synchronous generations. {{{4 */
-        int num_gens = MAX_BATCHES;
+        int num_gens = 3;
         for(int g=0; g<num_gens; g++){
           /* Mock-up of arguments to COMPETE command. {{{5 */
           int world_x = world->GetConfig().WORLD_X.Get();
@@ -1121,51 +1140,11 @@
               }
 
               /*
-              Replication brainstorm : construction & test : step 1
-              - try exact replicationm, without mutation or crossover.
-              - this works !
-              */
-              if(false){
-                cAnalyzeGenotype * new_genotype = new cAnalyzeGenotype(*genotype);
-                a.batch[batch_to].List().PushRear(new_genotype);
-              }
-
-              /*
-              Replication brainstorm : construction & test : step 2
-              - now split-out a genome, such that it can be altered, and use
+              Replication brainstorm :
+              - Try exact replicationm, without mutation or crossover.
+              - Now split-out a genome, such that it can be altered, and use
                 that genome (unaltered) for replication.
-              */
-              if(false){
-                cCPUMemory child_genome = offspring_genome_array[array_pos];
-                cAnalyzeGenotype * new_genotype = new cAnalyzeGenotype(
-                  world,
-                  child_genome,
-                  a.inst_set
-                );
-                a.batch[batch_to].List().PushRear(new_genotype);
-                cout << "size : " << a.batch[batch_to].List().GetSize() << endl;
-              }
-
-              /*
-              Replication brainstorm : construction & test : step 3
-              - now split-out a genome, such that it can be altered, and use
-                that genome (unaltered) for replication.
-              */
-              if(false){
-                cCPUMemory child_genome = offspring_genome_array[array_pos];
-                child_genome[2*batch_to + 9].SetOp(batch_to + 5);
-                child_genome[2*batch_to + 10].SetOp(i % 2);
-                cAnalyzeGenotype * new_genotype = new cAnalyzeGenotype(
-                  world,
-                  child_genome,
-                  a.inst_set
-                );
-                a.batch[batch_to].List().PushRear(new_genotype);
-                cout << "size : " << a.batch[batch_to].List().GetSize() << endl;
-              }
-
-              /*
-              Replication brainstorm : construction & test : step 4
+              - Alter said genome in a controlled way.
               - Mutations: Copy Mutation, Divide Insertion, Divide Deletion
               */
               if(true){
@@ -1174,9 +1153,7 @@
                 double del_mut_prob = world->GetConfig().DIVIDE_DEL_PROB.Get();
                 int ins_line = -1;
                 int del_line = -1;
-                cout << "copy_mut_prob:" << copy_mut_prob << endl;
-                cout << "ins_mut_prob:" << ins_mut_prob << endl;
-                cout << "del_mut_prob:" << del_mut_prob << endl;
+
                 cCPUMemory child_genome = offspring_genome_array[array_pos];
 
                 if (copy_mut_prob > 0.0) {
@@ -1187,42 +1164,33 @@
                   }
                 }
                 
-                // Perform an Insertion if it has one.
+                /* Perform an Insertion if it has one. */
                 if (world->GetRandom().P(ins_mut_prob)) {
                   ins_line = world->GetRandom().GetInt(child_genome.GetSize() + 1);
                   child_genome.Insert(ins_line, a.inst_set.GetRandomInst(world->GetDefaultContext()));
                 }
                 
-                // Perform a Deletion if it has one.
+                /* Perform a Deletion if it has one. */
                 if (world->GetRandom().P(del_mut_prob)) {
                   del_line = world->GetRandom().GetInt(child_genome.GetSize());
                   child_genome.Remove(del_line);
                 }
 
+                /* Create (possibly mutated) offspring. */
                 cAnalyzeGenotype * new_genotype = new cAnalyzeGenotype(
                   world,
                   child_genome,
                   a.inst_set
                 );
+                /* Place offspring in "to" batch. */
                 a.batch[batch_to].List().PushRear(new_genotype);
-                cout << "size : " << a.batch[batch_to].List().GetSize() << endl;
               }
 
-              /* Replicate an offspring. */
-              /*
-              Mutate / crossover (how?) the offspring.
-              - Q : In cHardwareCPU, for example, how do we:
-                - determine lineage ?
-                - determine how to mutate ?
-                - determine whether to crossover ?
-              - Consider both of repro and h-divide instructions.
-              */
-              /* Place offspring in "to" batch. */
-              /* Increment and continue. */
-              i++;
-
               a.batch[batch_to].SetLineage(false);
               a.batch[batch_to].SetAligned(false);
+
+              /* Increment and continue. */
+              i++;
             }
 
             if(test_info){ delete test_info; test_info = 0; }




More information about the Avida-cvs mailing list