1 /* 2 * cDeme.h 3 * Avida 4 * 5 * Copyright 1999-2011 Michigan State University. All rights reserved. 6 * 7 * 8 * This file is part of Avida. 9 * 10 * Avida is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License 11 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 12 * 13 * Avida is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public License along with Avida. 17 * If not, see <http://www.gnu.org/licenses/>. 18 * 19 */ 20 21 #ifndef cDeme_h 22 #define cDeme_h 23 24 #include <set> 25 #include <vector> 26 27 #include "cDemeCellEvent.h" 28 #include "cGermline.h" 29 #include "cPhenotype.h" 30 #include "cMerit.h" 31 #include "cDemeNetwork.h" 32 #include "tArray.h" 33 #include "tBuffer.h" 34 #include "tVector.h" 35 #include "cResourceCount.h" 36 #include "cStringList.h" 37 #include "cDoubleSum.h" 38 39 class cBioGroup; 40 class cResource; 41 class cWorld; 42 class cPopulationCell; 43 class cOrganism; 44 class cOrgMovementPredicate; 45 class cOrgMessagePredicate; 46 class cDemePredicate; 47 class cReactionResult; //@JJB** 48 class cTaskState; //@JJB** 49 50 /*! Demes are groups of cells in the population that are somehow bound together 51 as a unit. The deme object is used from within cPopulation to manage these 52 groups. */ 53 54 class cDeme 55 { 56 private: 57 cWorld* m_world; 58 int _id; //!< ID of this deme (position in cPopulation::deme_array). 59 tArray<int> cell_ids; 60 int width; //!< Width of this deme. 61 62 bool replicateDeme; 63 bool treatable; 64 std::set<int> treatment_ages; 65 66 // The following should be moved to cDemePhenotype / cPopulationPhenotype 67 int cur_birth_count; //!< Number of organisms that have been born into this deme since reset. 68 int last_birth_count; 69 int cur_org_count; //!< Number of organisms are currently in this deme. 70 int last_org_count; 71 int injected_count; //<! Number of organisms that have been injected into this deme 72 int birth_count_perslot; 73 int _age; //!< Age of this deme, in updates. 74 int generation; //!< Generation of this deme 75 double total_org_energy; //! amount of energy in organisms in this deme 76 int time_used; //!< number of cpu cycles this deme has used 77 int gestation_time; // Time used during last generation 78 double cur_normalized_time_used; // normalized by merit and number of orgs 79 double last_normalized_time_used; 80 unsigned int MSG_sendFailed; 81 unsigned int MSG_dropped; 82 unsigned int MSG_SuccessfullySent; 83 double energyInjectedIntoOrganisms; //! total amount of energy injected into seed organisms 84 double energyRemainingInDemeAtReplication; //! total amount of energy remaining in deme when deme was last replicated. 85 double total_energy_testament; //! total amount of energy from suicide organisms for offspring deme 86 int eventsTotal; 87 unsigned int eventsKilled; 88 unsigned int eventsKilledThisSlot; 89 unsigned int eventKillAttempts; 90 unsigned int eventKillAttemptsThisSlot; 91 unsigned int consecutiveSuccessfulEventPeriods; 92 int sleeping_count; //!< Number of organisms currently sleeping 93 cDoubleSum energyUsage; 94 95 double total_energy_donated; 96 double total_energy_received; 97 double total_energy_applied; 98 99 tArray<int> cur_task_exe_count; 100 tArray<int> cur_reaction_count; 101 tArray<int> last_task_exe_count; 102 tArray<int> last_reaction_count; 103 104 tArray<int> cur_org_task_count; 105 tArray<int> cur_org_task_exe_count; 106 tArray<int> cur_org_reaction_count; 107 tArray<int> last_org_task_count; 108 tArray<int> last_org_task_exe_count; 109 tArray<int> last_org_reaction_count; 110 111 double avg_founder_generation; //Average generation of current founders 112 double generations_per_lifetime; //Generations between current founders and founders of parent 113 114 // End of phenotypic traits 115 116 cGermline _germline; //!< The germline for this deme, if used. 117 118 cDeme(const cDeme&); // @not_implemented 119 120 cResourceCount deme_resource_count; //!< Resources available to the deme 121 tArray<int> energy_res_ids; //!< IDs of energy resources 122 123 tVector<cDemeCellEvent> cell_events; 124 std::vector<std::pair<int, int> > event_slot_end_points; // (slot end point, slot flow rate) 125 126 int m_germline_genotype_id; // Genotype id of germline (if in use) 127 tArray<int> m_founder_genotype_ids; // List of genotype ids used to found deme. 128 // Keep a lease on these genotypes for the deme's lifetime. 129 tArray<cPhenotype> m_founder_phenotypes; // List of phenotypes of founder organsisms 130 131 cMerit _current_merit; //!< Deme merit applied to all organisms living in this deme. 132 cMerit _next_merit; //!< Deme merit that will be inherited upon deme replication. 133 134 tVector<cDemePredicate*> deme_pred_list; // Deme Predicates 135 tVector<cOrgMessagePredicate*> message_pred_list; // Message Predicates 136 tVector<cOrgMovementPredicate*> movement_pred_list; // Movement Predicates 137 138 // For the points infrastructure 139 double points; 140 unsigned int migrations_out; 141 unsigned int migrations_in; 142 unsigned int suicides; 143 144 public: 145 //! Constructor. 146 cDeme(); 147 148 //! Destructor. 149 ~cDeme(); 150 151 cDeme& operator=(const cDeme&); //@JJB** 152 void Setup(int id, const tArray<int>& in_cells, int in_width = -1, cWorld* world = NULL); 153 GetID()154 int GetID() const { return _id; } GetSize()155 int GetSize() const { return cell_ids.GetSize(); } GetCellID(int pos)156 int GetCellID(int pos) const { return cell_ids[pos]; } 157 int GetCellID(int x, int y) const; GetDemeID()158 int GetDemeID() const { return _id; } 159 //! Returns an (x,y) pair for the position of the passed-in cell ID. 160 std::pair<int, int> GetCellPosition(int cellid) const; 161 cPopulationCell& GetCell(int pos) const; 162 cPopulationCell& GetCell(int x, int y) const; 163 cOrganism* GetOrganism(int pos) const; 164 165 std::vector<int> GetGenotypeIDs(); 166 GetWidth()167 int GetWidth() const { return width; } GetHeight()168 int GetHeight() const { return cell_ids.GetSize() / width; } 169 170 void Reset(cAvidaContext& ctx, bool resetResources = true, double deme_energy = 0.0); //! used to pass energy to offspring deme 171 void DivideReset(cAvidaContext& ctx, cDeme& parent_deme, bool resetResources = true, double deme_energy = 0.0); 172 173 //! Kills all organisms currently in this deme. 174 void KillAll(cAvidaContext& ctx); 175 176 void UpdateStats(); 177 GetBirthCount()178 int GetBirthCount() const { return cur_birth_count; } GetLastBirthCount()179 int GetLastBirthCount() const { return last_birth_count; } IncBirthCount()180 void IncBirthCount() { cur_birth_count++; birth_count_perslot++;} 181 GetOrgCount()182 int GetOrgCount() const { return cur_org_count; } GetLastOrgCount()183 int GetLastOrgCount() const { return last_org_count; } 184 GetDensity()185 double GetDensity() const { return static_cast<double>(cur_org_count) / static_cast<double>(GetSize()); } 186 int GetNumOrgsWithOpinion() const; 187 IncOrgCount()188 void IncOrgCount() { cur_org_count++; } DecOrgCount()189 void DecOrgCount() { cur_org_count--; } 190 GetSleepingCount()191 int GetSleepingCount() const { return sleeping_count; } IncSleepingCount()192 void IncSleepingCount() { sleeping_count++; } DecSleepingCount()193 void DecSleepingCount() { sleeping_count--; } 194 GetGeneration()195 int GetGeneration() const { return generation; } 196 GetInjectedCount()197 int GetInjectedCount() const { return injected_count; } IncInjectedCount()198 void IncInjectedCount() { injected_count++; } 199 IsEmpty()200 bool IsEmpty() const { return cur_org_count == 0; } IsFull()201 bool IsFull() const { return cur_org_count == cell_ids.GetSize(); } 202 TestReplication()203 bool TestReplication() const { return replicateDeme; } ReplicateDeme()204 void ReplicateDeme() { replicateDeme = true; } 205 isTreatable()206 bool isTreatable() const { return treatable; } setTreatable(bool value)207 void setTreatable(bool value) { treatable = value; } AddTreatmentAge(const int age)208 void AddTreatmentAge(const int age) { treatment_ages.insert(age); } 209 bool IsTreatableAtAge(const int age); IsTreatableNow()210 bool IsTreatableNow() { return IsTreatableAtAge(_age); } GetTreatmentAges()211 std::set<int> GetTreatmentAges() const { return treatment_ages; } 212 213 int GetSlotFlowRate() const; GetEventsTotal()214 int GetEventsTotal() const { return eventsTotal; } GetEventsKilled()215 int GetEventsKilled() const { return eventsKilled; } GetEventsKilledThisSlot()216 int GetEventsKilledThisSlot() const { return eventsKilledThisSlot;} GetEventKillAttempts()217 int GetEventKillAttempts() const { return eventKillAttempts; } GetEventKillAttemptsThisSlot()218 int GetEventKillAttemptsThisSlot() const { return eventKillAttemptsThisSlot; } GetConsecutiveSuccessfulEventPeriods()219 int GetConsecutiveSuccessfulEventPeriods() const { return consecutiveSuccessfulEventPeriods;} 220 221 // -= Germline =- 222 //! Returns this deme's germline. GetGermline()223 cGermline& GetGermline() { return _germline; } 224 //! Replaces this deme's germline. 225 void ReplaceGermline(const cGermline& germline); 226 227 //! Update this deme's merit by rotating the heritable merit to the current merit. 228 void UpdateDemeMerit(); 229 //! Update this deme's merit from the given source; merit will be applied to organisms now. 230 void UpdateDemeMerit(cDeme& source); 231 //! Update the heritable merit; will be applied to this deme and it's offspring upon replication. UpdateHeritableDemeMerit(double value)232 void UpdateHeritableDemeMerit(double value) { _next_merit = value; } 233 //! Retrieve this deme's current merit; to be applied to organisms living in this deme now. GetDemeMerit()234 const cMerit& GetDemeMerit() const { return _current_merit; } 235 //! Retrieve this deme's heritable merit. GetHeritableDemeMerit()236 const cMerit& GetHeritableDemeMerit() const { return _next_merit; } 237 238 AddCurTask(int task_num)239 void AddCurTask(int task_num) { cur_task_exe_count[task_num]++; } AddCurReaction(int reaction_num)240 void AddCurReaction (int reaction_num) { cur_reaction_count[reaction_num]++; } 241 GetCurTaskExeCount()242 const tArray<int>& GetCurTaskExeCount() const { return cur_task_exe_count; } //** GetLastTaskExeCount()243 const tArray<int>& GetLastTaskExeCount() const { return last_task_exe_count; } //** GetCurReactionCount()244 const tArray<int>& GetCurReactionCount() const { return cur_reaction_count; } //** GetLastReactionCount()245 const tArray<int>& GetLastReactionCount() const { return last_reaction_count; } //** 246 GetCurOrgTaskCount()247 const tArray<int>& GetCurOrgTaskCount() const { return cur_org_task_count; } GetLastOrgTaskCount()248 const tArray<int>& GetLastOrgTaskCount() const { return last_org_task_count; } GetCurOrgTaskExeCount()249 const tArray<int>& GetCurOrgTaskExeCount() const { return cur_org_task_exe_count; } GetLastOrgTaskExeCount()250 const tArray<int>& GetLastOrgTaskExeCount() const { return last_org_task_exe_count; } GetCurOrgReactionCount()251 const tArray<int>& GetCurOrgReactionCount() const { return cur_org_reaction_count; } GetLastOrgReactionCount()252 const tArray<int>& GetLastOrgReactionCount() const { return last_org_reaction_count; } 253 HasDemeMerit()254 bool HasDemeMerit() const { return _current_merit.GetDouble() != 1.0; } 255 256 // -= Update support =- 257 void ProcessPreUpdate(); 258 //! Called once, at the end of every update. 259 void ProcessUpdate(cAvidaContext& ctx); 260 //! Returns the age of this deme in updates, where age is defined as the number of updates since the last time Reset() was called. GetAge()261 int GetAge() const { return _age; } 262 //! Called when an organism living in a cell in this deme is about to be killed. 263 void OrganismDeath(cPopulationCell& cell); 264 GetDemeResourceCount()265 const cResourceCount& GetDemeResourceCount() const { return deme_resource_count; } GetDemeResources()266 cResourceCount& GetDemeResources() { return deme_resource_count; } SetResource(cAvidaContext & ctx,int id,double new_level)267 void SetResource(cAvidaContext& ctx, int id, double new_level) { deme_resource_count.Set(ctx, id, new_level); } 268 double GetSpatialResource(int rel_cellid, int resource_id, cAvidaContext& ctx) const; 269 void AdjustSpatialResource(cAvidaContext& ctx, int rel_cellid, int resource_id, double amount); 270 void AdjustResource(cAvidaContext& ctx, int resource_id, double amount); SetDemeResourceCount(const cResourceCount in_res)271 void SetDemeResourceCount(const cResourceCount in_res) { deme_resource_count = in_res; } ResizeSpatialGrids(const int in_x,const int in_y)272 void ResizeSpatialGrids(const int in_x, const int in_y) { deme_resource_count.ResizeSpatialGrids(in_x, in_y); } 273 void ModifyDemeResCount(cAvidaContext& ctx, const tArray<double> & res_change, const int absolute_cell_id); 274 double GetCellEnergy(int absolute_cell_id, cAvidaContext& ctx) const; 275 double GetAndClearCellEnergy(int absolute_cell_id, cAvidaContext& ctx); 276 void GiveBackCellEnergy(int absolute_cell_id, double value, cAvidaContext& ctx); 277 void SetupDemeRes(int id, cResource * res, int verbosity, cWorld* world); UpdateDemeRes(cAvidaContext & ctx)278 void UpdateDemeRes(cAvidaContext& ctx) { deme_resource_count.GetResources(ctx); } Update(double time_step)279 void Update(double time_step) { deme_resource_count.Update(time_step); } GetRelativeCellID(int absolute_cell_id)280 int GetRelativeCellID(int absolute_cell_id) const { return absolute_cell_id % GetSize(); } //!< assumes all demes are the same size GetAbsoluteCellID(int relative_cell_id)281 int GetAbsoluteCellID(int relative_cell_id) const { return relative_cell_id + (_id * GetSize()); } //!< assumes all demes are the same size 282 283 void SetCellEventGradient(int x1, int y1, int x2, int y2, int delay, int duration, bool static_pos, int time_to_live); 284 int GetNumEvents(); 285 void SetCellEvent(int x1, int y1, int x2, int y2, int delay, int duration, bool static_position, int total_events); 286 void SetCellEventSlots(int x1, int y1, int x2, int y2, int delay, int duration, 287 bool static_position, int m_total_slots, int m_total_events_per_slot_max, 288 int m_total_events_per_slot_min, int m_tolal_event_flow_levels); 289 290 bool KillCellEvent(const int eventID); GetCellEvent(const int i)291 cDemeCellEvent* GetCellEvent(const int i) { return &cell_events[i]; }; 292 293 double CalculateTotalEnergy(cAvidaContext& ctx) const; 294 double CalculateTotalInitialEnergyResources() const; GetEnergyInjectedIntoOrganisms()295 double GetEnergyInjectedIntoOrganisms() const { return energyInjectedIntoOrganisms; } SetEnergyInjectedIntoOrganisms(double energy)296 void SetEnergyInjectedIntoOrganisms(double energy) { energyInjectedIntoOrganisms = energy; } GetEnergyRemainingInDemeAtReplication()297 double GetEnergyRemainingInDemeAtReplication() const { return energyRemainingInDemeAtReplication; } SetEnergyRemainingInDemeAtReplication(double energy)298 void SetEnergyRemainingInDemeAtReplication(double energy) { energyRemainingInDemeAtReplication = energy; } GetTotalEnergyTestament()299 double GetTotalEnergyTestament() { return total_energy_testament; } IncreaseTotalEnergyTestament(double increment)300 void IncreaseTotalEnergyTestament(double increment) { total_energy_testament += increment; } 301 IncTimeUsed(double merit)302 void IncTimeUsed(double merit) 303 { time_used++; cur_normalized_time_used += 1.0/merit/(double)cur_org_count; } GetTimeUsed()304 int GetTimeUsed() { return time_used; } GetGestationTime()305 int GetGestationTime() { return gestation_time; } GetNormalizedTimeUsed()306 double GetNormalizedTimeUsed() { return cur_normalized_time_used; } GetLastNormalizedTimeUsed()307 double GetLastNormalizedTimeUsed() { return last_normalized_time_used; } 308 309 // --- Founder list management --- // 310 void ClearFounders(); 311 void AddFounder(cBioGroup* bg, cPhenotype * _in_phenotype = NULL); GetFounderGenotypeIDs()312 tArray<int>& GetFounderGenotypeIDs() { return m_founder_genotype_ids; } GetFounderPhenotypes()313 tArray<cPhenotype>& GetFounderPhenotypes() { return m_founder_phenotypes; } GetAvgFounderGeneration()314 double GetAvgFounderGeneration() { return avg_founder_generation; } 315 void UpdateGenerationsPerLifetime(double old_avg_founder_generation, tArray<cPhenotype>& new_founder_phenotypes); GetGenerationsPerLifetime()316 double GetGenerationsPerLifetime() { return generations_per_lifetime; } 317 318 // --- Germline management --- // 319 void ReplaceGermline(cBioGroup* bg); GetGermlineGenotypeID()320 int GetGermlineGenotypeID() { return m_germline_genotype_id; } 321 322 // --- Deme/Message/Movement predicates --- // 323 bool DemePredSatisfiedPreviously(); 324 bool MsgPredSatisfiedPreviously(); 325 bool MovPredSatisfiedPreviously(); 326 int GetNumDemePredicates(); 327 int GetNumMessagePredicates(); 328 int GetNumMovementPredicates(); 329 cDemePredicate* GetDemePredicate(int i); 330 cOrgMessagePredicate* GetMsgPredicate(int i); 331 cOrgMovementPredicate* GetMovPredicate(int i); 332 333 void AddDemeResourceThresholdPredicate(cString resourceName, cString comparisonOperator, double threasholdValue); 334 void AddEventReceivedCenterPred(int times); 335 void AddEventReceivedLeftSidePred(int times); 336 void AddEventMoveCenterPred(int times); 337 void AddEventMoveBetweenTargetsPred(int times); 338 void AddEventMigrateToTargetsPred(int times); 339 void AddEventEventNUniqueIndividualsMovedIntoTargetPred(int times); 340 341 // --- Messaging stats --- // MessageSuccessfullySent()342 void MessageSuccessfullySent() { ++MSG_SuccessfullySent; } messageDropped()343 void messageDropped() { ++MSG_dropped; } messageSendFailed()344 void messageSendFailed() { ++MSG_sendFailed; } GetMessageSuccessfullySent()345 unsigned int GetMessageSuccessfullySent() { return MSG_SuccessfullySent; } GetMessageDropped()346 unsigned int GetMessageDropped() { return MSG_dropped; } GetMessageSendFailed()347 unsigned int GetMessageSendFailed() { return MSG_sendFailed; } 348 349 // --- Pheromones --- // 350 void AddPheromone(int absolute_cell_id, double value, cAvidaContext& ctx); 351 352 // --- Points --- // GetNumberOfPoints()353 double GetNumberOfPoints() { return points; } AddNumberOfPoints(double num_points)354 void AddNumberOfPoints(double num_points) { points += num_points; } SubtractNumberOfPoints(double num_points)355 void SubtractNumberOfPoints(double num_points) { if (num_points > points) points = 0; } GetMigrationsOut()356 int GetMigrationsOut() { return migrations_out; } GetMigrationsIn()357 int GetMigrationsIn() { return migrations_in; } GetSuicides()358 int GetSuicides() { return suicides; } AddMigrationOut()359 void AddMigrationOut() { migrations_out++; } AddMigrationIn()360 void AddMigrationIn() { migrations_in++; } AddSuicide()361 void AddSuicide() { suicides++; } ClearMigrationOut()362 void ClearMigrationOut() { migrations_out = 0; } ClearMigrationIn()363 void ClearMigrationIn() { migrations_in = 0; } ClearSuicides()364 void ClearSuicides() { suicides = 0; } 365 366 // --- Energy Sharing --- // GetEnergyDonated()367 double GetEnergyDonated() const { return total_energy_donated; } GetEnergyReceived()368 double GetEnergyReceived() const { return total_energy_received; } GetEnergyApplied()369 double GetEnergyApplied() const { return total_energy_applied; } IncreaseEnergyDonated(double amount)370 void IncreaseEnergyDonated(double amount) { assert(amount >=0); total_energy_donated += amount; } IncreaseEnergyReceived(double amount)371 void IncreaseEnergyReceived(double amount) { assert(amount >=0); total_energy_received += amount; } IncreaseEnergyApplied(double amount)372 void IncreaseEnergyApplied(double amount) { assert(amount >=0); total_energy_applied += amount; } 373 374 // -= Network creation support =- 375 private: 376 //! Lazily-initialized pointer to the network creation support struct. 377 cDemeNetwork* m_network; 378 379 //! Initialize network creation support. InitNetworkCreation()380 inline void InitNetworkCreation() { if(!m_network) m_network = cDemeNetwork::DemeNetworkFactory(m_world, *this); } 381 //! Test for initialization of the network. IsNetworkInitialized()382 inline bool IsNetworkInitialized() { return m_network != 0; } 383 public: 384 //! Retrieve this deme's network. 385 cDemeNetwork& GetNetwork(); 386 387 // -------- Deme Input and Output -------- @JJB** 388 private: 389 int m_input_pointer; 390 tArray<int> m_inputs; 391 tBuffer<int> m_input_buf; 392 tBuffer<int> m_output_buf; 393 tHashMap<void*, cTaskState*> m_task_states; 394 cReactionResult* m_reaction_result; 395 tArray<int> m_task_count; // Total times each task was performed (resetable during the life of the deme) 396 tArray<int> m_last_task_count; 397 tArray<int> m_reaction_count; 398 tArray<double> m_cur_reaction_add_reward; 399 double m_cur_bonus; 400 cMerit m_cur_merit; 401 public: HasDoneInput()402 bool HasDoneInput() { return (m_input_buf.GetNumStored() > 0); } HasDoneOutput()403 bool HasDoneOutput() { return (m_input_buf.GetNumStored() > 0); } 404 void ResetInputs(cAvidaContext& ctx); ResetInput()405 void ResetInput() { m_input_pointer = 0; m_input_buf.Clear(); } 406 int GetNextDemeInput(cAvidaContext& ctx); 407 void DoDemeInput(int value); 408 void DoDemeOutput(cAvidaContext& ctx, int value); GetCurBonus()409 double GetCurBonus() const { return m_cur_bonus; } ResetMeritBonus()410 void ResetMeritBonus() { m_cur_bonus = m_world->GetConfig().DEFAULT_BONUS.Get(); } GetCurMerit()411 const cMerit& GetCurMerit() { return m_cur_merit; } 412 void UpdateCurMerit(); 413 cMerit CalcCurMerit(); GetTaskCount()414 const tArray<int>& GetTaskCount() const { return m_task_count; } GetReactionCount()415 const tArray<int>& GetReactionCount() const { return m_reaction_count; } 416 417 418 // --- Division of Labor --- // 419 public: 420 int MinNumTimesReactionPerformed(); IncNumSwitchingPenalties(int pen_count)421 void IncNumSwitchingPenalties(int pen_count) { m_switch_penalties += pen_count; } GetNumSwitchingPenalties()422 int GetNumSwitchingPenalties() { return m_switch_penalties; } 423 double GetShannonMutualInformation(); 424 double GetNumOrgsPerformedReaction(); 425 double GetTotalResourceAmountConsumed() const; AddResourcesConsumed(double amt)426 void AddResourcesConsumed(double amt){ m_total_res_consumed += amt; } 427 void UpdateShannon(cPopulationCell& cell); 428 void UpdateShannonAll(); 429 double GetPercentReproductives(); 430 void ClearShannonInformationStats(); 431 std::pair<double, double> GetAveVarGermMut(); 432 std::pair<double, double> GetAveVarSomaMut(); 433 std::pair<double, double> GetGermlineNumPercent(); 434 std::pair<double, double> GetAveVarGermWorkLoad(); 435 std::pair<double, double> GetAveVarSomaWorkLoad(); 436 std::pair<double, double> GetAveVarWorkLoad(); 437 ClearTotalResourceAmountConsumed()438 void ClearTotalResourceAmountConsumed() {m_total_res_consumed = 0;} 439 440 private: 441 double m_total_res_consumed; //! Amount of resources consumed by deme. 442 //! get total amount of resources used 443 int m_switch_penalties; //! number of task switching penalties accumulated 444 std::vector< std::vector<double> > m_shannon_matrix; 445 int m_num_active; // number of active organisms in the lifetime of the deme 446 int m_num_reproductives; // number of organisms that reproduced during the lifetime of the deme 447 448 449 }; 450 451 #endif 452