Skip to content

Commit

Permalink
Merge pull request #208 from emilydolson/update-empirical
Browse files Browse the repository at this point in the history
Update to latest version of Empirical (and better version of Emscripten)
  • Loading branch information
anyaevostinar committed Apr 10, 2024
2 parents 833411c + 4bbc83c commit b4d5cd3
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 25 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout Symbulation
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
path: SymbulationEmp
submodules: "recursive"
Expand All @@ -25,7 +25,7 @@ jobs:
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
run: cd SymbulationEmp/emsdk && ./emsdk install 3.1.18 && ./emsdk activate 3.1.18 && source ./emsdk_env.sh && cd .. && make web

# Runs a single command using the runners shell
- name: Make tests
Expand All @@ -35,6 +35,6 @@ jobs:
run: cd SymbulationEmp && gcov -abcfu main.cc

- name: Upload coverage
uses: codecov/codecov-action@v1.5.2
uses: codecov/codecov-action@v3
with:
root_dir: SymbulationEmp
2 changes: 1 addition & 1 deletion Empirical
Submodule Empirical updated 816 files
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ TEST_DIR := source/catch
EMP_DIR := Empirical/include

# Flags to use regardless of compiler
CFLAGS_all := -Wall -Wno-unused-function -std=c++17 -I$(EMP_DIR)/
CFLAGS_all := -Wall -Wno-unused-function -std=c++20 -I$(EMP_DIR)/

# Native compiler information
CXX_nat := g++
Expand Down
8 changes: 4 additions & 4 deletions docs/QuickStartGuides/4-CreatingAMode.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ void Mutate() {
//Repeat the below for each new trait that needs mutating
if (random->GetDouble(0.0, 1.0) <= local_rate) {
//mutate trait, assuming it should be between 0 and 1
trait += random->GetRandNormal(0.0, local_size);
trait += random->GetNormal(0.0, local_size);
if(trait < 0) trait = 0;
else if (trait > 1) trait = 1;
}
Expand All @@ -248,17 +248,17 @@ The `Phage` class has three new traits and has configuration settings for turnin
if (random->GetDouble(0.0, 1.0) <= local_rate) {
//mutate chance of lysis/lysogeny, if enabled
if(my_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(my_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(my_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;
}
Expand Down
2 changes: 1 addition & 1 deletion emsdk
Submodule emsdk updated 47 files
+131 −39 .circleci/config.yml
+2 −1 .dockerignore
+16 −15 .flake8
+3 −1 .gitignore
+17 −31 README.md
+16 −0 SECURITY.md
+1 −0 bazel/.bazelrc
+47 −10 bazel/BUILD
+11 −17 bazel/README.md
+4 −0 bazel/WORKSPACE
+2 −5 bazel/bazelrc
+22 −8 bazel/deps.bzl
+120 −11 bazel/emscripten_deps.bzl
+38 −24 bazel/emscripten_toolchain/BUILD.bazel
+0 −6 bazel/emscripten_toolchain/emscripten.BUILD
+12 −3 bazel/emscripten_toolchain/emscripten_config
+3 −3 bazel/emscripten_toolchain/link_wrapper.py
+11 −3 bazel/emscripten_toolchain/toolchain.bzl
+21 −33 bazel/emscripten_toolchain/wasm_binary.py
+111 −37 bazel/emscripten_toolchain/wasm_cc_binary.bzl
+339 −1 bazel/revisions.bzl
+1 −0 bazel/test_external/.bazelrc
+4 −0 bazel/test_external/BUILD
+4 −0 bazel/test_external/WORKSPACE
+2 −0 bazel/toolchains.bzl
+10 −13 docker/Dockerfile
+6 −3 docker/Makefile
+7 −0 docker/entrypoint.sh
+0 −1 docker/test_dockerimage.sh
+98 −1 emscripten-releases-tags.json
+9 −10 emsdk
+1 −0 emsdk.ps1
+468 −545 emsdk.py
+1 −1 emsdk_env.sh
+150 −282 emsdk_manifest.json
+7 −4 scripts/create_release.py
+69 −0 scripts/update_bazel_workspace.py
+0 −73 scripts/update_bazel_workspace.sh
+23 −0 scripts/update_linux_arm64.sh
+4 −2 scripts/update_node.py
+23 −50 test/test.py
+21 −11 test/test.sh
+1 −13 test/test_activation.ps1
+1 −1 test/test_bazel.sh
+1 −1 test/test_bazel_mac.sh
+35 −0 test/test_node_path.sh
+0 −3 test/test_path_preservation.ps1
2 changes: 1 addition & 1 deletion source/default_mode/Host.h
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,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;
}
Expand Down
2 changes: 1 addition & 1 deletion source/default_mode/SymWorld.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ class SymWorld : public emp::World<Organism>{
* Purpose: To add a symbiont to the systematic and to set it to track its taxon
*/
emp::Ptr<emp::Taxon<int>> AddSymToSystematic(emp::Ptr<Organism> sym, emp::Ptr<emp::Taxon<int>> parent_taxon=nullptr){
emp::Ptr<emp::Taxon<int>> taxon = sym_sys->AddOrg(*sym, emp::WorldPosition(0,0), parent_taxon, GetUpdate());
emp::Ptr<emp::Taxon<int>> taxon = sym_sys->AddOrg(*sym, emp::WorldPosition(0,0), parent_taxon);
sym->SetTaxon(taxon);
return taxon;
}
Expand Down
6 changes: 3 additions & 3 deletions source/default_mode/Symbiont.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ 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);}
}

/**
Expand Down Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions source/efficient_mode/EfficientSymbiont.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,19 +180,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(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;
}
}
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;
}
Expand Down
2 changes: 1 addition & 1 deletion source/lysis_mode/Bacterium.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class Bacterium : public Host {

//mutate host genome if enabled
if(my_config->MUTATE_INC_VAL()){
host_incorporation_val += random->GetRandNormal(0.0, my_config->MUTATION_SIZE());
host_incorporation_val += random->GetNormal(0.0, my_config->MUTATION_SIZE());

if(host_incorporation_val < 0) host_incorporation_val = 0;

Expand Down
8 changes: 4 additions & 4 deletions source/lysis_mode/Phage.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,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);}


/**
Expand Down Expand Up @@ -252,17 +252,17 @@ class Phage: public Symbiont {
if (random->GetDouble(0.0, 1.0) <= local_rate) {
//mutate chance of lysis/lysogeny, if enabled
if(my_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(my_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(my_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;
}
Expand Down
2 changes: 1 addition & 1 deletion source/pgg_mode/PGGSymbiont.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class PGGSymbiont: public Symbiont {
void Mutate(){
Symbiont::Mutate();
if (random->GetDouble(0.0, 1.0) <= my_config->MUTATION_RATE()) {
PGG_donate += random->GetRandNormal(0.0, my_config->MUTATION_SIZE());
PGG_donate += random->GetNormal(0.0, my_config->MUTATION_SIZE());
if(PGG_donate < 0) PGG_donate = 0;
else if (PGG_donate > 1) PGG_donate = 1;
}
Expand Down
2 changes: 1 addition & 1 deletion source/pgg_mode/PGGWorldSetup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void PGGWorld::SetupSymbionts(long unsigned int* total_syms) {
double mean = my_config->PGG_DONATE_NORMAL_MEAN();
double std = my_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 > my_config->PGG_DONATE_MAX()) {
Expand Down

0 comments on commit b4d5cd3

Please sign in to comment.