From e96c96db51f988d98c33d86a93f0fceef66b680e Mon Sep 17 00:00:00 2001 From: Alexander Lalejini Date: Wed, 16 Oct 2024 14:27:03 -0400 Subject: [PATCH 01/10] Bump to latest empirical version --- Empirical | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Empirical b/Empirical index 915a9597..bdb6776d 160000 --- a/Empirical +++ b/Empirical @@ -1 +1 @@ -Subproject commit 915a9597e40325be9835df1ce15a4b92f78a3542 +Subproject commit bdb6776d3e93ee2c78eb17440102979450ff11a7 From bc49b20aa8e6c34c6c164c7b62f2ec9f5c55f85f Mon Sep 17 00:00:00 2001 From: Alexander Lalejini Date: Wed, 16 Oct 2024 14:29:18 -0400 Subject: [PATCH 02/10] Updating parasite-mode code for most recent version of empirical: accomodating changes in systematics and emp::random --- Makefile | 20 ++++++++++---------- source/default_mode/Host.h | 4 ++-- source/default_mode/SymWorld.h | 12 ++++++------ source/default_mode/Symbiont.h | 8 ++++---- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index 4a1d844d..143844ee 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ EMP_DIR := Empirical/include SGP_DIR := signalgp-lite/include # Flags to use regardless of compiler -CFLAGS_all := -Wall -Wno-unused-function -std=c++17 -I$(EMP_DIR)/ -I$(SGP_DIR)/ +CFLAGS_all := -Wall -Wno-unused-function -std=c++20 -I$(EMP_DIR)/ -I$(SGP_DIR)/ -DUIT_VENDORIZE_EMP -w # Native compiler information CXX_nat := g++ @@ -65,27 +65,27 @@ debug: @echo SGP mode: make debug-sgp debug-default: CFLAGS_nat := $(CFLAGS_nat_debug) -debug-default: default-mode +debug-default: default-mode default-debug: debug-default debug-parasite: CFLAGS_nat := $(CFLAGS_nat_debug) -debug-parasite: parasite-mode +debug-parasite: parasite-mode parasite-debug: debug-parasite debug-efficient: CFLAGS_nat := $(CFLAGS_nat_debug) -debug-efficient: efficient-mode +debug-efficient: efficient-mode efficient-debug: debug-efficient debug-lysis: CFLAGS_nat := $(CFLAGS_nat_debug) -debug-lysis: lysis-mode +debug-lysis: lysis-mode lysis-debug: debug-lysis debug-pgg: CFLAGS_nat := $(CFLAGS_nat_debug) -debug-pgg: pgg-mode +debug-pgg: pgg-mode pgg-debug: debug-pgg debug-sgp: CFLAGS_nat := $(CFLAGS_nat_debug) -debug-sgp: sgp-mode +debug-sgp: sgp-mode sgp-debug: debug-sgp debug-web: CFLAGS_web := $(CFLAGS_web_debug) @@ -102,7 +102,7 @@ test: @echo To run only the tests for each mode, use the following: @echo Default mode testing: make test-default @echo Efficient mode testing: make test-efficient - @echo Lysis mode testing: make test-lysis + @echo Lysis mode testing: make test-lysis @echo PGG mode testing: make test-pgg @echo SGP mode testing: make test-sgp @@ -112,7 +112,7 @@ test-debug: @echo To debug and test for each mode, use the following: @echo Default mode: make test-debug-default @echo Efficient mode: make test-debug-efficient - @echo Lysis mode: make test-debug-lysis + @echo Lysis mode: make test-debug-lysis @echo PGG mode: make test-debug-pgg @echo SGP mode: make test-debug-sgp @@ -146,7 +146,7 @@ test-debug-pgg: test-sgp: $(CXX_nat) $(CFLAGS_nat) $(TEST_DIR)/main.cc -o symbulation.test - ./symbulation.test [sgp] + ./symbulation.test [sgp] test-debug-sgp: $(CXX_nat) $(CFLAGS_nat_debug) $(TEST_DIR)/main.cc -o symbulation.test ./symbulation.test [sgp] diff --git a/source/default_mode/Host.h b/source/default_mode/Host.h index 8c2bc8df..db21f4e7 100644 --- a/source/default_mode/Host.h +++ b/source/default_mode/Host.h @@ -200,7 +200,7 @@ class Host: public Organism { /** * Input: None - * + * * Output: Name of class as string, Host * * Purpose: To know which subclass the object is @@ -536,7 +536,7 @@ class Host: public Organism { if (mutation_rate == -1) mutation_rate = my_config->MUTATION_RATE(); if(random->GetDouble(0.0, 1.0) <= mutation_rate){ - interaction_val += random->GetRandNormal(0.0, mutation_size); + interaction_val += random->GetNormal(0.0, mutation_size); if(interaction_val < -1) interaction_val = -1; else if (interaction_val > 1) interaction_val = 1; } diff --git a/source/default_mode/SymWorld.h b/source/default_mode/SymWorld.h index 1525d7de..27d4605c 100644 --- a/source/default_mode/SymWorld.h +++ b/source/default_mode/SymWorld.h @@ -137,7 +137,7 @@ class SymWorld : public emp::World{ } if(my_config->PHYLOGENY()){ //host systematic deletion is handled by empirical world destructor - Clear(); // delete hosts here so that hosted symbionts get + Clear(); // delete hosts here so that hosted symbionts get // deleted and unlinked from the sym_sys sym_sys.Delete(); } @@ -246,7 +246,7 @@ class SymWorld : public emp::World{ * Purpose: To add a symbiont to the systematic and to set it to track its taxon */ emp::Ptr> AddSymToSystematic(emp::Ptr sym, emp::Ptr> parent_taxon=nullptr){ - emp::Ptr> taxon = sym_sys->AddOrg(*sym, emp::WorldPosition(0,0), parent_taxon, GetUpdate()); + emp::Ptr> taxon = sym_sys->AddOrg(*sym, emp::WorldPosition(0,0), parent_taxon); sym->SetTaxon(taxon); return taxon; } @@ -264,7 +264,7 @@ class SymWorld : public emp::World{ */ float PullResources(float desired_resources) { // if LIMITED_RES_TOTAL == -1, unlimited, even if limited resources was on before - if (total_res == -1 || my_config->LIMITED_RES_TOTAL() == -1) { + if (total_res == -1 || my_config->LIMITED_RES_TOTAL() == -1) { return desired_resources; } else { if (total_res>=desired_resources) { @@ -495,7 +495,7 @@ class SymWorld : public emp::World{ * Input: The pointer to the symbiont that is moving, the WorldPosition of its * current location. * - * Output: The WorldPosition object describing the symbiont's new location (it describes an + * Output: The WorldPosition object describing the symbiont's new location (it describes an * invalid position if the symbiont is deleted during movement) * * Purpose: To move a symbiont into a new world position. @@ -640,7 +640,7 @@ class SymWorld : public emp::World{ /** * Input: A size_t location to check in the symbiont population vector. * - * Output: A boolean representing whether the the position is valid and + * Output: A boolean representing whether the the position is valid and * occupied by a free living symbiont/ * * Purpose: To determine if a given index is valid and occipied in the symbiont @@ -752,7 +752,7 @@ class SymWorld : public emp::World{ if (counts.size() <= result.size()) { result.resize(counts.size()); } - + return result; } diff --git a/source/default_mode/Symbiont.h b/source/default_mode/Symbiont.h index 2b5f2e60..c6569703 100644 --- a/source/default_mode/Symbiont.h +++ b/source/default_mode/Symbiont.h @@ -161,12 +161,12 @@ class Symbiont: public Organism { * Purpose: To destruct the symbiont and remove the symbiont from the systematic. */ ~Symbiont() { - if(my_config->PHYLOGENY() == 1) {my_world->GetSymSys()->RemoveOrg(my_taxon, my_world->GetUpdate());} + if(my_config->PHYLOGENY() == 1) {my_world->GetSymSys()->RemoveOrg(my_taxon);} } /** * Input: None - * + * * Output: Name of class as string, Symbiont * * Purpose: To know which subclass the object is @@ -396,13 +396,13 @@ class Symbiont: public Organism { double local_size = my_config->MUTATION_SIZE(); if (random->GetDouble(0.0, 1.0) <= local_rate) { - interaction_val += random->GetRandNormal(0.0, local_size); + interaction_val += random->GetNormal(0.0, local_size); if(interaction_val < -1) interaction_val = -1; else if (interaction_val > 1) interaction_val = 1; //also modify infection chance, which is between 0 and 1 if(my_config->FREE_LIVING_SYMS()){ - infection_chance += random->GetRandNormal(0.0, local_size); + infection_chance += random->GetNormal(0.0, local_size); if (infection_chance < 0) infection_chance = 0; else if (infection_chance > 1) infection_chance = 1; } From d00c0b2ae9fe119a0e2e72c654eb80ae76209e87 Mon Sep 17 00:00:00 2001 From: Alexander Lalejini Date: Wed, 16 Oct 2024 14:53:31 -0400 Subject: [PATCH 03/10] Pin updated signalgp-lite version --- signalgp-lite | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/signalgp-lite b/signalgp-lite index 64ba94ee..85384f44 160000 --- a/signalgp-lite +++ b/signalgp-lite @@ -1 +1 @@ -Subproject commit 64ba94ee303073d9d98f68d040fbe91ec78c1886 +Subproject commit 85384f4403bf994a5cbe5a31260766d4e3237dde From 241292906e72ef7079dd63bad9c0fb8939ba77be Mon Sep 17 00:00:00 2001 From: Alexander Lalejini Date: Wed, 16 Oct 2024 14:59:33 -0400 Subject: [PATCH 04/10] Update remote for signalgp-lite submodule --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 370c6b6d..ecc97f63 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,4 +6,4 @@ url = https://github.com/emscripten-core/emsdk [submodule "signalgp-lite"] path = signalgp-lite - url = https://github.com/tolziplohu/signalgp-lite + url = https://github.com/amlalejini/signalgp-lite From 301f42847ced8a7a58eef322ea88b2de130ccf44 Mon Sep 17 00:00:00 2001 From: Matthew Andres Moreno Date: Wed, 16 Oct 2024 17:24:09 -0400 Subject: [PATCH 05/10] Fix vendorized emp compat --- signalgp-lite | 2 +- source/sgp_mode/Instructions.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/signalgp-lite b/signalgp-lite index 85384f44..4381b821 160000 --- a/signalgp-lite +++ b/signalgp-lite @@ -1 +1 @@ -Subproject commit 85384f4403bf994a5cbe5a31260766d4e3237dde +Subproject commit 4381b8217ff3010798ddc42a38008c84bae98a8c diff --git a/source/sgp_mode/Instructions.h b/source/sgp_mode/Instructions.h index c3b716f2..fd426496 100644 --- a/source/sgp_mode/Instructions.h +++ b/source/sgp_mode/Instructions.h @@ -105,7 +105,7 @@ INST(PrivateIO, { } uint32_t next; if (state.world->GetConfig()->RANDOM_IO_INPUT()) { - next = sgpl::tlrand.Get().GetBits50(); + next = sgpl::tlrand.Get().GetUInt(); } else { next = 1; } @@ -127,7 +127,7 @@ INST(SharedIO, { AddOrganismPoints(state, *a); uint32_t next; if (state.world->GetConfig()->RANDOM_IO_INPUT()) { - next = sgpl::tlrand.Get().GetBits50(); + next = sgpl::tlrand.Get().GetUInt(); } else { next = 1; } From 655e9d5b010a29a2abe268d18ab072bb05933584 Mon Sep 17 00:00:00 2001 From: Matthew Andres Moreno Date: Wed, 16 Oct 2024 17:32:51 -0400 Subject: [PATCH 06/10] Bump sgp-lite pin for compat fixes --- signalgp-lite | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/signalgp-lite b/signalgp-lite index 4381b821..bde5b86a 160000 --- a/signalgp-lite +++ b/signalgp-lite @@ -1 +1 @@ -Subproject commit 4381b8217ff3010798ddc42a38008c84bae98a8c +Subproject commit bde5b86aac7ff638a5d09b7de707c83428fb9fe5 From 97a0861147a91e5f7b1ee5128a4f7ad434e5e8eb Mon Sep 17 00:00:00 2001 From: Alexander Lalejini Date: Thu, 17 Oct 2024 10:52:55 -0400 Subject: [PATCH 07/10] Update other symbulation modes to work with updated empirical version --- source/efficient_mode/EfficientSymbiont.h | 10 +++++----- source/lysis_mode/Bacterium.h | 8 ++++---- source/lysis_mode/Phage.h | 12 ++++++------ source/pgg_mode/PGGSymbiont.h | 10 +++++----- source/pgg_mode/PGGWorldSetup.cc | 4 ++-- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/source/efficient_mode/EfficientSymbiont.h b/source/efficient_mode/EfficientSymbiont.h index a002fa5a..fecf367a 100644 --- a/source/efficient_mode/EfficientSymbiont.h +++ b/source/efficient_mode/EfficientSymbiont.h @@ -109,7 +109,7 @@ class EfficientSymbiont: public Symbiont { /** * Input: None - * + * * Output: Name of class as string, EfficientSymbiont * * Purpose: To know which subclass the object is @@ -189,19 +189,19 @@ class EfficientSymbiont: public Symbiont { } if (random->GetDouble(0.0, 1.0) <= int_rate) { - interaction_val += random->GetRandNormal(0.0, local_size); + interaction_val += random->GetNormal(0.0, local_size); if(interaction_val < -1) interaction_val = -1; else if (interaction_val > 1) interaction_val = 1; //also modify infection chance, which is between 0 and 1 if(efficient_config->FREE_LIVING_SYMS()){ - infection_chance += random->GetRandNormal(0.0, local_size); + infection_chance += random->GetNormal(0.0, local_size); if (infection_chance < 0) infection_chance = 0; else if (infection_chance > 1) infection_chance = 1; } } if (random->GetDouble(0.0, 1.0) <= eff_mut_rate) { - efficiency += random->GetRandNormal(0.0, local_size); + efficiency += random->GetNormal(0.0, local_size); if(efficiency < 0) efficiency = 0; else if (efficiency > 1) efficiency = 1; } @@ -239,7 +239,7 @@ class EfficientSymbiont: public Symbiont { return sym_baby; } #pragma clang diagnostic pop - + /** * Input: The pointer to the organism that is the new host baby diff --git a/source/lysis_mode/Bacterium.h b/source/lysis_mode/Bacterium.h index 3a83dbc3..8a797d7c 100644 --- a/source/lysis_mode/Bacterium.h +++ b/source/lysis_mode/Bacterium.h @@ -27,8 +27,8 @@ class Bacterium : public Host { emp::Ptr my_world = NULL; /** - * - * Purpose: Holds all configuration settings and points to same configuration + * + * Purpose: Holds all configuration settings and points to same configuration * object as my_config from superclass, but with the correct subtype. * */ @@ -82,7 +82,7 @@ class Bacterium : public Host { /** * Input: None - * + * * Output: Name of class as string, Bacterium * * Purpose: To know which subclass the object is @@ -139,7 +139,7 @@ class Bacterium : public Host { //mutate host genome if enabled if(lysis_config->MUTATE_INC_VAL()){ - host_incorporation_val += random->GetRandNormal(0.0, lysis_config->MUTATION_SIZE()); + host_incorporation_val += random->GetNormal(0.0, lysis_config->MUTATION_SIZE()); if(host_incorporation_val < 0) host_incorporation_val = 0; diff --git a/source/lysis_mode/Phage.h b/source/lysis_mode/Phage.h index 43e805b7..62b2cd65 100644 --- a/source/lysis_mode/Phage.h +++ b/source/lysis_mode/Phage.h @@ -50,7 +50,7 @@ class Phage: public Symbiont { /** * - * Purpose: Holds all configuration settings and points to same configuration + * Purpose: Holds all configuration settings and points to same configuration * object as my_config from superclass, but with the correct subtype. * */ @@ -110,7 +110,7 @@ class Phage: public Symbiont { /** * Input: None - * + * * Output: Name of class as string, Phage * * Purpose: To know which subclass the object is @@ -135,7 +135,7 @@ class Phage: public Symbiont { * * Purpose: To increment a phage's burst timer. */ - void IncBurstTimer() {burst_timer += random->GetRandNormal(1.0, 1.0);} + void IncBurstTimer() {burst_timer += random->GetNormal(1.0, 1.0);} /** @@ -261,17 +261,17 @@ class Phage: public Symbiont { if (random->GetDouble(0.0, 1.0) <= local_rate) { //mutate chance of lysis/lysogeny, if enabled if(lysis_config->MUTATE_LYSIS_CHANCE()){ - chance_of_lysis += random->GetRandNormal(0.0, local_size); + chance_of_lysis += random->GetNormal(0.0, local_size); if(chance_of_lysis < 0) chance_of_lysis = 0; else if (chance_of_lysis > 1) chance_of_lysis = 1; } if(lysis_config->MUTATE_INDUCTION_CHANCE()){ - induction_chance += random->GetRandNormal(0.0, local_size); + induction_chance += random->GetNormal(0.0, local_size); if(induction_chance < 0) induction_chance = 0; else if (induction_chance > 1) induction_chance = 1; } if(lysis_config->MUTATE_INC_VAL()){ - incorporation_val += random->GetRandNormal(0.0, local_size); + incorporation_val += random->GetNormal(0.0, local_size); if(incorporation_val < 0) incorporation_val = 0; else if (incorporation_val > 1) incorporation_val = 1; } diff --git a/source/pgg_mode/PGGSymbiont.h b/source/pgg_mode/PGGSymbiont.h index f71a3b0a..903c2727 100644 --- a/source/pgg_mode/PGGSymbiont.h +++ b/source/pgg_mode/PGGSymbiont.h @@ -20,10 +20,10 @@ class PGGSymbiont: public Symbiont { * */ emp::Ptr my_world = NULL; - + /** * - * Purpose: Holds all configuration settings and points to same configuration + * Purpose: Holds all configuration settings and points to same configuration * object as my_config from superclass, but with the correct subtype. * */ @@ -31,7 +31,7 @@ class PGGSymbiont: public Symbiont { public: PGGSymbiont(emp::Ptr _random, emp::Ptr _world, emp::Ptr _config, double _intval = 0.0, double _donation = 0.0, double _points = 0.0) : Symbiont(_random, _world, _config, _intval, _points), PGG_donate(_donation) { - pgg_config = _config; + pgg_config = _config; my_world = _world; } @@ -86,7 +86,7 @@ class PGGSymbiont: public Symbiont { /** * Input: None - * + * * Output: Name of class as string, PGGSymbiont * * Purpose: To know which subclass the object is @@ -127,7 +127,7 @@ class PGGSymbiont: public Symbiont { void Mutate(){ Symbiont::Mutate(); if (random->GetDouble(0.0, 1.0) <= pgg_config->MUTATION_RATE()) { - PGG_donate += random->GetRandNormal(0.0, pgg_config->MUTATION_SIZE()); + PGG_donate += random->GetNormal(0.0, pgg_config->MUTATION_SIZE()); if(PGG_donate < 0) PGG_donate = 0; else if (PGG_donate > 1) PGG_donate = 1; } diff --git a/source/pgg_mode/PGGWorldSetup.cc b/source/pgg_mode/PGGWorldSetup.cc index dfb8f948..9731eed3 100644 --- a/source/pgg_mode/PGGWorldSetup.cc +++ b/source/pgg_mode/PGGWorldSetup.cc @@ -34,12 +34,12 @@ void PGGWorld::SetupSymbionts(long unsigned int* total_syms) { //If the user wants the symbionts' donation rate to be randomly initialized if (pgg_config->PGG_DONATE_RANDOM()) { //If the user wants the initialization of the symbionts' donation - //rate to be selected using a normal distribution + //rate to be selected using a normal distribution if (pgg_config->PGG_DONATE_NORMAL()) { double mean = pgg_config->PGG_DONATE_NORMAL_MEAN(); double std = pgg_config->PGG_DONATE_NORMAL_STD(); - sym_donation = random_ptr->GetRandNormal(mean, std); + sym_donation = random_ptr->GetNormal(mean, std); //If selected value is out of the initialization range if (sym_donation > pgg_config->PGG_DONATE_MAX()) { From c08d84d50a0330ffed55b5d923155c16dd9ce5cb Mon Sep 17 00:00:00 2001 From: Matthew Andres Moreno Date: Thu, 17 Oct 2024 12:33:04 -0400 Subject: [PATCH 08/10] Bump sgpl pin --- signalgp-lite | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/signalgp-lite b/signalgp-lite index bde5b86a..fcc45172 160000 --- a/signalgp-lite +++ b/signalgp-lite @@ -1 +1 @@ -Subproject commit bde5b86aac7ff638a5d09b7de707c83428fb9fe5 +Subproject commit fcc4517206054d2081677c4e64fb0be41c53a142 From 9df4cec29f07df6f8cbd33176d2a4e03a138dd67 Mon Sep 17 00:00:00 2001 From: Alexander Lalejini Date: Thu, 17 Oct 2024 12:52:20 -0400 Subject: [PATCH 09/10] Move vendorize flags to env variable --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 143844ee..ba713f5d 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,8 @@ EMP_DIR := Empirical/include SGP_DIR := signalgp-lite/include # Flags to use regardless of compiler -CFLAGS_all := -Wall -Wno-unused-function -std=c++20 -I$(EMP_DIR)/ -I$(SGP_DIR)/ -DUIT_VENDORIZE_EMP -w +VENDORIZE_EMP_FLAGS := -DUIT_VENDORIZE_EMP -DUIT_SUPPRESS_MACRO_INSEEP_WARNINGS +CFLAGS_all := -Wall -Wno-unused-function -std=c++20 -I$(EMP_DIR)/ -I$(SGP_DIR)/ ${VENDORIZE_EMP_FLAGS} # Native compiler information CXX_nat := g++ From fea4a889246774709ed38ba92d5b0e9a3e9c7f0c Mon Sep 17 00:00:00 2001 From: Alexander Lalejini Date: Fri, 18 Oct 2024 12:46:09 -0400 Subject: [PATCH 10/10] Swap CI runner order to run native tests before testing the web build --- .github/workflows/CI.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 0231b1e2..6983e774 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -24,16 +24,16 @@ jobs: - name: run symbulation run: cd SymbulationEmp && make debug-default && ./symbulation_default -GRID_X 5 -GRID_Y 5 - - name: test web build - run: cd SymbulationEmp/emsdk && ./emsdk install 1.38.48 && ./emsdk activate 1.38.48 && source ./emsdk_env.sh && cd .. && make web - # Runs a single command using the runners shell - name: Make tests run: cd SymbulationEmp && make coverage - + + - name: test web build + run: cd SymbulationEmp/emsdk && ./emsdk install 1.38.48 && ./emsdk activate 1.38.48 && source ./emsdk_env.sh && cd .. && make web + - name: Generate coverage run: cd SymbulationEmp && gcov -abcfu main.cc - + - name: Upload coverage uses: codecov/codecov-action@v1.5.2 with: