Skip to content

Commit

Permalink
Merge branch 'mabe-systematics' into sum-distance-sys
Browse files Browse the repository at this point in the history
  • Loading branch information
emilydolson authored Feb 29, 2024
2 parents 8f10adf + 1e542a3 commit 1b323cf
Show file tree
Hide file tree
Showing 5 changed files with 423 additions and 295 deletions.
4 changes: 2 additions & 2 deletions include/emp/Evolve/Systematics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2177,7 +2177,7 @@ namespace emp {
} else{

emp::File generation_percentiles(filename); //opens file
emp::vector< emp::vector<double> >percentile_data = generation_percentiles.ToData<double>(','); //turns file contents into vector
emp::vector< emp::vector<double> >percentile_data = generation_percentiles.ToData<double>(","); //turns file contents into vector

for(int j = 0; j <= percentile_data[gen_value].size() - 2; j++){ //searches through vector for slot where phylo diversity fits

Expand Down Expand Up @@ -2222,7 +2222,7 @@ namespace emp {

// Load files
emp::File in_file(file_path);
emp::vector<std::string> header = in_file.ExtractRow();
emp::vector<emp::String> header = in_file.ExtractRow();

// Find column ids
auto id_pos_it = std::find(header.begin(), header.end(), "id");
Expand Down
20 changes: 12 additions & 8 deletions include/emp/Evolve/World.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,7 @@ namespace emp {

};

#ifndef DOXYGEN_SHOULD_SKIP_THIS
// =============================================================
// === ===
// === Out-of-class member function definitions from above ===
Expand Down Expand Up @@ -972,7 +973,7 @@ namespace emp {

// Track the new systematics info
for (Ptr<SystematicsBase<ORG> > s : systematics) {
s->AddOrg(*new_org, pos, (int) update);
s->AddOrg(*new_org, pos);
}

SetupOrg(*new_org, pos, *random_ptr);
Expand All @@ -996,7 +997,7 @@ namespace emp {
}

for (Ptr<SystematicsBase<ORG> > s : systematics) {
s->RemoveOrgAfterRepro(pos, update); // Notify systematics about organism removal
s->RemoveOrgAfterRepro(pos); // Notify systematics about organism removal
}

}
Expand Down Expand Up @@ -1489,6 +1490,13 @@ namespace emp {
pop.resize(0);
std::swap(pops[0], pops[1]); // Move next pop into place.

// Tell systematics manager to swap next population and population
// Needs to happen here so that you can refer to systematics in
// OnPlacement functions
for (Ptr<SystematicsBase<ORG>> s : systematics) {
s->Update();
}

// Update the active population.
num_orgs = 0;
for (size_t i = 0; i < pop.size(); i++) {
Expand All @@ -1498,12 +1506,7 @@ namespace emp {
}
}

// 3. Handle systematics and any data files that need to be printed this update.

// Tell systematics manager to swap next population and population
for (Ptr<SystematicsBase<ORG>> s : systematics) {
s->Update();
}
// 3. Handle any data files that need to be printed this update.

for (auto file : files) file->Update(update);

Expand Down Expand Up @@ -1734,6 +1737,7 @@ namespace emp {
os << std::endl;
}
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
}

#endif // #ifndef EMP_EVOLVE_WORLD_HPP_INCLUDE
Loading

0 comments on commit 1b323cf

Please sign in to comment.