[Avida-SVN] r1234 - in extras: . source/testsuites
avidaedward at myxo.css.msu.edu
avidaedward at myxo.css.msu.edu
Sat Jan 27 22:18:10 PST 2007
Author: avidaedward
Date: 2007-01-28 01:18:10 -0500 (Sun, 28 Jan 2007)
New Revision: 1234
Modified:
extras/
extras/source/testsuites/nAnalyze.cpp
Log:
r1258 at clearly: kaben | 2007-01-27 22:36:24 -0500
Removed earlier, abandoned brainstorm of COMPETE analyze command.
Property changes on: extras
___________________________________________________________________
Name: svk:merge
- 079b078a-dbed-46b9-b3da-37668d4295ca:/avida/local/extras:1257
+ 079b078a-dbed-46b9-b3da-37668d4295ca:/avida/local/extras:1258
Modified: extras/source/testsuites/nAnalyze.cpp
===================================================================
--- extras/source/testsuites/nAnalyze.cpp 2007-01-28 06:18:07 UTC (rev 1233)
+++ extras/source/testsuites/nAnalyze.cpp 2007-01-28 06:18:10 UTC (rev 1234)
@@ -1046,79 +1046,7 @@
a.Send("SET_BATCH $t");
a.Send("PURGE_BATCH");
- /* COMPETE : brainstorm 1 of new Analyze command. {{{5 */
- if(false){
- /* Arguments to COMPETE: */
- /*
- COMPETE
- batch_size
- from_id
- to_id=current
- //test_viable=1
- //type='fitness'
- */
- /* Get iterator into "from" batch. */
- tListIterator<cAnalyzeGenotype> batch_it(a.batch[batch_from].List());
- /* Get size of "from" batch. */
- const int parent_batch_size = a.batch[batch_from].List().GetSize();
- if(parent_batch_size <= 0){
- cout << "Warning: origin batch is empty, cannot sample to destination batch." << endl;
- break;
- }
- /* Create scheduler. */
- cSchedule* schedule = new cProbSchedule(
- parent_batch_size,
- world->GetRandom().GetInt(0x7FFFFFFF)
- );
-
- /* Initialize scheduler with fitness values per-organism. */
- tArray<cAnalyzeGenotype *> gen_array(parent_batch_size);
- tArray<cMerit> fitness_array(parent_batch_size);
- cAnalyzeGenotype * genotype = NULL;
- int array_pos = 0;
- while ((genotype = batch_it.Next()) != NULL) {
- //cAnalyzeGenotype * new_genotype = new cAnalyzeGenotype(*genotype);
- //batch[batch_to].List().PushRear(new_genotype);
- gen_array[array_pos] = genotype;
- /*
- kgn at XXX FIXME HACK
- multiplication by 1000 because merits less than 1 are truncated to zero.
- */
- fitness_array[array_pos] = genotype->GetFitness() * 1000;
- schedule->Adjust(array_pos, fitness_array[array_pos]);
- array_pos++;
- }
-
-
- /* Use scheduler to sample organisms in "from" batch. */
- for(int i=0; i<batch_size; /* don't increment i yet */){
- /* Sample an organism. */
- array_pos = schedule->GetNextID();
- if(array_pos < 0){
- cout << "Warning: No organisms in origin batch have positive fitness, cannot sample to destination batch." << endl;
- break;
- }
- genotype = gen_array[array_pos];
- /* If not viable, discard and continue. */
- if(!genotype->GetViable()){
- continue;
- }
- /* 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++;
- }
- }
-
- /* COMPETE : brainstorm 2 of new Analyze command. {{{5 */
+ /* COMPETE : brainstorm of new Analyze command. {{{5 */
if(true){
/* Arguments to COMPETE: */
/*
More information about the Avida-cvs
mailing list