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: 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 diff --git a/Empirical b/Empirical index 915a9597..bdb6776d 160000 --- a/Empirical +++ b/Empirical @@ -1 +1 @@ -Subproject commit 915a9597e40325be9835df1ce15a4b92f78a3542 +Subproject commit bdb6776d3e93ee2c78eb17440102979450ff11a7 diff --git a/Makefile b/Makefile index 4a1d844d..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++17 -I$(EMP_DIR)/ -I$(SGP_DIR)/ +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++ @@ -65,27 +66,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 +103,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 +113,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 +147,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/signalgp-lite b/signalgp-lite index 64ba94ee..fcc45172 160000 --- a/signalgp-lite +++ b/signalgp-lite @@ -1 +1 @@ -Subproject commit 64ba94ee303073d9d98f68d040fbe91ec78c1886 +Subproject commit fcc4517206054d2081677c4e64fb0be41c53a142 diff --git a/source/default_mode/Host.h b/source/default_mode/Host.h index 8793268f..0837080f 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 @@ -546,7 +546,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 6afb72fd..56959d1f 100644 --- a/source/default_mode/SymWorld.h +++ b/source/default_mode/SymWorld.h @@ -146,7 +146,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(); } @@ -263,7 +263,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; } @@ -281,7 +281,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) { @@ -524,7 +524,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. @@ -669,7 +669,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 @@ -781,7 +781,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; } 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()) { 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; }