[Avida-SVN] r2269 - development/source/main
barrick at myxo.css.msu.edu
barrick at myxo.css.msu.edu
Wed Jan 23 15:55:17 PST 2008
Author: barrick
Date: 2008-01-23 18:55:16 -0500 (Wed, 23 Jan 2008)
New Revision: 2269
Modified:
development/source/main/cAvidaConfig.h
development/source/main/cPhenotype.cc
Log:
Tweaks to an experimental FITNESS_METHOD for converting bonus to fitness that is similar to a substrate-enzyme saturation curve
Modified: development/source/main/cAvidaConfig.h
===================================================================
--- development/source/main/cAvidaConfig.h 2008-01-22 20:55:56 UTC (rev 2268)
+++ development/source/main/cAvidaConfig.h 2008-01-23 23:55:16 UTC (rev 2269)
@@ -381,8 +381,9 @@
CONFIG_ADD_VAR(MERIT_DEFAULT_BONUS, int, 0, "Scale the merit of an offspring by this default bonus\nrather than the accumulated bonus of the parent? 0 = off");
CONFIG_ADD_VAR(MERIT_BONUS_INST, int, 0, "in BASE_MERIT_METHOD 6, this sets which instruction counts\n(-1 = none, 0 = First in INST_SET.)");
CONFIG_ADD_VAR(MERIT_BONUS_EFFECT, int, 0, "in BASE_MERIT_METHOD 6, this sets how much merit is earned\nper instruction (-1 = penalty, 0 = no effect.)");
- CONFIG_ADD_VAR(FITNESS_METHOD, int, 0, "0 = default, >1 = experimental");
- CONFIG_ADD_VAR(FITNESS_COEFF, double, 1.0, "A FITNESS_METHOD parameter");
+ CONFIG_ADD_VAR(FITNESS_METHOD, int, 0, "0 = default, >=1 = experimental");
+ CONFIG_ADD_VAR(FITNESS_COEFF_1, double, 1.0, "1st FITNESS_METHOD parameter");
+ CONFIG_ADD_VAR(FITNESS_COEFF_2, double, 1.0, "2nd FITNESS_METHOD parameter");
CONFIG_ADD_VAR(FITNESS_VALLEY, int, 0, "in BASE_MERIT_METHOD 6, this creates valleys from\nFITNESS_VALLEY_START to FITNESS_VALLEY_STOP\n(0 = off, 1 = on)");
CONFIG_ADD_VAR(FITNESS_VALLEY_START, int, 0, "if FITNESS_VALLEY = 1, orgs with num_key_instructions\nfrom FITNESS_VALLEY_START to FITNESS_VALLEY_STOP\nget fitness 1 (lowest)");
CONFIG_ADD_VAR(FITNESS_VALLEY_STOP, int, 0, "if FITNESS_VALLEY = 1, orgs with num_key_instructions\nfrom FITNESS_VALLEY_START to FITNESS_VALLEY_STOP\nget fitness 1 (lowest)");
Modified: development/source/main/cPhenotype.cc
===================================================================
--- development/source/main/cPhenotype.cc 2008-01-22 20:55:56 UTC (rev 2268)
+++ development/source/main/cPhenotype.cc 2008-01-23 23:55:16 UTC (rev 2269)
@@ -1324,11 +1324,21 @@
out_fitness = _merit_base * _bonus / _gestation_time;
break;
- case 1: //Activity of one enzyme in pathway altered (with diminishing returns and a cost for each executed instruction)
+ case 1: // Sigmoidal returns (should be used with an additive reward)
{
+ assert(_gestation_time > 0);
out_fitness = 0;
+ //Note: this operates on accumulated bonus and ignores the default bonus.
+ double converted_bonus = (_bonus - m_world->GetConfig().DEFAULT_BONUS.Get()) * m_world->GetConfig().FITNESS_COEFF_2.Get() / (1 + _bonus * m_world->GetConfig().FITNESS_COEFF_2.Get() ) ;
+ out_fitness = _merit_base * exp(converted_bonus * log(m_world->GetConfig().FITNESS_COEFF_1.Get())) / _gestation_time;
+ }
+ break;
+
+ case 2: //Activity of one enzyme in pathway altered (with diminishing returns and a cost for each executed instruction)
+ {
+ out_fitness = 0;
double net_bonus = _bonus + - m_world->GetConfig().DEFAULT_BONUS.Get();
- out_fitness = net_bonus / (net_bonus + 1)* exp (_gestation_time * log(1 - m_world->GetConfig().FITNESS_COEFF.Get()));
+ out_fitness = net_bonus / (net_bonus + 1)* exp (_gestation_time * log(1 - m_world->GetConfig().FITNESS_COEFF_1.Get()));
}
break;
More information about the Avida-cvs
mailing list