[Avida-SVN] r1935 - in development: source/cpu support/config
barrick at myxo.css.msu.edu
barrick at myxo.css.msu.edu
Tue Aug 14 21:07:54 PDT 2007
Author: barrick
Date: 2007-08-15 00:07:54 -0400 (Wed, 15 Aug 2007)
New Revision: 1935
Modified:
development/source/cpu/cHardwareBase.cc
development/source/cpu/cHardwareCPU.cc
development/support/config/avida.cfg
Log:
Fixed mixup in IMPLICIT_REPRO options.
Adjusted some cHardwareCPU promoter model settings.
Modified: development/source/cpu/cHardwareBase.cc
===================================================================
--- development/source/cpu/cHardwareBase.cc 2007-08-14 20:07:28 UTC (rev 1934)
+++ development/source/cpu/cHardwareBase.cc 2007-08-15 04:07:54 UTC (rev 1935)
@@ -800,8 +800,8 @@
void cHardwareBase::CheckImplicitRepro(cAvidaContext& ctx, bool exec_last_inst)
{
if( (m_world->GetConfig().IMPLICIT_REPRO_TIME.Get() && (organism->GetPhenotype().GetTimeUsed() >= m_world->GetConfig().IMPLICIT_REPRO_TIME.Get()))
- || (m_world->GetConfig().IMPLICIT_REPRO_CPU_CYCLES.Get() && (organism->GetPhenotype().GetCurBonus() >= m_world->GetConfig().IMPLICIT_REPRO_CPU_CYCLES.Get()))
- || (m_world->GetConfig().IMPLICIT_REPRO_BONUS.Get() && (organism->GetPhenotype().GetCPUCyclesUsed() >= m_world->GetConfig().IMPLICIT_REPRO_BONUS.Get()))
+ || (m_world->GetConfig().IMPLICIT_REPRO_CPU_CYCLES.Get() && (organism->GetPhenotype().GetCPUCyclesUsed() >= m_world->GetConfig().IMPLICIT_REPRO_CPU_CYCLES.Get()))
+ || (m_world->GetConfig().IMPLICIT_REPRO_BONUS.Get() && (organism->GetPhenotype().GetCurBonus() >= m_world->GetConfig().IMPLICIT_REPRO_BONUS.Get()))
|| (m_world->GetConfig().IMPLICIT_REPRO_END.Get() && exec_last_inst ))
{
Inst_Repro(ctx);
Modified: development/source/cpu/cHardwareCPU.cc
===================================================================
--- development/source/cpu/cHardwareCPU.cc 2007-08-14 20:07:28 UTC (rev 1934)
+++ development/source/cpu/cHardwareCPU.cc 2007-08-15 04:07:54 UTC (rev 1935)
@@ -457,7 +457,7 @@
if (m_world->GetConfig().PROMOTERS_ENABLED.Get())
{
- // Ideally, this wouldn't be hard-coded
+ // Ideally, this shouldn't be hard-coded
cInstruction promoter_inst = m_world->GetHardwareManager().GetInstSet().GetInst(cStringUtil::Stringf("promoter"));
promoter_search_pos = 0;
promoter_inst_executed = 0;
@@ -718,9 +718,10 @@
fp << "Promoters:";
for (int i=0; i<promoter_pos.GetSize(); i++)
{
- fp << " " << promoter_pos[i] << "-" << promoter_active[i];
+ fp << " " << promoter_pos[i] << "-" << (promoter_active[i] ? "on" : "off");
}
fp << endl;
+ fp << "Instructions executed past promoter: " << promoter_inst_executed << endl;
}
fp.flush();
}
@@ -4249,22 +4250,24 @@
// Adjust the weight at promoter positions that match the downstream nop pattern
void cHardwareCPU::RegulatePromoterNop(cAvidaContext& ctx, bool up)
{
- const int max_distance_to_promoter = 10;
+ const int max_distance_to_promoter = 3;
// Look for the label directly (no complement)
// Save the position before the label, so we don't count it as a regulatory site
int start_pos = IP().GetPosition();
ReadLabel();
- // Don't allow zero-length label matches. These are too powerful.
+ // Don't allow zero-length label matches.
if (GetLabel().GetSize() == 0) return;
-
+
cHeadCPU search_head(IP());
do {
+ //Find the next nop
search_head++;
+
cHeadCPU match_head(search_head);
- // See whether a matching label is here
+ // See whether a matching label is here (Note: we count sub-labels as valid matches)
int i;
for (i=0; i < GetLabel().GetSize(); i++)
{
@@ -4273,10 +4276,10 @@
|| (GetLabel()[i] != m_inst_set->GetNopMod( match_head.GetInst())) ) break;
}
- // Matching label found
+ // Matching label found (next inst must not be a nop)
if (i == GetLabel().GetSize())
{
- //Check eack promoter
+ //Check each promoter
int start_pos = match_head.GetPosition();
int end_pos = start_pos + max_distance_to_promoter;
int circle_end = end_pos % GetMemory().GetSize(); //annoying circular genomes
@@ -4373,7 +4376,10 @@
m_advance_ip = false;
organism->GetPhenotype().SetTerminated(true);
- //organism->ClearInput();
+ //Setting this makes it harder to do things. You have to be modular.
+ organism->GetOrgInterface().ResetInputs(ctx); // Re-randomize the inputs this organism sees
+ organism->ClearInput(); // Also clear their input buffers, or they can still claim
+ // rewards for numbers no longer in their environment!
// Find the next active promoter
int started_search_pos = promoter_search_pos;
Modified: development/support/config/avida.cfg
===================================================================
--- development/support/config/avida.cfg 2007-08-14 20:07:28 UTC (rev 1934)
+++ development/support/config/avida.cfg 2007-08-15 04:07:54 UTC (rev 1935)
@@ -115,14 +115,17 @@
REQUIRED_TASK -1 # Task ID required for successful divide.
IMMUNITY_TASK -1 # Task providing immunity from the required task.
REQUIRED_REACTION -1 # Reaction ID required for successful divide.
+REQUIRED_BONUS 0.0 # Required bonus to divide.
IMPLICIT_REPRO_BONUS 0 # Call Inst_Repro to divide upon achieving this bonus. 0 = OFF
IMPLICIT_REPRO_CPU_CYCLES 0 # Call Inst_Repro after this many cpu cycles. 0 = OFF
IMPLICIT_REPRO_TIME 0 # Call Inst_Repro after this time used. 0 = OFF
+IMPLICIT_REPRO_END 0 # Call Inst_Repro after executing the last instruction in the genome.
### MUTATION_GROUP ###
# Mutations
POINT_MUT_PROB 0.0 # Mutation rate (per-location per update)
COPY_MUT_PROB 0.0075 # Mutation rate (per copy)
+COPY_SLIP_PROB 0.0 # Slip rate (per copy)
INS_MUT_PROB 0.0 # Insertion rate (per site, applied on divide)
DEL_MUT_PROB 0.0 # Deletion rate (per site, applied on divide)
DIV_MUT_PROB 0.0 # Mutation rate (per site, applied on divide)
@@ -312,6 +315,7 @@
# Promoters
PROMOTERS_ENABLED 0 # Use the promoter/terminator execution scheme.
# Certain instructions must also be included.
+PROMOTER_MAX_INST 20 # Maximum number of instructions to execute before terminating.
PROMOTER_PROCESSIVITY 1.0 # Chance of not terminating after each cpu cycle.
PROMOTER_PROCESSIVITY_INST 1.0 # Chance of not terminating after each instruction.
PROMOTER_BG_STRENGTH 0 # Probability of positions that are not promoter
More information about the Avida-cvs
mailing list