[Avida-SVN] r1057 - in development: Avida.xcodeproj source/main
barrick at myxo.css.msu.edu
barrick at myxo.css.msu.edu
Fri Oct 20 12:27:30 PDT 2006
Author: barrick
Date: 2006-10-20 15:27:30 -0400 (Fri, 20 Oct 2006)
New Revision: 1057
Modified:
development/Avida.xcodeproj/project.pbxproj
development/source/main/cAvidaConfig.h
development/source/main/cOrganism.cc
development/source/main/cPhenotype.cc
Log:
Added two new config options. REQUIRED_BONUS to divide. MERIT_DEFAULT_BONUS so that achild's merit can be set to not depend on accumulated bonus.
Modified: development/Avida.xcodeproj/project.pbxproj
===================================================================
--- development/Avida.xcodeproj/project.pbxproj 2006-10-19 21:52:05 UTC (rev 1056)
+++ development/Avida.xcodeproj/project.pbxproj 2006-10-20 19:27:30 UTC (rev 1057)
@@ -7,6 +7,12 @@
objects = {
/* Begin PBXBuildFile section */
+ 1097463F0AE9606E00929ED6 /* cDeme.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1097463D0AE9606E00929ED6 /* cDeme.cc */; };
+ 109746400AE9606E00929ED6 /* cDeme.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1097463E0AE9606E00929ED6 /* cDeme.h */; };
+ 109746410AE9606E00929ED6 /* cDeme.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1097463D0AE9606E00929ED6 /* cDeme.cc */; };
+ 109746420AE9606E00929ED6 /* cDeme.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1097463E0AE9606E00929ED6 /* cDeme.h */; };
+ 109746430AE9606E00929ED6 /* cDeme.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1097463D0AE9606E00929ED6 /* cDeme.cc */; };
+ 109746440AE9606E00929ED6 /* cDeme.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1097463E0AE9606E00929ED6 /* cDeme.h */; };
7005A70409BA0FA90007E16E /* cTestCPUInterface.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7005A70209BA0FA90007E16E /* cTestCPUInterface.cc */; };
7005A70609BA0FA90007E16E /* cTestCPUInterface.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7005A70209BA0FA90007E16E /* cTestCPUInterface.cc */; };
7005A70809BA0FA90007E16E /* cTestCPUInterface.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7005A70209BA0FA90007E16E /* cTestCPUInterface.cc */; };
@@ -398,6 +404,7 @@
dstSubfolderSpec = 16;
files = (
700E2B87085DE54400CF158A /* avida-viewer in CopyFiles */,
+ 109746440AE9606E00929ED6 /* cDeme.h in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -420,6 +427,7 @@
7049F3710A66AD7E00640512 /* default-sex-classic.org in CopyFiles */,
7049F3720A66AD7E00640512 /* default-smt.org in CopyFiles */,
7049F3730A66AD7E00640512 /* default-transsmt.org in CopyFiles */,
+ 109746400AE9606E00929ED6 /* cDeme.h in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -430,12 +438,15 @@
dstSubfolderSpec = 16;
files = (
702F532F0993060A00B2B507 /* avida-s in CopyFiles */,
+ 109746420AE9606E00929ED6 /* cDeme.h in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
+ 1097463D0AE9606E00929ED6 /* cDeme.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cDeme.cc; sourceTree = "<group>"; };
+ 1097463E0AE9606E00929ED6 /* cDeme.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cDeme.h; sourceTree = "<group>"; };
7005A70109BA0FA90007E16E /* cTestCPUInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cTestCPUInterface.h; sourceTree = "<group>"; };
7005A70209BA0FA90007E16E /* cTestCPUInterface.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cTestCPUInterface.cc; sourceTree = "<group>"; };
7005A70909BA0FBE0007E16E /* cOrgInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cOrgInterface.h; sourceTree = "<group>"; };
@@ -940,7 +951,7 @@
DCC315CF076253A5008F7A48 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
DCC315D0076253A5008F7A48 /* task_event_gen.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = task_event_gen.cc; sourceTree = "<group>"; };
DCC315D1076253A5008F7A48 /* task_event_gen.old.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = task_event_gen.old.cc; sourceTree = "<group>"; };
- DCC3164D07626CF3008F7A48 /* avida */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = avida; sourceTree = BUILT_PRODUCTS_DIR; };
+ DCC3164D07626CF3008F7A48 /* avida */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "compiled.mach-o.executable"; path = avida; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -1403,6 +1414,8 @@
7013845F09028B3E0087ED2E /* cAvidaConfig.h */,
702D4F3F08DA61FE007BA469 /* cBirthChamber.cc */,
702D4F3908DA61E2007BA469 /* cBirthChamber.h */,
+ 1097463D0AE9606E00929ED6 /* cDeme.cc */,
+ 1097463E0AE9606E00929ED6 /* cDeme.h */,
702D4EFC08DA5341007BA469 /* cEnvironment.cc */,
702D4EF508DA5328007BA469 /* cEnvironment.h */,
70CA6EB208DB7F8200068AC2 /* cFitnessMatrix.cc */,
@@ -1995,6 +2008,7 @@
708BF3000AB65DC700A923BF /* cEventList.cc in Sources */,
70BCB2350AB7B26B003FF331 /* cArgContainer.cc in Sources */,
703D4D700ABA374A0032C8A0 /* cArgSchema.cc in Sources */,
+ 109746430AE9606E00929ED6 /* cDeme.cc in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2126,6 +2140,7 @@
708BF2FF0AB65DC700A923BF /* cEventList.cc in Sources */,
703D4D6F0ABA374A0032C8A0 /* cArgSchema.cc in Sources */,
703D4E2E0ABCAC4A0032C8A0 /* cArgContainer.cc in Sources */,
+ 109746410AE9606E00929ED6 /* cDeme.cc in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2238,6 +2253,7 @@
708BF2FE0AB65DC700A923BF /* cEventList.cc in Sources */,
70BCB22E0AB7B23D003FF331 /* cArgContainer.cc in Sources */,
703D4D6E0ABA374A0032C8A0 /* cArgSchema.cc in Sources */,
+ 1097463F0AE9606E00929ED6 /* cDeme.cc in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: development/source/main/cAvidaConfig.h
===================================================================
--- development/source/main/cAvidaConfig.h 2006-10-19 21:52:05 UTC (rev 1056)
+++ development/source/main/cAvidaConfig.h 2006-10-20 19:27:30 UTC (rev 1057)
@@ -200,7 +200,8 @@
CONFIG_ADD_VAR(REQUIRED_TASK, int, -1, "Task ID required for successful divide.");
CONFIG_ADD_VAR(IMMUNITY_TASK, int, -1, "Task providing immunity from the required task.");
CONFIG_ADD_VAR(REQUIRED_REACTION, int, -1, "Reaction ID required for successful divide.");
-
+ CONFIG_ADD_VAR(REQUIRED_BONUS, int, 0, "The bonus that an organism must accumulate to divide.");
+
CONFIG_ADD_GROUP(MUTATION_GROUP, "Mutations");
CONFIG_ADD_VAR(POINT_MUT_PROB, double, 0.0, "Mutation rate (per-location per update)");
CONFIG_ADD_VAR(COPY_MUT_PROB, double, 0.0075, "Mutation rate (per copy)");
@@ -238,6 +239,7 @@
CONFIG_ADD_VAR(MAX_LABEL_EXE_SIZE, int, 1, "Max nops marked as executed when labels are used");
CONFIG_ADD_VAR(BASE_SIZE_MERIT, int, 100, "Base merit when size is *not* used");
CONFIG_ADD_VAR(DEFAULT_BONUS, double, 1.0, "The bonus an organism gets before any tasks");
+ CONFIG_ADD_VAR(MERIT_DEFAULT_BONUS, int, 0, "Scale the merit of an offspring by the default bonus\nrather than the accumulated bonus of the parent?");
CONFIG_ADD_VAR(MERIT_GIVEN, double, 0.0, "Fraction of merit donated with 'donate' command");
CONFIG_ADD_VAR(MERIT_RECEIVED, double, 0.0, "Multiplier of merit given with 'donate' command");
CONFIG_ADD_VAR(MAX_DONATE_KIN_DIST, int, -1, "Limit on distance of relation for donate; -1=no max");
Modified: development/source/main/cOrganism.cc
===================================================================
--- development/source/main/cOrganism.cc 2006-10-19 21:52:05 UTC (rev 1056)
+++ development/source/main/cOrganism.cc 2006-10-20 19:27:30 UTC (rev 1057)
@@ -473,6 +473,14 @@
cStringUtil::Stringf("Lacks required reaction (%d)", required_reaction));
return false; // (divide fails)
}
+
+ // Make sure that an organism has accumulated any required bonus
+ const int bonus_required = m_world->GetConfig().REQUIRED_BONUS.Get();
+ if (phenotype.GetCurBonus() < bonus_required) {
+ Fault(FAULT_LOC_DIVIDE, FAULT_TYPE_ERROR,
+ cStringUtil::Stringf("Lacks required bonus to divide (has %d, needs %d)", phenotype.GetCurBonus(), bonus_required));
+ return false; // (divide fails)
+ }
// Make sure the parent is fertile
if ( phenotype.IsFertile() == false ) {
Modified: development/source/main/cPhenotype.cc
===================================================================
--- development/source/main/cPhenotype.cc 2006-10-19 21:52:05 UTC (rev 1056)
+++ development/source/main/cPhenotype.cc 2006-10-20 19:27:30 UTC (rev 1057)
@@ -249,8 +249,19 @@
// Update these values as needed...
int cur_merit_base = CalcSizeMerit();
- merit = cur_merit_base * cur_bonus;
-
+
+ // If we are resetting the current merit, do it here
+ // and it will also be propagated to the child
+ const int merit_default_bonus = m_world->GetConfig().MERIT_DEFAULT_BONUS.Get();
+ if (merit_default_bonus)
+ {
+ merit = cur_merit_base * m_world->GetConfig().DEFAULT_BONUS.Get();
+ }
+ else // Default
+ {
+ merit = cur_merit_base * cur_bonus;
+ }
+
genome_length = _length;
(void) copied_size; // Unchanged
(void) executed_size; // Unchanged
More information about the Avida-cvs
mailing list