Skip to content

Commit

Permalink
Merge branch 'master' into submodule-emp
Browse files Browse the repository at this point in the history
  • Loading branch information
mmore500 authored Feb 13, 2024
2 parents cdffaf1 + b53e0c5 commit ca8f2db
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 16 deletions.
10 changes: 5 additions & 5 deletions avida-core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,18 @@ SET(LIBRARY_OUTPUT_PATH
# ------------------------------------------------------------------------------
IF(UNIX)
IF (CMAKE_CXX_COMPILER MATCHES ".*pathCC.*")
SET(COMPILER_WARNING_FLAGS "-std=c++14")
SET(COMPILER_WARNING_FLAGS "-std=c++20")
SET(COMPILER_OPTIMIZATION_FLAGS "-funroll-loops -fstrict-aliasing -OPT:Olimit=0")
ELSE (CMAKE_CXX_COMPILER MATCHES ".*pathCC.*")
IF (CMAKE_CXX_COMPILER MATCHES ".*icpc.*")
SET(COMPILER_WARNING_FLAGS "-std=c++14")
SET(COMPILER_WARNING_FLAGS "-std=c++20")
SET(COMPILER_OPTIMIZATION_FLAGS "-funroll-loops -mp1 -pc64")
ELSE (CMAKE_CXX_COMPILER MATCHES ".*icpc.*")
IF (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*")
SET(COMPILER_WARNING_FLAGS "-Wextra -Wno-unused-parameter -Wno-unknown-pragmas -Wno-trigraphs -Wno-expansion-to-defined -std=c++20")
SET(COMPILER_WARNING_FLAGS "-Wextra -Wno-unused-parameter -Wno-unknown-pragmas -Wno-trigraphs -std=c++20")
SET(COMPILER_OPTIMIZATION_FLAGS "-funroll-loops -fstrict-aliasing -fvisibility-inlines-hidden")
ELSE (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*")
SET(COMPILER_WARNING_FLAGS "-Wextra -Wno-unused-parameter -Wno-unknown-pragmas -Wno-trigraphs -Wno-expansion-to-defined -std=c++20")
SET(COMPILER_WARNING_FLAGS "-Wextra -Wno-unused-parameter -Wno-unknown-pragmas -Wno-trigraphs -std=c++20")
SET(COMPILER_OPTIMIZATION_FLAGS "-funroll-loops -fstrict-aliasing -ftree-vectorize -fvisibility-inlines-hidden")
ENDIF (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*")
ENDIF (CMAKE_CXX_COMPILER MATCHES ".*icpc.*")
Expand Down Expand Up @@ -618,4 +618,4 @@ SET(CFG_FILES
${CFG_FILES_DIR}/default-heads-sex.org
${CFG_FILES_DIR}/default-transsmt.org
)
INSTALL_FILES(/work FILES ${CFG_FILES})
INSTALL_FILES(/work FILES ${CFG_FILES})
2 changes: 1 addition & 1 deletion avida-core/source/actions/PrintActions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ class cActionPrintInstructionAbundanceHistogram : public cAction
const int num_cells = population.GetSize();
for (int x = 0; x < num_cells; x++) {
cPopulationCell& cell = population.GetCell(x);
if (cell.IsOccupied() && cell.GetOrganism()->GetGenome().Properties().Get("instset").StringValue() == is.GetInstSetName()) {
if (cell.IsOccupied() && cell.GetOrganism()->GetGenome().Properties().Get("instset").StringValue()) {
// access this CPU's code block
cCPUMemory& cpu_mem = cell.GetOrganism()->GetHardware().GetMemory();
const int mem_size = cpu_mem.GetSize();
Expand Down
2 changes: 1 addition & 1 deletion avida-core/source/main/cPopulation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4953,7 +4953,7 @@ void cPopulation::PrintDemeInstructions()
for (int i = 0; i < cur_deme.GetSize(); i++) {
int cur_cell = cur_deme.GetCellID(i);
if (!cell_array[cur_cell].IsOccupied()) continue;
if (cell_array[cur_cell].GetOrganism()->GetGenome().Properties().Get(s_prop_id_instset).StringValue() != inst_set) continue;
if (!cell_array[cur_cell].GetOrganism()->GetGenome().Properties().Get(s_prop_id_instset).StringValue()) continue;
cPhenotype& phenotype = GetCell(cur_cell).GetOrganism()->GetPhenotype();

for (int j = 0; j < num_inst; j++) single_deme_inst[j].Add(phenotype.GetLastInstCount()[j]);
Expand Down
39 changes: 30 additions & 9 deletions avida-core/source/main/cWorld.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ cWorld::cWorld(cAvidaConfig* cfg, const cString& wd)
};

eval_fun = [this](emp::Ptr<taxon_t> tax){
// std::cout << "evaluating" << tax << std::endl;

Avida::Genome gen(curr_genome.HardwareType(), curr_genome.Properties(), GeneticRepresentationPtr(new InstructionSequence(tax->GetInfo())));
// cAnalyzeGenotype genotype(this, gen);
Expand Down Expand Up @@ -264,13 +265,13 @@ bool cWorld::setup(World* new_world, cUserFeedback* feedback, const Apto::Map<Ap
}
return ss.str();
};

// std::cout << "About to make sys" << std::endl;
systematics_manager.New([](const Avida::InstructionSequence & seq){return Avida::InstructionSequence(seq);});
// systematics_manager->PrintStatus();
systematics_manager->PrintStatus();
systematics_manager->AddSnapshotFun([](const taxon_t & tax) {
return emp::to_string(tax.GetInfo().AsString().GetCString());
}, "sequence", "Avida instruction sequence for this taxon.");

// std::cout << "Make OEE" <<std::endl;
OEE_stats.New(systematics_manager, skel_fun, [null_inst](const std::string & org){return org.size();}, false, m_conf->WORLD_X.Get() * m_conf->WORLD_Y.Get() * 200000);
OEE_stats->SetGenerationInterval(m_conf->FILTER_TIME.Get());
OEE_stats->SetResolution(m_conf->OEE_RES.Get());
Expand All @@ -282,27 +283,47 @@ bool cWorld::setup(World* new_world, cUserFeedback* feedback, const Apto::Map<Ap
// }
systematics_manager->SetNextParent(pos);});
OnOffspringReady([this](Avida::InstructionSequence seq){
systematics_manager->AddOrg(seq, next_cell_id, GetStats().GetUpdate(), false);
// std::cout << "on ready" << std::endl;
systematics_manager->AddOrg(seq, emp::WorldPosition(next_cell_id,0), GetStats().GetUpdate());
emp::Ptr<taxon_t> tax = systematics_manager->GetMostRecent();
if (tax->GetData().GetPhenotype().gestation_time == -1) {
eval_fun(tax);
}
// std::cout << "Done with on ready" << std::endl;
});
OnOrgDeath([this](int pos){ systematics_manager->RemoveOrgAfterRepro(pos, GetStats().GetUpdate());});
OnOrgDeath([this](int pos){
// std::cout << "on death " << std::endl;
systematics_manager->RemoveOrgAfterRepro(emp::WorldPosition(pos, 0), GetStats().GetUpdate());});
OnUpdate([this](int ud){
// std::cout << "On update" << std::endl;
if (std::round(GetStats().GetGeneration()) > latest_gen) {
latest_gen = std::round(GetStats().GetGeneration());
OEE_stats->Update(latest_gen, GetStats().GetUpdate());
oee_file.Update(latest_gen);
}
// std::cout << "On update done" << std::endl;
});
OnUpdate([this](int ud){systematics_manager->Update(); phylodiversity_file.Update(ud); lineage_file.Update(ud); dom_file.Update(ud);});
OnUpdate([this](int ud){
// std::cout << "On update 2" << std::endl;
systematics_manager->Update();
// std::cout << "systematic man update done" << std::endl;
phylodiversity_file.Update(ud);
// std::cout << "Phylodiv file done" << std::endl;
lineage_file.Update(ud);
// std::cout << "lin file done" << std::endl;
dom_file.Update(ud);
// std::cout << "On update 2 done" << std::endl;
});
// --- bookmark ---
OnUpdate([this](int ud) { if (GetStats().GetUpdate() % m_conf->PHYLOGENY_SNAPSHOT_RES.Get() == 0) { systematics_manager->Snapshot("phylogeny-snapshot-" + emp::to_string(GetStats().GetUpdate()) + ".csv" ); } });
OnUpdate([this](int ud) {
// std::cout << "On update3" << std::endl;
if (GetStats().GetUpdate() % m_conf->PHYLOGENY_SNAPSHOT_RES.Get() == 0) { systematics_manager->Snapshot("phylogeny-snapshot-" + emp::to_string(GetStats().GetUpdate()) + ".csv" );
// std::cout << "End on update3" << std::endl;
} });

std::function<int()> gen_fun = [this](){return std::round(GetStats().GetGeneration());};
std::function<int()> update_fun = [this](){return GetStats().GetUpdate();};

// std::cout << " Setupp output" << std::endl;
oee_file.AddFun(gen_fun, "generation", "Generation");
oee_file.AddCurrent(*OEE_stats->GetDataNode("change"), "change", "change potential");
oee_file.AddCurrent(*OEE_stats->GetDataNode("novelty"), "novelty", "novelty potential");
Expand All @@ -316,7 +337,7 @@ bool cWorld::setup(World* new_world, cUserFeedback* feedback, const Apto::Map<Ap
systematics_manager->AddPhylogeneticDiversityDataNode();
phylodiversity_file.AddFun(update_fun, "update", "Update");
phylodiversity_file.AddStats(*systematics_manager->GetDataNode("evolutionary_distinctiveness") , "evolutionary_distinctiveness", "evolutionary distinctiveness for a single update", true, true);
phylodiversity_file.AddStats(*systematics_manager->GetDataNode("pairwise_distances"), "pairwise_distance", "pairwise distance for a single update", true, true);
// phylodiversity_file.AddStats(*systematics_manager->GetDataNode("pairwise_distances"), "pairwise_distance", "pairwise distance for a single update", true, true);
phylodiversity_file.AddCurrent(*systematics_manager->GetDataNode("phylogenetic_diversity"), "current_phylogenetic_diversity", "current phylogenetic_diversity", true, true);

phylodiversity_file.template AddFun<size_t>( [this](){ return systematics_manager->GetNumActive(); }, "num_taxa", "Number of unique taxonomic groups currently active." );
Expand Down

0 comments on commit ca8f2db

Please sign in to comment.