[Avida-SVN] r1916 - in branches/energy: Avida.xcodeproj source/cpu source/main
beckma24 at myxo.css.msu.edu
beckma24 at myxo.css.msu.edu
Thu Aug 9 11:03:45 PDT 2007
Author: beckma24
Date: 2007-08-09 14:03:45 -0400 (Thu, 09 Aug 2007)
New Revision: 1916
Modified:
branches/energy/Avida.xcodeproj/project.pbxproj
branches/energy/source/cpu/cHardwareCPU.cc
branches/energy/source/main/cPhenotype.cc
branches/energy/source/main/cPhenotype.h
Log:
Added executionRatio placeholder. Fixed organism clone bug. Removed invalid energy_deme_level_res
Modified: branches/energy/Avida.xcodeproj/project.pbxproj
===================================================================
--- branches/energy/Avida.xcodeproj/project.pbxproj 2007-08-09 16:52:51 UTC (rev 1915)
+++ branches/energy/Avida.xcodeproj/project.pbxproj 2007-08-09 18:03:45 UTC (rev 1916)
@@ -211,6 +211,23 @@
};
/* End PBXBuildRule section */
+/* Begin PBXBuildStyle section */
+ B5029AA90C6B83D600D10480 /* Development */ = {
+ isa = PBXBuildStyle;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ };
+ name = Development;
+ };
+ B5029AAA0C6B83D600D10480 /* Deployment */ = {
+ isa = PBXBuildStyle;
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ };
+ name = Deployment;
+ };
+/* End PBXBuildStyle section */
+
/* Begin PBXContainerItemProxy section */
56F555DA0C3B36FC00E2E929 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
@@ -1771,6 +1788,12 @@
DCC30C4D0762532C008F7A48 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 702442D70859E0B00059BD9B /* Build configuration list for PBXProject "Avida" */;
+ buildSettings = {
+ };
+ buildStyles = (
+ B5029AA90C6B83D600D10480 /* Development */,
+ B5029AAA0C6B83D600D10480 /* Deployment */,
+ );
hasScannedForEncodings = 0;
mainGroup = DCC30C490762532C008F7A48;
productRefGroup = DCC3164E07626CF3008F7A48 /* Products */;
Modified: branches/energy/source/cpu/cHardwareCPU.cc
===================================================================
--- branches/energy/source/cpu/cHardwareCPU.cc 2007-08-09 16:52:51 UTC (rev 1915)
+++ branches/energy/source/cpu/cHardwareCPU.cc 2007-08-09 18:03:45 UTC (rev 1916)
@@ -4117,7 +4117,8 @@
if(m_world->GetConfig().APPLY_ENERGY_METHOD.Get() == 2) {
organism->GetPhenotype().RefreshEnergy();
organism->GetPhenotype().ApplyToEnergyStore();
- pop.UpdateMerit(organism->GetCellID(), cMerit::EnergyToMerit(organism->GetPhenotype().GetStoredEnergy(), m_world));
+ double newMerit = cMerit::EnergyToMerit(organism->GetPhenotype().GetStoredEnergy(), m_world);
+ pop.UpdateMerit(organism->GetCellID(), newMerit);
}
return true;
}
Modified: branches/energy/source/main/cPhenotype.cc
===================================================================
--- branches/energy/source/main/cPhenotype.cc 2007-08-09 16:52:51 UTC (rev 1915)
+++ branches/energy/source/main/cPhenotype.cc 2007-08-09 18:03:45 UTC (rev 1916)
@@ -86,9 +86,10 @@
// 1. These are values calculated at the last divide (of self or offspring)
- merit = in_phen.merit;
+ merit = in_phen.merit;
+ executionRatio = in_phen.executionRatio;
energy_store = in_phen.energy_store;
- energy_tobe_applied = in_phen.energy_tobe_applied;
+ energy_tobe_applied = in_phen.energy_tobe_applied;
genome_length = in_phen.genome_length;
bonus_instruction_count = in_phen.bonus_instruction_count;
copied_size = in_phen.copied_size;
@@ -262,6 +263,7 @@
{
// Copy divide values from parent, which should already be setup.
merit = parent_phenotype.merit;
+ executionRatio = 1.0;
energy_store = min(energy_store, (double) m_world->GetConfig().ENERGY_CAP.Get());
energy_tobe_applied = 0.0;
genome_length = _genome.GetSize();
@@ -411,6 +413,7 @@
executed_size = genome_length;
energy_store = min(m_world->GetConfig().ENERGY_GIVEN_ON_INJECT.Get(), m_world->GetConfig().ENERGY_CAP.Get());
energy_tobe_applied = 0.0;
+ executionRatio = 1.0;
gestation_time = 0;
gestation_start = 0;
fitness = 0;
@@ -813,6 +816,12 @@
{
// Copy divide values from parent, which should already be setup.
merit = clone_phenotype.merit;
+
+ energy_store = clone_phenotype.energy_store;
+ energy_tobe_applied = 0.0;
+ executionRatio = 1.0;
+
+ executionRatio = clone_phenotype.executionRatio;
genome_length = clone_phenotype.genome_length;
copied_size = clone_phenotype.copied_size;
// copied_size = clone_phenotype.child_copied_size;
@@ -1414,7 +1423,7 @@
ReduceEnergy(child_energy - 2*energy_given_at_birth); // 2*energy_given_at_birth: 1 in child_energy & 1 for parent
//TODO: add energy_given_at_birth to Stored_energy
- cMerit parentMerit = cMerit(min(cMerit::EnergyToMerit(GetStoredEnergy(), m_world), energy_cap));
+ cMerit parentMerit = cMerit(cMerit::EnergyToMerit(GetStoredEnergy(), m_world));
SetMerit(parentMerit);
/* if(m_world->GetConfig().ENERGY_VERBOSE.Get()) {
Modified: branches/energy/source/main/cPhenotype.h
===================================================================
--- branches/energy/source/main/cPhenotype.h 2007-08-09 16:52:51 UTC (rev 1915)
+++ branches/energy/source/main/cPhenotype.h 2007-08-09 18:03:45 UTC (rev 1916)
@@ -93,6 +93,7 @@
// 1. These are values calculated at the last divide (of self or offspring)
cMerit merit; // Relative speed of CPU
+ double executionRatio; // ratio of current execution merit over base execution merit
double energy_store; // Amount of energy. Determines relative speed of CPU when turned on.
double energy_tobe_applied; //Energy that has not yet been added to energy store.
int genome_length; // Number of instructions in genome.
@@ -277,6 +278,7 @@
///////////////////// Accessors -- Retrieving ////////////////////
const cMerit & GetMerit() const { assert(initialized == true); return merit; }
+ double GetExecutionRatio() const { assert(initialized == true); return executionRatio; }
int GetGenomeLength() const { assert(initialized == true); return genome_length; }
int GetCopiedSize() const { assert(initialized == true); return copied_size; }
int GetExecutedSize() const { assert(initialized == true); return executed_size; }
@@ -463,6 +465,8 @@
bool& ChildFertile() { assert(initialized == true); return child_fertile; }
bool& IsMultiThread() { assert(initialized == true); return is_multi_thread; }
+ void DoubleExecutionSpeed() { executionRatio *= 2.0; }
+ void HalfExecutionSpeed() { executionRatio *= 0.5; }
void RefreshEnergy();
void ApplyToEnergyStore();
double ExtractParentEnergy();
More information about the Avida-cvs
mailing list