From 8b9c15b54be3a95a73547c2a783093dcf3d82af5 Mon Sep 17 00:00:00 2001 From: EliasH-E Date: Mon, 3 Aug 2026 15:02:28 -0500 Subject: [PATCH 01/18] moved all signals and functors into private --- source/sgp_mode/SGPHost.h | 8 +- source/sgp_mode/SGPWorld.h | 346 +++++++++++++++++++++---------------- 2 files changed, 203 insertions(+), 151 deletions(-) diff --git a/source/sgp_mode/SGPHost.h b/source/sgp_mode/SGPHost.h index 902b54a0..3db532af 100644 --- a/source/sgp_mode/SGPHost.h +++ b/source/sgp_mode/SGPHost.h @@ -298,7 +298,7 @@ class SGPHost : public Host { this ); } - my_world->before_host_cpu_exec_sig.Trigger(*this); + my_world->TriggerBeforeHostCPUExec(*this); // Host may have died as a result of this signal. if (GetDead()) { @@ -326,10 +326,10 @@ class SGPHost : public Host { AttemptReproduction(pos); } - my_world->after_host_cpu_step_sig.Trigger(*this); + my_world->TriggerAfterHostCPUStep(*this); // NOTE - Check death here? } - my_world->after_host_cpu_exec_sig.Trigger(*this); + my_world->TriggerAfterHostCPUExec(*this); // Handle any endosymbionts (configurable at setup-time) // NOTE - is there any reason that this might need to be a functor? ProcessEndosymbionts(); @@ -338,7 +338,7 @@ class SGPHost : public Host { return; } GrowOlder(); - my_world->after_host_process_sig.Trigger(*this); + my_world->TriggerAfterHostProcess(*this); } void ProcessEndosymbionts() { diff --git a/source/sgp_mode/SGPWorld.h b/source/sgp_mode/SGPWorld.h index 5d26a512..92297460 100644 --- a/source/sgp_mode/SGPWorld.h +++ b/source/sgp_mode/SGPWorld.h @@ -208,158 +208,11 @@ class SGPWorld : public SymWorld { // Tag used to trigger start module in signalgp programs during run tag_t START_TAG; - // -- Signals to allow custom behavior to be triggered by other classes -- / - // AEV question: getter methods for these? - - // begin_update_sig - Triggers at the beginning of an Update call. - // Triggers before schedule update, before processing any organisms. - // E.g., used for resetting any per-update data tracking. - emp::Signal begin_update_sig; - - // ---- Symbiont birth signals / functors ---- - // before_sym_do_birth_sig - Triggers during SymDoBirth function. - // Triggers after sym offspring is created but before fun_sym_do_birth() is called. - emp::Signal, /* sym_baby_ptr */ - const emp::WorldPosition& /* parent_pos */ - )> before_sym_do_birth_sig; - - // after_sym_do_birth_sig - Triggers during SymDoBirth function. - // Triggers after fun_sym_do_birth() is called. - emp::Signal /* parent_sym */ - )> after_sym_do_birth_sig; - - // fun_sym_do_birth - Configurable functor that handles calling appropriate - // "DoBirth" function depending on whether free-living symbionts are turned on. - fun_sym_do_birth_t fun_sym_do_birth; - - // ---- Host birth signals / functors ---- - // before_host_do_birth_sig - Triggers during HostDoBirth(). - // When this triggers, host offspring has been created (when reproduction queue) - // is processed. Triggers before endosymbionts attempt vertical transmission and - // before DoBirth is called. - emp::Signal before_host_do_birth_sig; - - // after_host_do_birth_sig - Triggers during HostDoBirth(). - // Triggers after endosymbionts attempt vertical transmission and after DoBirth - // is called on the host offspring. - // NOTE - add more parameters to this? We know the parent / offsspring where this is called. - emp::Signal after_host_do_birth_sig; - - // ---- Host process signals / functors ---- - // before_host_cpu_exec_sig - Triggers in ProcessHostAt() - // Triggers before running the host's CPU / after updating host location. - // Host is not guaranteed to still be alive if prior actions attached to this signal - // kill the host. - emp::Signal before_host_cpu_exec_sig; - - // after_host_process_sig - Triggers in ProcessHostAt() - // Triggers at end of ProcessHostAt. There is one final check for death after - // after this triggers in case an attached action kills the host. - emp::Signal after_host_process_sig; - - // after_host_cpu_step_sig - Triggers in ProcessHostAt() - // Triggers after each CPU cycle (potentially multiple times per update) and after - // handling a repro attempt by the host for that CPU cycle. - emp::Signal after_host_cpu_step_sig; - - // after_host_cpu_exec_sig - Triggers in ProcessHostAt() - // Triggers after executing all CPU cycles allotted to host being processed and - // before processing the host's endosymbionts. - emp::Signal after_host_cpu_exec_sig; - // fun_process_endosym_t fun_process_endosym; // NOTE - not used at the moment - - // ---- Free-living symbiont signals / functors ---- - // before_freeliving_sym_process_sig - Triggers in ProcessFreeLivingSymAt() - // Triggers if sym is alive before executing sym's CPU. - emp::Signal before_freeliving_sym_process_sig; - - // after_freeliving_sym_process_sig - Triggers in ProcessFreeLivingSymAt() - // Triggers at end of ProcessFreeLivingSymAt, but before a final check/potential - // DoSymDeath call - emp::Signal after_freeliving_sym_process_sig; - - // after_freeliving_sym_cpu_step_sig - Triggers in ProcessFreeLivingSymAt() - // Triggers after each CPU cycle after handling an instruction-triggered repro attempt. - emp::Signal after_freeliving_sym_cpu_step_sig; - - // after_freeliving_sym_cpu_exec_sig - Triggers in ProcessFreeLivingSymAt() - // Triggers after executing all CPU cycles allotted to sym being processed and - // before SGPSymbiont::Process is called. - emp::Signal after_freeliving_sym_cpu_exec_sig; - - // ---- Endosymbiont process signals / functors ---- - // Happens before this endosymbiont's host is processed - emp::Signal before_endosym_host_process_sig; - - // before_endosym_process_sig - Triggers during ProcessEndoSymbiont() - emp::Signal before_endosym_process_sig; - - // after_endosym_process_sig - Triggers during ProcessEndoSymbiont() - emp::Signal after_endosym_process_sig; - - // after_endosym_cpu_step_sig - Triggers during ProcessEndoSymbiont() - emp::Signal after_endosym_cpu_step_sig; - - // after_endosym_cpu_exec_sig - Triggers during ProcessEndoSymbiont() - emp::Signal after_endosym_cpu_exec_sig; // ---- Environment signals/functors ---- // fun_do_resource_inflow_t fun_do_resource_inflow; - // Called in FindHostForHorizontalTrans(), configured in SetupPopStructure(). - // Returns a target position for symbiont to horizontally transmit into. - // Returns std::nullopt if failed to find suitable target position. - std::function( - size_t, /* Parent's host location id in world (pops[0][id])*/ - emp::Ptr /* Pointer to symbiont parent (producing the sym offspring) */ - )> fun_find_host_for_horizontal_trans; - // External facing helpers for orgnanisms to call //void HostAttemptRepro(const emp::WorldPosition& pos, sgp_host_t& host); @@ -489,6 +342,15 @@ class SGPWorld : public SymWorld { bool /* vertical transmission success */ )> after_sym_vert_transmission_sig; + // Called in FindHostForHorizontalTrans(), configured in SetupPopStructure(). + // Returns a target position for symbiont to horizontally transmit into. + // Returns std::nullopt if failed to find suitable target position. + std::function( + size_t, /* Parent's host location id in world (pops[0][id])*/ + emp::Ptr /* Pointer to symbiont parent (producing the sym offspring) */ + )> fun_find_host_for_horizontal_trans; + + // fun_vert_trans_compatible - Called during HostDoBirth to determine if // a given symbiont can vertically transmit into host offspring. fun_vert_trans_compatible_t fun_vert_trans_compatible; @@ -584,6 +446,150 @@ class SGPWorld : public SymWorld { (static_cast(org_ptr.Raw()))->GetHardware().GetCPUState(); } + // -- Signals to allow custom behavior to be triggered by other classes -- / + // AEV question: getter methods for these? + + // begin_update_sig - Triggers at the beginning of an Update call. + // Triggers before schedule update, before processing any organisms. + // E.g., used for resetting any per-update data tracking. + emp::Signal begin_update_sig; + + // ---- Symbiont birth signals / functors ---- + // before_sym_do_birth_sig - Triggers during SymDoBirth function. + // Triggers after sym offspring is created but before fun_sym_do_birth() is called. + emp::Signal, /* sym_baby_ptr */ + const emp::WorldPosition& /* parent_pos */ + )> before_sym_do_birth_sig; + + + // after_sym_do_birth_sig - Triggers during SymDoBirth function. + // Triggers after fun_sym_do_birth() is called. + emp::Signal /* parent_sym */ + )> after_sym_do_birth_sig; + + + // fun_sym_do_birth - Configurable functor that handles calling appropriate + // "DoBirth" function depending on whether free-living symbionts are turned on. + fun_sym_do_birth_t fun_sym_do_birth; + + // ---- Host birth signals / functors ---- + // before_host_do_birth_sig - Triggers during HostDoBirth(). + // When this triggers, host offspring has been created (when reproduction queue) + // is processed. Triggers before endosymbionts attempt vertical transmission and + // before DoBirth is called. + emp::Signal before_host_do_birth_sig; + + + // after_host_do_birth_sig - Triggers during HostDoBirth(). + // Triggers after endosymbionts attempt vertical transmission and after DoBirth + // is called on the host offspring. + // NOTE - add more parameters to this? We know the parent / offsspring where this is called. + emp::Signal after_host_do_birth_sig; + + + // ---- Host process signals / functors ---- + // before_host_cpu_exec_sig - Triggers in ProcessHostAt() + // Triggers before running the host's CPU / after updating host location. + // Host is not guaranteed to still be alive if prior actions attached to this signal + // kill the host. + emp::Signal before_host_cpu_exec_sig; + + // after_host_process_sig - Triggers in ProcessHostAt() + // Triggers at end of ProcessHostAt. There is one final check for death after + // after this triggers in case an attached action kills the host. + emp::Signal after_host_process_sig; + + // after_host_cpu_step_sig - Triggers in ProcessHostAt() + // Triggers after each CPU cycle (potentially multiple times per update) and after + // handling a repro attempt by the host for that CPU cycle. + emp::Signal after_host_cpu_step_sig; + + // after_host_cpu_exec_sig - Triggers in ProcessHostAt() + // Triggers after executing all CPU cycles allotted to host being processed and + // before processing the host's endosymbionts. + emp::Signal after_host_cpu_exec_sig; + // fun_process_endosym_t fun_process_endosym; // NOTE - not used at the moment + + // ---- Free-living symbiont signals / functors ---- + // before_freeliving_sym_process_sig - Triggers in ProcessFreeLivingSymAt() + // Triggers if sym is alive before executing sym's CPU. + emp::Signal before_freeliving_sym_process_sig; + + // after_freeliving_sym_process_sig - Triggers in ProcessFreeLivingSymAt() + // Triggers at end of ProcessFreeLivingSymAt, but before a final check/potential + // DoSymDeath call + emp::Signal after_freeliving_sym_process_sig; + + // after_freeliving_sym_cpu_step_sig - Triggers in ProcessFreeLivingSymAt() + // Triggers after each CPU cycle after handling an instruction-triggered repro attempt. + emp::Signal after_freeliving_sym_cpu_step_sig; + + // after_freeliving_sym_cpu_exec_sig - Triggers in ProcessFreeLivingSymAt() + // Triggers after executing all CPU cycles allotted to sym being processed and + // before SGPSymbiont::Process is called. + emp::Signal after_freeliving_sym_cpu_exec_sig; + + // ---- Endosymbiont process signals / functors ---- + // Happens before this endosymbiont's host is processed + emp::Signal before_endosym_host_process_sig; + + // before_endosym_process_sig - Triggers during ProcessEndoSymbiont() + emp::Signal before_endosym_process_sig; + + // after_endosym_process_sig - Triggers during ProcessEndoSymbiont() + emp::Signal after_endosym_process_sig; + + // after_endosym_cpu_step_sig - Triggers during ProcessEndoSymbiont() + emp::Signal after_endosym_cpu_step_sig; + + // after_endosym_cpu_exec_sig - Triggers during ProcessEndoSymbiont() + emp::Signal after_endosym_cpu_exec_sig; + public: SGPWorld( emp::Random& rnd, @@ -812,6 +818,52 @@ class SGPWorld : public SymWorld { after_endosym_process_sig.Trigger(sym_pos, sym, static_cast(*host)); } + void TriggerBeforeSymDoBirth(emp::Ptr sym_baby_ptr, const emp::WorldPosition& parent_pos){ + before_sym_do_birth_sig.Trigger(sym_baby_ptr, parent_pos); + } + + void TriggerAfterSymDoBirth(const emp::WorldPosition& sym_baby_pos, + emp::Ptr parent_sym){ + after_sym_do_birth_sig.Trigger(sym_baby_pos, parent_sym); + } + + void TriggerBeforeHostDoBirth(sgp_host_t& host_offspring_ptr, + sgp_host_t& host_parent_ptr, + const emp::WorldPosition& parent_pos){ + before_host_do_birth_sig.Trigger(host_offspring_ptr, host_parent_ptr, parent_pos); + } + + void TriggerAfterHostDoBirth(const emp::WorldPosition& host_offspring_pos){ + after_host_do_birth_sig.Trigger(host_offspring_pos); + } + + void TriggerBeforeHostCPUExec( + sgp_host_t& host + ) { + before_host_cpu_exec_sig.Trigger(host); + } + + void TriggerAfterHostCPUStep( + sgp_host_t& host + ) { + after_host_cpu_step_sig.Trigger(host); + } + + void TriggerAfterHostCPUExec( + sgp_host_t& host + ) { + after_host_cpu_exec_sig.Trigger(host); + } + + void TriggerAfterHostProcess( + sgp_host_t& host + ) { + after_host_process_sig.Trigger(host); + } + + + + const std::unordered_set& GetJumpInstOpcodes() const { return sgp_jump_opcodes; } /** From 3a8c22412d889babadd2a86d70fec5344ab02091 Mon Sep 17 00:00:00 2001 From: EliasH-E Date: Mon, 3 Aug 2026 15:15:07 -0500 Subject: [PATCH 02/18] removed defunct functions --- source/Organism.h | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/source/Organism.h b/source/Organism.h index 1ee29efa..3f4f84cd 100644 --- a/source/Organism.h +++ b/source/Organism.h @@ -288,14 +288,6 @@ class Organism { std::cout << "ClearReproSyms called from Organism" << std::endl; throw "Organism method called!"; } - virtual void CycleTransfer(int _in) { - std::cout << "CycleTransfer called from Organism" << std::endl; - throw "Organism method called!"; - } - virtual int GetCyclesGiven() const { - std::cout << "GetCyclesGiven called from Organism" << std::endl; - throw "Organism method called!"; - } //Bacterium functions virtual double ProcessLysogenResources(double phage_inc_val) { std::cout << "ProcessLysogenResources called from Organism" << std::endl; @@ -376,11 +368,5 @@ class Organism { } - //SGPMode Symbiont Functions - virtual float DoTaskInteraction(float score, size_t task_id) { - std::cout << "DoTaskInteraction called from Organism" << std::endl; - throw "Organism method called!"; - } - }; #endif From 2c7494993933a88eebf694b2464e4621c01ee268 Mon Sep 17 00:00:00 2001 From: EliasH-E Date: Tue, 4 Aug 2026 11:31:09 -0500 Subject: [PATCH 03/18] did some fixing up of indentation and such --- source/sgp_mode/SGPWorld.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/source/sgp_mode/SGPWorld.h b/source/sgp_mode/SGPWorld.h index 92297460..9d491073 100644 --- a/source/sgp_mode/SGPWorld.h +++ b/source/sgp_mode/SGPWorld.h @@ -818,7 +818,8 @@ class SGPWorld : public SymWorld { after_endosym_process_sig.Trigger(sym_pos, sym, static_cast(*host)); } - void TriggerBeforeSymDoBirth(emp::Ptr sym_baby_ptr, const emp::WorldPosition& parent_pos){ + void TriggerBeforeSymDoBirth(emp::Ptr sym_baby_ptr, + const emp::WorldPosition& parent_pos){ before_sym_do_birth_sig.Trigger(sym_baby_ptr, parent_pos); } @@ -837,15 +838,11 @@ class SGPWorld : public SymWorld { after_host_do_birth_sig.Trigger(host_offspring_pos); } - void TriggerBeforeHostCPUExec( - sgp_host_t& host - ) { + void TriggerBeforeHostCPUExec(sgp_host_t& host) { before_host_cpu_exec_sig.Trigger(host); } - void TriggerAfterHostCPUStep( - sgp_host_t& host - ) { + void TriggerAfterHostCPUStep(sgp_host_t& host) { after_host_cpu_step_sig.Trigger(host); } From 8c5d5bbb604cfb985d28a52daba80d201edb396c Mon Sep 17 00:00:00 2001 From: EliasH-E Date: Wed, 5 Aug 2026 12:27:34 -0500 Subject: [PATCH 04/18] changed cpu to grab host location --- source/sgp_mode/SGPHost.h | 8 +++--- source/sgp_mode/hardware/CPUState.h | 8 +++--- .../sgp_mode_test/unit_tests/SGPHost.test.cc | 26 ++++++++++++++++++ .../unit_tests/SGPSymbiont.test.cc | 27 +++++++++++++++++++ 4 files changed, 61 insertions(+), 8 deletions(-) diff --git a/source/sgp_mode/SGPHost.h b/source/sgp_mode/SGPHost.h index 3db532af..51878a29 100644 --- a/source/sgp_mode/SGPHost.h +++ b/source/sgp_mode/SGPHost.h @@ -171,10 +171,10 @@ class SGPHost : public Host { */ void SetReproCount(size_t _in) { reproductions = _in; } - void SetLocation(emp::WorldPosition pos) { - hardware.GetCPUState().SetLocation(pos); - Host::SetLocation(pos); - } + //void SetLocation(emp::WorldPosition pos) { + //hardware.GetCPUState().SetLocation(pos); + //Host::SetLocation(pos); + //} void DecPoints(double amt) { points -= amt; diff --git a/source/sgp_mode/hardware/CPUState.h b/source/sgp_mode/hardware/CPUState.h index 56cf641d..258cfee9 100644 --- a/source/sgp_mode/hardware/CPUState.h +++ b/source/sgp_mode/hardware/CPUState.h @@ -86,7 +86,7 @@ class CPUState { emp::Ptr organism; // Unowned pointer to organism using this CPU. emp::Ptr world_ptr; // Unowned pointer to the world using this CPU. - emp::WorldPosition location; + //emp::WorldPosition location; public: CPUState( @@ -148,7 +148,7 @@ class CPUState { jump_table.clear(); - location = emp::WorldPosition(); + //location = emp::WorldPosition(); } // Reset cpu state, but keep num_tasks the same. @@ -166,9 +166,9 @@ class CPUState { } void SetLocation(const emp::WorldPosition& loc) { - location = loc; + GetOrgPtr()->SetLocation(loc); } - const emp::WorldPosition& GetLocation() const { return location; } + const emp::WorldPosition GetLocation() const { return GetOrg().GetLocation(); } void SetCPUCyclesToExec(size_t num) { cpu_cycles_to_exec = num; diff --git a/source/test/sgp_mode_test/unit_tests/SGPHost.test.cc b/source/test/sgp_mode_test/unit_tests/SGPHost.test.cc index 79401dca..61900c52 100644 --- a/source/test/sgp_mode_test/unit_tests/SGPHost.test.cc +++ b/source/test/sgp_mode_test/unit_tests/SGPHost.test.cc @@ -309,4 +309,30 @@ TEST_CASE("Check that hosts and syms can't have negative points", "[sgp][sgp-uni } } } +} + +TEST_CASE("CPUState and SGPHost always have the same location","[sgp][elias]"){ + using world_t = sgpmode::SGPWorld; + using cpu_state_t = sgpmode::CPUState; + using hw_spec_t = sgpmode::SGPHardwareSpec; + using sgp_host_t = sgpmode::SGPHost; + using sgp_sym_t = sgpmode::SGPSymbiont; + + emp::Random random(31); + sgpmode::SymConfigSGP config; + world_t world(random, &config); + auto& prog_builder = world.GetProgramBuilder(); + emp::Ptr host = emp::NewPtr(&random, &world, &config, prog_builder.CreateReproProgram(100)); + + WHEN("Initialized"){ + REQUIRE(host->GetHardware().GetCPUState().GetLocation().GetIndex() == host->GetLocation().GetIndex()); + } + WHEN("Host has location set"){ + host->SetLocation(emp::WorldPosition(1, 2)); + REQUIRE(host->GetHardware().GetCPUState().GetLocation().GetIndex() == host->GetLocation().GetIndex()); + } + WHEN("CPUState has location set"){ + host->GetHardware().GetCPUState().SetLocation(emp::WorldPosition(3, 4)); + REQUIRE(host->GetHardware().GetCPUState().GetLocation().GetIndex() == host->GetLocation().GetIndex()); + } } \ No newline at end of file diff --git a/source/test/sgp_mode_test/unit_tests/SGPSymbiont.test.cc b/source/test/sgp_mode_test/unit_tests/SGPSymbiont.test.cc index 34ec3d3e..b5d62848 100644 --- a/source/test/sgp_mode_test/unit_tests/SGPSymbiont.test.cc +++ b/source/test/sgp_mode_test/unit_tests/SGPSymbiont.test.cc @@ -132,3 +132,30 @@ TEST_CASE("Symbiont Process", "[sgp][sgp-unit]") { // } // } // } + +TEST_CASE("CPUState and SGPSymbiont always have the same location","[sgp][elias]"){ + using world_t = sgpmode::SGPWorld; + using cpu_state_t = sgpmode::CPUState; + using hw_spec_t = sgpmode::SGPHardwareSpec; + using sgp_host_t = sgpmode::SGPHost; + using sgp_sym_t = sgpmode::SGPSymbiont; + + emp::Random random(31); + sgpmode::SymConfigSGP config; + world_t world(random, &config); + auto& prog_builder = world.GetProgramBuilder(); + emp::Ptr sym = emp::NewPtr(&random, &world, &config, prog_builder.CreateReproProgram(100)); + + WHEN("Initialized"){ + REQUIRE(sym->GetHardware().GetCPUState().GetLocation().GetIndex() == sym->GetLocation().GetIndex()); + } + + WHEN("Symbiont has location set"){ + sym->SetLocation(emp::WorldPosition(1, 2)); + REQUIRE(sym->GetHardware().GetCPUState().GetLocation().GetIndex() == sym->GetLocation().GetIndex()); + } + WHEN("CPUState has location set"){ + sym->GetHardware().GetCPUState().SetLocation(emp::WorldPosition(3, 4)); + REQUIRE(sym->GetHardware().GetCPUState().GetLocation().GetIndex() == sym->GetLocation().GetIndex()); + } +} \ No newline at end of file From 33fbf90bb4f04c3d48f922284cead25d80dce5d4 Mon Sep 17 00:00:00 2001 From: EliasH-E Date: Wed, 5 Aug 2026 14:16:37 -0500 Subject: [PATCH 05/18] fixed sgp config for hosts and symmbionts --- source/sgp_mode/SGPHost.h | 17 ++++++++--------- source/sgp_mode/SGPSymbiont.h | 16 ++++++++-------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/source/sgp_mode/SGPHost.h b/source/sgp_mode/SGPHost.h index 51878a29..d7aa2e0f 100644 --- a/source/sgp_mode/SGPHost.h +++ b/source/sgp_mode/SGPHost.h @@ -50,7 +50,7 @@ class SGPHost : public Host { * object as my_config from superclass, but with the correct subtype. * */ - // emp::Ptr sgp_config; + emp::Ptr sgp_config; // // Function to configure functionality. // void ConfigureDefaults() { @@ -81,8 +81,8 @@ class SGPHost : public Host { ) : Host(_random, _world, _config, _intval, _syms, _repro_syms, _points), hardware(_world, this), - my_world(_world) - // sgp_config(_config) + my_world(_world), + sgp_config(_config) { } /** @@ -100,8 +100,8 @@ class SGPHost : public Host { ) : Host(_random, _world, _config, _intval, _syms, _repro_syms, _points), hardware(_world, this, genome), - my_world(_world) - // sgp_config(_config) + my_world(_world), + sgp_config(_config) { } SGPHost(const SGPHost& host) : @@ -263,7 +263,6 @@ class SGPHost : public Host { if (GetDead()) { return; } - // NOTE - Discuss timing of endosym pre-process signal and host preprocess signal // Currently endosyms go first and then hosts. This is to model endosyms // having opportunity to steal / donate cpu cycles and then host responding @@ -290,7 +289,7 @@ class SGPHost : public Host { } // Endosymbiont gains baseline number of CPU cycles cur_symbiont->GetHardware().GetCPUState().GainCPUCycles( - my_world->GetConfig().CYCLES_PER_UPDATE() + sgp_config->CYCLES_PER_UPDATE() ); my_world->TriggerBeforeEndoSymHostProcessSig( {endosym_i + 1, GetLocation().GetIndex()}, @@ -388,7 +387,7 @@ class SGPHost : public Host { * TODO: Perhaps Default mode should have something similar */ void AttemptReproduction(const emp::WorldPosition& pos) { - const double repro_cost = my_world->GetConfig().HOST_REPRO_RES(); + const double repro_cost = sgp_config->HOST_REPRO_RES(); if (GetPoints() >= repro_cost) { // Host pays cost DecPoints(repro_cost); @@ -434,7 +433,7 @@ class SGPHost : public Host { // Is this a host task? if (!task_env.IsHostTask(task_id)) continue; // Not first task - const bool not_first_task = my_world->GetConfig().HOST_ONLY_FIRST_TASK_CREDIT() && cpu_state.GetFirstTaskPerformed().Any() && !cpu_state.GetFirstTaskPerformed().Get(task_id); + const bool not_first_task = sgp_config->HOST_ONLY_FIRST_TASK_CREDIT() && cpu_state.GetFirstTaskPerformed().Any() && !cpu_state.GetFirstTaskPerformed().Get(task_id); if (not_first_task) { continue; } diff --git a/source/sgp_mode/SGPSymbiont.h b/source/sgp_mode/SGPSymbiont.h index 18668c34..0c5738a1 100644 --- a/source/sgp_mode/SGPSymbiont.h +++ b/source/sgp_mode/SGPSymbiont.h @@ -44,7 +44,7 @@ class SGPSymbiont : public Symbiont { * object as my_config from superclass, but with the correct subtype. * */ - // emp::Ptr sgp_config = NULL; + emp::Ptr sgp_config = NULL; public: /** * Constructs a new SGPSymbiont as an ancestor organism, with either a random @@ -60,9 +60,10 @@ class SGPSymbiont : public Symbiont { ) : Symbiont(_random, _world, _config, _intval, _points), hardware(_world, this), - my_world(_world) + my_world(_world), + sgp_config(_config) { - // sgp_config = _config; + } /** @@ -78,10 +79,9 @@ class SGPSymbiont : public Symbiont { ) : Symbiont(_random, _world, _config, _intval, _points), hardware(_world, this, genome), - my_world(_world) - { - // sgp_config = _config; - } + my_world(_world), + sgp_config(_config) + {} SGPSymbiont(const SGPSymbiont& symbiont) : Symbiont(symbiont), @@ -220,7 +220,7 @@ class SGPSymbiont : public Symbiont { if (GetDead()) { return; } - + GetHardware().GetCPUState().SetLocation(pos); if(my_host) my_world->TriggerBeforeEndoSymProcessSig(pos, *this, my_host); //Note: this is different than before_endosym_host_process_sig // Cash in cycles for this update From 2311cac4ea602ff37aedc20d14d9ac389439832d Mon Sep 17 00:00:00 2001 From: EliasH-E Date: Thu, 6 Aug 2026 15:55:10 -0500 Subject: [PATCH 06/18] adding prog builder --- source/sgp_mode/ProgramBuilder.h | 6 ++++++ source/sgp_mode/SGPConfigSetup.h | 6 ++++++ source/sgp_mode/SGPWorldSetup.cc | 9 +++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/source/sgp_mode/ProgramBuilder.h b/source/sgp_mode/ProgramBuilder.h index df5e385e..5cc42b2b 100644 --- a/source/sgp_mode/ProgramBuilder.h +++ b/source/sgp_mode/ProgramBuilder.h @@ -641,8 +641,14 @@ class ProgramBuilder { * Note: Warns if the program contains disabled instructions. */ program_t LoadProgramFile(const std::filesystem::path& path) { + //std::cout << std::filesystem::exists(path) << std::endl; + program_t program(path); + //for (auto& inst : program){ + // std::cout << inst << std::endl; + //} RectifyWithWarning(program); + return program; } diff --git a/source/sgp_mode/SGPConfigSetup.h b/source/sgp_mode/SGPConfigSetup.h index b09d31fe..03aa51f6 100644 --- a/source/sgp_mode/SGPConfigSetup.h +++ b/source/sgp_mode/SGPConfigSetup.h @@ -32,6 +32,12 @@ EMP_EXTEND_CONFIG(SymConfigSGP, SymConfigBase, GROUP(SGP_MUTATION, "SGP mutation group"), VALUE(SGP_MUT_PER_BIT_RATE, double, 0.01, "Per-bit mutation rate for sgp programs"), + GROUP(CUSTOM_PROGRAM, "Custom Program Settings"), + VALUE(PROGRAM_PATH, std::string, "example-settings-cfg/NandProgram100.json", "Json file that provides a custom starting program"), + VALUE(HOST_PROGRAM_PATH, std::string, "-1", "Json file that provides hosts a custom starting program, if -1 uses PROGRAM_PATH"), + VALUE(SYM_PROGRAM_PATH, std::string, "-1", "Json file that provides symbionts a custom starting program, if -1 uses PROGRAM_PATH"), + + GROUP(STRESS, "Stress Settings"), VALUE(ENABLE_STRESS, bool, false, "Stress interactions enabled?"), VALUE(STRESS_TYPE, std::string, "mutualist", "What kind of stress symbionts should be incorporated in stressful environments? (Options: 'mutualist', 'parasite', 'neutral')"), diff --git a/source/sgp_mode/SGPWorldSetup.cc b/source/sgp_mode/SGPWorldSetup.cc index 3fd95371..b20e1c43 100644 --- a/source/sgp_mode/SGPWorldSetup.cc +++ b/source/sgp_mode/SGPWorldSetup.cc @@ -386,8 +386,12 @@ void SGPWorld::SetupHosts(long unsigned int* POP_SIZE) { for (size_t i = 0; i < init_pop_size; ++i) { emp::Ptr new_host; sgp_prog_t init_prog( - prog_builder.CreateNandProgram(PROGRAM_LENGTH) + prog_builder.LoadProgramFile(sgp_config.PROGRAM_PATH()) + //prog_builder.CreateNandProgram(PROGRAM_LENGTH) ); + for (auto& inst : init_prog){ + std::cout << inst.GetOpName() << std::endl; + } switch (sgp_org_type) { case org_mode_t::DEFAULT: new_host = emp::NewPtr( @@ -410,7 +414,8 @@ void SGPWorld::SetupHosts(long unsigned int* POP_SIZE) { // - these endosymbionts have empty programs? if (sgp_config.START_MOI() == 1) { sgp_prog_t sym_prog( - prog_builder.CreateNandProgram(PROGRAM_LENGTH) + prog_builder.LoadProgramFile(sgp_config.PROGRAM_PATH()) + //prog_builder.CreateNandProgram(PROGRAM_LENGTH) ); emp::Ptr new_sym = emp::NewPtr( random_ptr, From e8b707395d2ba97879472fef5cb5a8f4460980c3 Mon Sep 17 00:00:00 2001 From: EliasH-E Date: Mon, 10 Aug 2026 12:30:53 -0500 Subject: [PATCH 07/18] fixed custom programs --- example-settings-cfg/NandProgram100.json | 4 +-- example-settings-cfg/NotNandProgram100.json | 4 +-- example-settings-cfg/NotProgram100.json | 4 +-- source/sgp_mode/ProgramBuilder.h | 4 --- source/sgp_mode/SGPWorldSetup.cc | 7 ++--- .../functional_tests/ProgramBuilder.test.cc | 29 +++++++++++++++++++ 6 files changed, 37 insertions(+), 15 deletions(-) diff --git a/example-settings-cfg/NandProgram100.json b/example-settings-cfg/NandProgram100.json index 5e227a9c..e60d1d29 100644 --- a/example-settings-cfg/NandProgram100.json +++ b/example-settings-cfg/NandProgram100.json @@ -7,7 +7,7 @@ "value1": 0, "value2": 0 }, - "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "bitstring": "1111111111111111111111111111111111111111111111111111111111111111", "descriptors": [ { "key": "summary", @@ -15,7 +15,7 @@ }, { "key": "tag bits", - "value": "0000000000000000000000000000000000000000000000000000000000000000" + "value": "1111111111111111111111111111111111111111111111111111111111111111" }, { "key": "tag moniker", diff --git a/example-settings-cfg/NotNandProgram100.json b/example-settings-cfg/NotNandProgram100.json index aaf90250..fba55256 100644 --- a/example-settings-cfg/NotNandProgram100.json +++ b/example-settings-cfg/NotNandProgram100.json @@ -7,7 +7,7 @@ "value1": 0, "value2": 0 }, - "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "bitstring": "1111111111111111111111111111111111111111111111111111111111111111", "descriptors": [ { "key": "summary", @@ -15,7 +15,7 @@ }, { "key": "tag bits", - "value": "0000000000000000000000000000000000000000000000000000000000000000" + "value": "1111111111111111111111111111111111111111111111111111111111111111" }, { "key": "tag moniker", diff --git a/example-settings-cfg/NotProgram100.json b/example-settings-cfg/NotProgram100.json index 4fa831be..7377f867 100644 --- a/example-settings-cfg/NotProgram100.json +++ b/example-settings-cfg/NotProgram100.json @@ -7,7 +7,7 @@ "value1": 0, "value2": 0 }, - "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "bitstring": "1111111111111111111111111111111111111111111111111111111111111111 ", "descriptors": [ { "key": "summary", @@ -15,7 +15,7 @@ }, { "key": "tag bits", - "value": "0000000000000000000000000000000000000000000000000000000000000000" + "value": "1111111111111111111111111111111111111111111111111111111111111111" }, { "key": "tag moniker", diff --git a/source/sgp_mode/ProgramBuilder.h b/source/sgp_mode/ProgramBuilder.h index 5cc42b2b..905ab06d 100644 --- a/source/sgp_mode/ProgramBuilder.h +++ b/source/sgp_mode/ProgramBuilder.h @@ -641,12 +641,8 @@ class ProgramBuilder { * Note: Warns if the program contains disabled instructions. */ program_t LoadProgramFile(const std::filesystem::path& path) { - //std::cout << std::filesystem::exists(path) << std::endl; program_t program(path); - //for (auto& inst : program){ - // std::cout << inst << std::endl; - //} RectifyWithWarning(program); return program; diff --git a/source/sgp_mode/SGPWorldSetup.cc b/source/sgp_mode/SGPWorldSetup.cc index b20e1c43..b1a51828 100644 --- a/source/sgp_mode/SGPWorldSetup.cc +++ b/source/sgp_mode/SGPWorldSetup.cc @@ -386,12 +386,9 @@ void SGPWorld::SetupHosts(long unsigned int* POP_SIZE) { for (size_t i = 0; i < init_pop_size; ++i) { emp::Ptr new_host; sgp_prog_t init_prog( - prog_builder.LoadProgramFile(sgp_config.PROGRAM_PATH()) - //prog_builder.CreateNandProgram(PROGRAM_LENGTH) + //prog_builder.LoadProgramFile(sgp_config.PROGRAM_PATH()) + prog_builder.CreateNandProgram(PROGRAM_LENGTH) ); - for (auto& inst : init_prog){ - std::cout << inst.GetOpName() << std::endl; - } switch (sgp_org_type) { case org_mode_t::DEFAULT: new_host = emp::NewPtr( diff --git a/source/test/sgp_mode_test/functional_tests/ProgramBuilder.test.cc b/source/test/sgp_mode_test/functional_tests/ProgramBuilder.test.cc index 86a3efbb..956baf02 100644 --- a/source/test/sgp_mode_test/functional_tests/ProgramBuilder.test.cc +++ b/source/test/sgp_mode_test/functional_tests/ProgramBuilder.test.cc @@ -149,6 +149,35 @@ TEST_CASE("ProgramBuilder generates a programs as advertised", "[sgp]") { ); } + WHEN("creating a NAND program from path") { + hw.Reset(); + // Set program of organism to something else + hw.SetProgram( + world.GetProgramBuilder().LoadProgramFile("source/test/sgp_mode_test/NandProgram100.json") + ); + world.AssignNewEnvIO(hw.GetCPUState()); + + // Run organism's hardware for 52 steps + hw.RunCPUStep(102); + auto& output_buffer = hw.GetCPUState().GetOutputBuffer(); + CheckTaskProfile( + world, + hw, + {}, + { "NOT","NAND","OR_NOT","AND","OR","AND_NOT","NOR","XOR","EQU" } + ); + REQUIRE(output_buffer.size() > 0); + sgp_host.ProcessOutputBuffer(); + REQUIRE(output_buffer.size() == 0); + CheckTaskProfile( + world, + hw, + { "NAND" }, + { "NOT", "OR_NOT","AND","OR","AND_NOT","XOR","NOR","EQU" } + ); + } + + WHEN("creating a repro program") { hw.Reset(); // Set program of organism to something else From be6be4c9a8ba40a6c075b00afde746fe0e900651 Mon Sep 17 00:00:00 2001 From: EliasH-E Date: Mon, 10 Aug 2026 14:27:30 -0500 Subject: [PATCH 08/18] made fixes, removed my name from tests teehee --- source/sgp_mode/SGPHost.h | 9 ++------- source/sgp_mode/SGPWorld.h | 3 --- source/sgp_mode/hardware/CPUState.h | 4 ---- .../test/sgp_mode_test/unit_tests/SGPHost.test.cc | 10 +++++++--- .../sgp_mode_test/unit_tests/SGPSymbiont.test.cc | 14 ++++++++++---- 5 files changed, 19 insertions(+), 21 deletions(-) diff --git a/source/sgp_mode/SGPHost.h b/source/sgp_mode/SGPHost.h index d7aa2e0f..79c52248 100644 --- a/source/sgp_mode/SGPHost.h +++ b/source/sgp_mode/SGPHost.h @@ -82,7 +82,7 @@ class SGPHost : public Host { Host(_random, _world, _config, _intval, _syms, _repro_syms, _points), hardware(_world, this), my_world(_world), - sgp_config(_config) + sgp_config(_config) { } /** @@ -101,7 +101,7 @@ class SGPHost : public Host { Host(_random, _world, _config, _intval, _syms, _repro_syms, _points), hardware(_world, this, genome), my_world(_world), - sgp_config(_config) + sgp_config(_config) { } SGPHost(const SGPHost& host) : @@ -171,11 +171,6 @@ class SGPHost : public Host { */ void SetReproCount(size_t _in) { reproductions = _in; } - //void SetLocation(emp::WorldPosition pos) { - //hardware.GetCPUState().SetLocation(pos); - //Host::SetLocation(pos); - //} - void DecPoints(double amt) { points -= amt; diff --git a/source/sgp_mode/SGPWorld.h b/source/sgp_mode/SGPWorld.h index 9d491073..e4fd9ad2 100644 --- a/source/sgp_mode/SGPWorld.h +++ b/source/sgp_mode/SGPWorld.h @@ -446,9 +446,6 @@ class SGPWorld : public SymWorld { (static_cast(org_ptr.Raw()))->GetHardware().GetCPUState(); } - // -- Signals to allow custom behavior to be triggered by other classes -- / - // AEV question: getter methods for these? - // begin_update_sig - Triggers at the beginning of an Update call. // Triggers before schedule update, before processing any organisms. // E.g., used for resetting any per-update data tracking. diff --git a/source/sgp_mode/hardware/CPUState.h b/source/sgp_mode/hardware/CPUState.h index 258cfee9..4d368e42 100644 --- a/source/sgp_mode/hardware/CPUState.h +++ b/source/sgp_mode/hardware/CPUState.h @@ -86,7 +86,6 @@ class CPUState { emp::Ptr organism; // Unowned pointer to organism using this CPU. emp::Ptr world_ptr; // Unowned pointer to the world using this CPU. - //emp::WorldPosition location; public: CPUState( @@ -148,7 +147,6 @@ class CPUState { jump_table.clear(); - //location = emp::WorldPosition(); } // Reset cpu state, but keep num_tasks the same. @@ -220,8 +218,6 @@ class CPUState { } } - // const emp::WorldPosition& GetLocation() const { return loc; } - void SetOrganism(emp::Ptr org_ptr) { organism = org_ptr; } diff --git a/source/test/sgp_mode_test/unit_tests/SGPHost.test.cc b/source/test/sgp_mode_test/unit_tests/SGPHost.test.cc index 61900c52..e9d79577 100644 --- a/source/test/sgp_mode_test/unit_tests/SGPHost.test.cc +++ b/source/test/sgp_mode_test/unit_tests/SGPHost.test.cc @@ -311,7 +311,7 @@ TEST_CASE("Check that hosts and syms can't have negative points", "[sgp][sgp-uni } } -TEST_CASE("CPUState and SGPHost always have the same location","[sgp][elias]"){ +TEST_CASE("CPUState and SGPHost always have the same location","[sgp]"){ using world_t = sgpmode::SGPWorld; using cpu_state_t = sgpmode::CPUState; using hw_spec_t = sgpmode::SGPHardwareSpec; @@ -325,11 +325,15 @@ TEST_CASE("CPUState and SGPHost always have the same location","[sgp][elias]"){ emp::Ptr host = emp::NewPtr(&random, &world, &config, prog_builder.CreateReproProgram(100)); WHEN("Initialized"){ - REQUIRE(host->GetHardware().GetCPUState().GetLocation().GetIndex() == host->GetLocation().GetIndex()); + THEN("Host and CPUState return the same location"){ + REQUIRE(host->GetHardware().GetCPUState().GetLocation().GetIndex() == host->GetLocation().GetIndex()); + } } WHEN("Host has location set"){ host->SetLocation(emp::WorldPosition(1, 2)); - REQUIRE(host->GetHardware().GetCPUState().GetLocation().GetIndex() == host->GetLocation().GetIndex()); + THEN("Symbiont and CPUState return the same location"){ + REQUIRE(host->GetHardware().GetCPUState().GetLocation().GetIndex() == host->GetLocation().GetIndex()); + } } WHEN("CPUState has location set"){ host->GetHardware().GetCPUState().SetLocation(emp::WorldPosition(3, 4)); diff --git a/source/test/sgp_mode_test/unit_tests/SGPSymbiont.test.cc b/source/test/sgp_mode_test/unit_tests/SGPSymbiont.test.cc index b5d62848..ef10e8a8 100644 --- a/source/test/sgp_mode_test/unit_tests/SGPSymbiont.test.cc +++ b/source/test/sgp_mode_test/unit_tests/SGPSymbiont.test.cc @@ -133,7 +133,7 @@ TEST_CASE("Symbiont Process", "[sgp][sgp-unit]") { // } // } -TEST_CASE("CPUState and SGPSymbiont always have the same location","[sgp][elias]"){ +TEST_CASE("CPUState and SGPSymbiont always have the same location","[sgp]"){ using world_t = sgpmode::SGPWorld; using cpu_state_t = sgpmode::CPUState; using hw_spec_t = sgpmode::SGPHardwareSpec; @@ -147,15 +147,21 @@ TEST_CASE("CPUState and SGPSymbiont always have the same location","[sgp][elias] emp::Ptr sym = emp::NewPtr(&random, &world, &config, prog_builder.CreateReproProgram(100)); WHEN("Initialized"){ - REQUIRE(sym->GetHardware().GetCPUState().GetLocation().GetIndex() == sym->GetLocation().GetIndex()); + THEN("Symbiont and CPUState return the same location"){ + REQUIRE(sym->GetHardware().GetCPUState().GetLocation().GetIndex() == sym->GetLocation().GetIndex()); + } } WHEN("Symbiont has location set"){ sym->SetLocation(emp::WorldPosition(1, 2)); - REQUIRE(sym->GetHardware().GetCPUState().GetLocation().GetIndex() == sym->GetLocation().GetIndex()); + THEN("Symbiont and CPUState return the same location"){ + REQUIRE(sym->GetHardware().GetCPUState().GetLocation().GetIndex() == sym->GetLocation().GetIndex()); + } } WHEN("CPUState has location set"){ sym->GetHardware().GetCPUState().SetLocation(emp::WorldPosition(3, 4)); - REQUIRE(sym->GetHardware().GetCPUState().GetLocation().GetIndex() == sym->GetLocation().GetIndex()); + THEN("Symbiont and CPUState return the same location"){ + REQUIRE(sym->GetHardware().GetCPUState().GetLocation().GetIndex() == sym->GetLocation().GetIndex()); + } } } \ No newline at end of file From 1f7e009bba358d5ce51dfe7ea73c8fbbe120649e Mon Sep 17 00:00:00 2001 From: EliasH-E Date: Mon, 10 Aug 2026 15:51:18 -0500 Subject: [PATCH 09/18] fixed tag moniker(kinda) --- example-settings-cfg/NandProgram100.json | 2 +- example-settings-cfg/NotNandProgram100.json | 2 +- example-settings-cfg/NotProgram100.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/example-settings-cfg/NandProgram100.json b/example-settings-cfg/NandProgram100.json index e60d1d29..88f2aa82 100644 --- a/example-settings-cfg/NandProgram100.json +++ b/example-settings-cfg/NandProgram100.json @@ -19,7 +19,7 @@ }, { "key": "tag moniker", - "value": "sad ibex" + "value": "flawed mayfly" } ] }, diff --git a/example-settings-cfg/NotNandProgram100.json b/example-settings-cfg/NotNandProgram100.json index fba55256..8f7d40cc 100644 --- a/example-settings-cfg/NotNandProgram100.json +++ b/example-settings-cfg/NotNandProgram100.json @@ -19,7 +19,7 @@ }, { "key": "tag moniker", - "value": "sad ibex" + "value": "flawed mayfly" } ] }, diff --git a/example-settings-cfg/NotProgram100.json b/example-settings-cfg/NotProgram100.json index 7377f867..8cd1e000 100644 --- a/example-settings-cfg/NotProgram100.json +++ b/example-settings-cfg/NotProgram100.json @@ -19,7 +19,7 @@ }, { "key": "tag moniker", - "value": "sad ibex" + "value": "flawed mayfly" } ] }, From 05c372ceca123625a364ca99379f331e9906af21 Mon Sep 17 00:00:00 2001 From: EliasH-E Date: Mon, 10 Aug 2026 15:55:59 -0500 Subject: [PATCH 10/18] started working on program path stuff, will return to soon --- source/sgp_mode/SGPConfigSetup.h | 5 ++--- source/sgp_mode/SGPWorldSetup.cc | 20 ++++++++++++++++--- source/sgp_mode/tasks/LogicTaskEnvironment.h | 2 ++ .../unit_tests/ProgramBuilder.test.cc | 7 ++++++- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/source/sgp_mode/SGPConfigSetup.h b/source/sgp_mode/SGPConfigSetup.h index 03aa51f6..1fe9810b 100644 --- a/source/sgp_mode/SGPConfigSetup.h +++ b/source/sgp_mode/SGPConfigSetup.h @@ -33,9 +33,8 @@ EMP_EXTEND_CONFIG(SymConfigSGP, SymConfigBase, VALUE(SGP_MUT_PER_BIT_RATE, double, 0.01, "Per-bit mutation rate for sgp programs"), GROUP(CUSTOM_PROGRAM, "Custom Program Settings"), - VALUE(PROGRAM_PATH, std::string, "example-settings-cfg/NandProgram100.json", "Json file that provides a custom starting program"), - VALUE(HOST_PROGRAM_PATH, std::string, "-1", "Json file that provides hosts a custom starting program, if -1 uses PROGRAM_PATH"), - VALUE(SYM_PROGRAM_PATH, std::string, "-1", "Json file that provides symbionts a custom starting program, if -1 uses PROGRAM_PATH"), + VALUE(HOST_PROGRAM_PATH, std::string, "Default-Config-jsons/NandProgram100.json", "Json file that provides hosts a custom starting program"), + VALUE(SYM_PROGRAM_PATH, std::string, "Default-Config-jsons/NandProgram100.json", "Json file that provides symbionts a custom starting program"), GROUP(STRESS, "Stress Settings"), diff --git a/source/sgp_mode/SGPWorldSetup.cc b/source/sgp_mode/SGPWorldSetup.cc index b1a51828..8e11de58 100644 --- a/source/sgp_mode/SGPWorldSetup.cc +++ b/source/sgp_mode/SGPWorldSetup.cc @@ -383,11 +383,18 @@ void SGPWorld::SetupHosts(long unsigned int* POP_SIZE) { const size_t init_pop_size = *POP_SIZE; emp_assert(init_pop_size <= scheduler.GetScheduleSize()); + const bool host_prog_file_exists = std::filesystem::exists(sgp_config.HOST_PROGRAM_PATH()); + if (!host_prog_file_exists) { + std::cout << "Host program file does not exist: " << sgp_config.HOST_PROGRAM_PATH() << std::endl; + + //Check if config is default, then create file of default task(differntial) + std::exit(EXIT_FAILURE); + } for (size_t i = 0; i < init_pop_size; ++i) { emp::Ptr new_host; sgp_prog_t init_prog( - //prog_builder.LoadProgramFile(sgp_config.PROGRAM_PATH()) - prog_builder.CreateNandProgram(PROGRAM_LENGTH) + prog_builder.LoadProgramFile(sgp_config.HOST_PROGRAM_PATH()) + //prog_builder.CreateNandProgram(PROGRAM_LENGTH) ); switch (sgp_org_type) { case org_mode_t::DEFAULT: @@ -410,8 +417,15 @@ void SGPWorld::SetupHosts(long unsigned int* POP_SIZE) { // NOTE - what about other Start MOI values? // - these endosymbionts have empty programs? if (sgp_config.START_MOI() == 1) { + const bool sym_prog_file_exists = std::filesystem::exists(sgp_config.SYM_PROGRAM_PATH()); + if (!sym_prog_file_exists) { + std::cout << "Symbiont program file does not exist: " << sgp_config.SYM_PROGRAM_PATH() << std::endl; + + //Check if config is default, then create file of default task(differntial) + std::exit(EXIT_FAILURE); + } sgp_prog_t sym_prog( - prog_builder.LoadProgramFile(sgp_config.PROGRAM_PATH()) + prog_builder.LoadProgramFile(sgp_config.SYM_PROGRAM_PATH()) //prog_builder.CreateNandProgram(PROGRAM_LENGTH) ); emp::Ptr new_sym = emp::NewPtr( diff --git a/source/sgp_mode/tasks/LogicTaskEnvironment.h b/source/sgp_mode/tasks/LogicTaskEnvironment.h index d5add786..d67402ef 100644 --- a/source/sgp_mode/tasks/LogicTaskEnvironment.h +++ b/source/sgp_mode/tasks/LogicTaskEnvironment.h @@ -185,6 +185,8 @@ void LogicTaskEnvironment::LoadTasks(const std::string& env_filepath) { const bool env_file_exists = std::filesystem::exists(env_filepath); if (!env_file_exists) { std::cout << "Environment file does not exist: " << env_filepath << std::endl; + + //Check if config is default, then create file of default task(differntial) std::exit(EXIT_FAILURE); } // If environment file exists, read it. diff --git a/source/test/sgp_mode_test/unit_tests/ProgramBuilder.test.cc b/source/test/sgp_mode_test/unit_tests/ProgramBuilder.test.cc index ff38c0ad..568cc255 100644 --- a/source/test/sgp_mode_test/unit_tests/ProgramBuilder.test.cc +++ b/source/test/sgp_mode_test/unit_tests/ProgramBuilder.test.cc @@ -638,12 +638,17 @@ std::string ReadFileContents(const std::filesystem::path& path) { return oss.str(); } -TEST_CASE("Example program files regenerate identically", "[sgp][sgp-unit]"){ +TEST_CASE("Example program files regenerate identically", "[sgp][sgp-unit][elias]"){ + using tag_t = typename hw_spec_t::tag_t; GIVEN("A program builder"){ const size_t program_len = 100; + sgpl::OpCodeRectifier rectifier; sgpmode::ProgramBuilder builder(rectifier); + tag_t START_TAG; + START_TAG.SetUInt64(0, std::numeric_limits::max()); + builder.SetStartTag(START_TAG); WHEN("NotProgram100.json is regenerated"){ const std::string json_str = builder.MakeJsonString( builder.CreateNotProgram(program_len) From 11d618b7c564987b81ca0a6b1fae086dc8392214 Mon Sep 17 00:00:00 2001 From: EliasH-E Date: Tue, 11 Aug 2026 09:46:36 -0500 Subject: [PATCH 11/18] added default creation --- source/sgp_mode/SGPWorld.h | 3 +++ source/sgp_mode/SGPWorldSetup.cc | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/source/sgp_mode/SGPWorld.h b/source/sgp_mode/SGPWorld.h index e4fd9ad2..bb4d1b8a 100644 --- a/source/sgp_mode/SGPWorld.h +++ b/source/sgp_mode/SGPWorld.h @@ -21,6 +21,7 @@ #include #include +#include // TODO - Document how each base configuration works for SGPWorld // TODO - Comments for every member variable / function / type alias @@ -415,6 +416,8 @@ class SGPWorld : public SymWorld { void SetupStressInteractions(); void SetupHealthInteractions(); void SetupNutrientInteractions(); + + void GenerateDefaultProgram(); // Clear all world signals void ClearWorldSignals() { diff --git a/source/sgp_mode/SGPWorldSetup.cc b/source/sgp_mode/SGPWorldSetup.cc index 8e11de58..9539dedd 100644 --- a/source/sgp_mode/SGPWorldSetup.cc +++ b/source/sgp_mode/SGPWorldSetup.cc @@ -572,6 +572,18 @@ void SGPWorld::SetupMutator() { // same with endosymbionts / etc } + +void SGPWorld::GenerateDefaultProgram(bool is_host){ + std::string path; + if(is_host){ + path = sgp_config.HOST_PROGRAM_PATH(); + } + else{ + path = sgp_config.SYM_PROGRAM_PATH(); + } + SaveProgramFile(prog_builder.CreateNandProgram(PROGRAM_LENGTH), path); +} + } #endif \ No newline at end of file From 923b7445c1aebe866509761d2b172ee407a39761 Mon Sep 17 00:00:00 2001 From: EliasH-E Date: Tue, 11 Aug 2026 16:05:26 -0500 Subject: [PATCH 12/18] added default construction and checking for genomes --- source/sgp_mode/SGPConfigSetup.h | 4 ++-- source/sgp_mode/SGPWorld.h | 2 +- source/sgp_mode/SGPWorldSetup.cc | 23 +++++++++++++++++++---- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/source/sgp_mode/SGPConfigSetup.h b/source/sgp_mode/SGPConfigSetup.h index 1fe9810b..5295841f 100644 --- a/source/sgp_mode/SGPConfigSetup.h +++ b/source/sgp_mode/SGPConfigSetup.h @@ -33,8 +33,8 @@ EMP_EXTEND_CONFIG(SymConfigSGP, SymConfigBase, VALUE(SGP_MUT_PER_BIT_RATE, double, 0.01, "Per-bit mutation rate for sgp programs"), GROUP(CUSTOM_PROGRAM, "Custom Program Settings"), - VALUE(HOST_PROGRAM_PATH, std::string, "Default-Config-jsons/NandProgram100.json", "Json file that provides hosts a custom starting program"), - VALUE(SYM_PROGRAM_PATH, std::string, "Default-Config-jsons/NandProgram100.json", "Json file that provides symbionts a custom starting program"), + VALUE(HOST_PROGRAM_PATH, std::string, "NewDefault.json", "Json file that provides hosts a custom starting program"), + VALUE(SYM_PROGRAM_PATH, std::string, "SymNewDefault.json", "Json file that provides symbionts a custom starting program"), GROUP(STRESS, "Stress Settings"), diff --git a/source/sgp_mode/SGPWorld.h b/source/sgp_mode/SGPWorld.h index bb4d1b8a..1c338397 100644 --- a/source/sgp_mode/SGPWorld.h +++ b/source/sgp_mode/SGPWorld.h @@ -417,7 +417,7 @@ class SGPWorld : public SymWorld { void SetupHealthInteractions(); void SetupNutrientInteractions(); - void GenerateDefaultProgram(); + void GenerateDefaultProgram(bool is_host); // Clear all world signals void ClearWorldSignals() { diff --git a/source/sgp_mode/SGPWorldSetup.cc b/source/sgp_mode/SGPWorldSetup.cc index 9539dedd..84e02255 100644 --- a/source/sgp_mode/SGPWorldSetup.cc +++ b/source/sgp_mode/SGPWorldSetup.cc @@ -385,9 +385,17 @@ void SGPWorld::SetupHosts(long unsigned int* POP_SIZE) { emp_assert(init_pop_size <= scheduler.GetScheduleSize()); const bool host_prog_file_exists = std::filesystem::exists(sgp_config.HOST_PROGRAM_PATH()); if (!host_prog_file_exists) { + if(sgp_config["HOST_PROGRAM_PATH"]->GetDefault() == sgp_config["HOST_PROGRAM_PATH"]->GetLiteralValue()){ + std::cout << "Default Host program file does not exist: " << sgp_config.HOST_PROGRAM_PATH() << std::endl; + std::cout << "Generating now... " << std::endl; + GenerateDefaultProgram(true); + std::cout << "Run ./symbulation_sgp again to use new Host program" << std::endl; + std::cout << "Exiting.." << std::endl; + } + else{ std::cout << "Host program file does not exist: " << sgp_config.HOST_PROGRAM_PATH() << std::endl; + } - //Check if config is default, then create file of default task(differntial) std::exit(EXIT_FAILURE); } for (size_t i = 0; i < init_pop_size; ++i) { @@ -419,9 +427,16 @@ void SGPWorld::SetupHosts(long unsigned int* POP_SIZE) { if (sgp_config.START_MOI() == 1) { const bool sym_prog_file_exists = std::filesystem::exists(sgp_config.SYM_PROGRAM_PATH()); if (!sym_prog_file_exists) { + if(sgp_config["SYM_PROGRAM_PATH"]->GetDefault() == sgp_config["SYM_PROGRAM_PATH"]->GetLiteralValue()){ + std::cout << "Default Symbiont program file does not exist: " << sgp_config.SYM_PROGRAM_PATH() << std::endl; + std::cout << "Generating now... " << std::endl; + GenerateDefaultProgram(false); + std::cout << "Run ./symbulation_sgp again to use new Symbiont program" << std::endl; + std::cout << "Exiting.." << std::endl; + } + else{ std::cout << "Symbiont program file does not exist: " << sgp_config.SYM_PROGRAM_PATH() << std::endl; - - //Check if config is default, then create file of default task(differntial) + } std::exit(EXIT_FAILURE); } sgp_prog_t sym_prog( @@ -581,7 +596,7 @@ void SGPWorld::GenerateDefaultProgram(bool is_host){ else{ path = sgp_config.SYM_PROGRAM_PATH(); } - SaveProgramFile(prog_builder.CreateNandProgram(PROGRAM_LENGTH), path); + prog_builder.SaveProgramFile(prog_builder.CreateNandProgram(PROGRAM_LENGTH), path); } } From fefb72581bc5f9fb324a02642b032703962dd996 Mon Sep 17 00:00:00 2001 From: EliasH-E Date: Tue, 11 Aug 2026 16:36:01 -0500 Subject: [PATCH 13/18] fixed tests --- example-settings-cfg/NotProgram100.json | 2 +- example-settings-cfg/ReproProgram100.json | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/example-settings-cfg/NotProgram100.json b/example-settings-cfg/NotProgram100.json index 8cd1e000..2b5e83ae 100644 --- a/example-settings-cfg/NotProgram100.json +++ b/example-settings-cfg/NotProgram100.json @@ -7,7 +7,7 @@ "value1": 0, "value2": 0 }, - "bitstring": "1111111111111111111111111111111111111111111111111111111111111111 ", + "bitstring": "1111111111111111111111111111111111111111111111111111111111111111", "descriptors": [ { "key": "summary", diff --git a/example-settings-cfg/ReproProgram100.json b/example-settings-cfg/ReproProgram100.json index afa02815..d2139506 100644 --- a/example-settings-cfg/ReproProgram100.json +++ b/example-settings-cfg/ReproProgram100.json @@ -7,7 +7,7 @@ "value1": 0, "value2": 0 }, - "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "bitstring": "1111111111111111111111111111111111111111111111111111111111111111", "descriptors": [ { "key": "summary", @@ -15,11 +15,11 @@ }, { "key": "tag bits", - "value": "0000000000000000000000000000000000000000000000000000000000000000" + "value": "1111111111111111111111111111111111111111111111111111111111111111" }, { "key": "tag moniker", - "value": "sad ibex" + "value": "flawed mayfly" } ] }, From 10674c524321b49eb4127a75141fa2ec4b0a4408 Mon Sep 17 00:00:00 2001 From: EliasH-E Date: Tue, 11 Aug 2026 16:38:24 -0500 Subject: [PATCH 14/18] changed default configs --- source/sgp_mode/SGPConfigSetup.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/sgp_mode/SGPConfigSetup.h b/source/sgp_mode/SGPConfigSetup.h index 5295841f..1fe9810b 100644 --- a/source/sgp_mode/SGPConfigSetup.h +++ b/source/sgp_mode/SGPConfigSetup.h @@ -33,8 +33,8 @@ EMP_EXTEND_CONFIG(SymConfigSGP, SymConfigBase, VALUE(SGP_MUT_PER_BIT_RATE, double, 0.01, "Per-bit mutation rate for sgp programs"), GROUP(CUSTOM_PROGRAM, "Custom Program Settings"), - VALUE(HOST_PROGRAM_PATH, std::string, "NewDefault.json", "Json file that provides hosts a custom starting program"), - VALUE(SYM_PROGRAM_PATH, std::string, "SymNewDefault.json", "Json file that provides symbionts a custom starting program"), + VALUE(HOST_PROGRAM_PATH, std::string, "Default-Config-jsons/NandProgram100.json", "Json file that provides hosts a custom starting program"), + VALUE(SYM_PROGRAM_PATH, std::string, "Default-Config-jsons/NandProgram100.json", "Json file that provides symbionts a custom starting program"), GROUP(STRESS, "Stress Settings"), From 338f4fa65ab3dd5dc36aaf9f2f3cbf4ddb5a471d Mon Sep 17 00:00:00 2001 From: EliasH-E Date: Wed, 12 Aug 2026 08:47:40 -0500 Subject: [PATCH 15/18] added default programs --- Default-Config-jsons/NandProgram100.json | 1487 +++++++++++++++++++++ Default-Config-jsons/diff-reward-env.json | 15 + 2 files changed, 1502 insertions(+) create mode 100644 Default-Config-jsons/NandProgram100.json create mode 100644 Default-Config-jsons/diff-reward-env.json diff --git a/Default-Config-jsons/NandProgram100.json b/Default-Config-jsons/NandProgram100.json new file mode 100644 index 00000000..e60d1d29 --- /dev/null +++ b/Default-Config-jsons/NandProgram100.json @@ -0,0 +1,1487 @@ +{ + "value0": [ + { + "operation": "Global Anchor", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "1111111111111111111111111111111111111111111111111111111111111111", + "descriptors": [ + { + "key": "summary", + "value": "register a global jump-to destination, maybe terminate" + }, + { + "key": "tag bits", + "value": "1111111111111111111111111111111111111111111111111111111111111111" + }, + { + "key": "tag moniker", + "value": "sad ibex" + } + ] + }, + { + "operation": "IO", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [] + }, + { + "operation": "IO", + "args": { + "value0": 1, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [] + }, + { + "operation": "IO", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [] + }, + { + "operation": "Nand", + "args": { + "value0": 0, + "value1": 1, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Reproduce", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [] + } + ] +} \ No newline at end of file diff --git a/Default-Config-jsons/diff-reward-env.json b/Default-Config-jsons/diff-reward-env.json new file mode 100644 index 00000000..6ff8a65f --- /dev/null +++ b/Default-Config-jsons/diff-reward-env.json @@ -0,0 +1,15 @@ +{ + "shared": { + "tasks": [ + {"name": "NAND", "value": 1, "reward_mode": "add"}, + {"name": "NOT", "value": 1, "reward_mode": "add"}, + {"name": "OR_NOT", "value": 2, "reward_mode": "add"}, + {"name": "AND", "value": 2, "reward_mode": "add"}, + {"name": "OR", "value": 4, "reward_mode": "add"}, + {"name": "AND_NOT", "value": 4, "reward_mode": "add"}, + {"name": "NOR", "value": 8, "reward_mode": "add"}, + {"name": "XOR", "value": 8, "reward_mode": "add"}, + {"name": "EQU", "value": 16, "reward_mode": "add"} + ] + } +} \ No newline at end of file From 740df36367506b431e7560a52e704a62bbc735e0 Mon Sep 17 00:00:00 2001 From: EliasH-E Date: Wed, 12 Aug 2026 10:48:41 -0500 Subject: [PATCH 16/18] added nand test program --- source/test/sgp_mode_test/NandProgram100.json | 1487 +++++++++++++++++ 1 file changed, 1487 insertions(+) create mode 100644 source/test/sgp_mode_test/NandProgram100.json diff --git a/source/test/sgp_mode_test/NandProgram100.json b/source/test/sgp_mode_test/NandProgram100.json new file mode 100644 index 00000000..88f2aa82 --- /dev/null +++ b/source/test/sgp_mode_test/NandProgram100.json @@ -0,0 +1,1487 @@ +{ + "value0": [ + { + "operation": "Global Anchor", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "1111111111111111111111111111111111111111111111111111111111111111", + "descriptors": [ + { + "key": "summary", + "value": "register a global jump-to destination, maybe terminate" + }, + { + "key": "tag bits", + "value": "1111111111111111111111111111111111111111111111111111111111111111" + }, + { + "key": "tag moniker", + "value": "flawed mayfly" + } + ] + }, + { + "operation": "IO", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [] + }, + { + "operation": "IO", + "args": { + "value0": 1, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [] + }, + { + "operation": "IO", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [] + }, + { + "operation": "Nand", + "args": { + "value0": 0, + "value1": 1, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Nop-0", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [ + { + "key": "summary", + "value": "perform no operation" + } + ] + }, + { + "operation": "Reproduce", + "args": { + "value0": 0, + "value1": 0, + "value2": 0 + }, + "bitstring": "0000000000000000000000000000000000000000000000000000000000000000", + "descriptors": [] + } + ] +} \ No newline at end of file From 1a1af53a52b0957398fc14c320557811a45ba07b Mon Sep 17 00:00:00 2001 From: EliasH-E Date: Wed, 12 Aug 2026 12:46:33 -0500 Subject: [PATCH 17/18] added Task Env Default creation programs --- source/sgp_mode/SGPConfigSetup.h | 2 +- source/sgp_mode/SGPWorld.h | 1 + source/sgp_mode/SGPWorldSetup.cc | 45 +++++++++++++++++++ source/sgp_mode/tasks/LogicTaskEnvironment.h | 9 +--- .../functional_tests/ProgramBuilder.test.cc | 2 +- 5 files changed, 49 insertions(+), 10 deletions(-) diff --git a/source/sgp_mode/SGPConfigSetup.h b/source/sgp_mode/SGPConfigSetup.h index 1fe9810b..12f0c14a 100644 --- a/source/sgp_mode/SGPConfigSetup.h +++ b/source/sgp_mode/SGPConfigSetup.h @@ -67,7 +67,7 @@ EMP_EXTEND_CONFIG(SymConfigSGP, SymConfigBase, VALUE(PARASITE_BASE_TASK_VALUE_PROP, double, 0.25, "Proportion of task value (defined by environment) that parasites receive when they fail to interact with their host."), GROUP(TASK_ENVIRONMENT, "Task environment settings"), - VALUE(TASK_ENV_CFG_PATH, std::string, "environment.json", "Json file that provides environment configuration"), + VALUE(TASK_ENV_CFG_PATH, std::string, "Default-Config-jsons/diff-reward-env.json", "Json file that provides environment configuration"), VALUE(TASK_IO_BANK_SIZE, size_t, 100000, "How many possible task input/output combinations to pre-generate?"), VALUE(TASK_IO_UNIQUE_OUTPUT, bool, true, "Should each output in the pregenerated io combinations be unique?"), VALUE(HOST_ONLY_FIRST_TASK_CREDIT, bool, false, "Only give host credit for one task (whatever they do first)?"), diff --git a/source/sgp_mode/SGPWorld.h b/source/sgp_mode/SGPWorld.h index 1c338397..20a0372c 100644 --- a/source/sgp_mode/SGPWorld.h +++ b/source/sgp_mode/SGPWorld.h @@ -418,6 +418,7 @@ class SGPWorld : public SymWorld { void SetupNutrientInteractions(); void GenerateDefaultProgram(bool is_host); + void GenerateDefaultTaskEnvironment(); // Clear all world signals void ClearWorldSignals() { diff --git a/source/sgp_mode/SGPWorldSetup.cc b/source/sgp_mode/SGPWorldSetup.cc index 84e02255..92de8d9b 100644 --- a/source/sgp_mode/SGPWorldSetup.cc +++ b/source/sgp_mode/SGPWorldSetup.cc @@ -503,6 +503,21 @@ void SGPWorld::SetupSymbionts(long unsigned int* total_syms) { void SGPWorld::SetupTaskEnvironment() { // TODO - configure any world <--> environment interactions that need to be // setup prior to run + const bool env_file_exists = std::filesystem::exists(sgp_config.TASK_ENV_CFG_PATH()); + if (!env_file_exists) { + if(sgp_config["TASK_ENV_CFG_PATH"]->GetDefault() == sgp_config["TASK_ENV_CFG_PATH"]->GetLiteralValue()){ + std::cout << "Default Task Environment file does not exist: " << sgp_config.TASK_ENV_CFG_PATH() << std::endl; + std::cout << "Generating now... " << std::endl; + GenerateDefaultTaskEnvironment(); + std::cout << "Run ./symbulation_sgp again to use new Task Environment" << std::endl; + std::cout << "Exiting.." << std::endl; + } + else{ + std::cout << "Environment file does not exist: " << sgp_config.TASK_ENV_CFG_PATH() << std::endl; + } + + std::exit(EXIT_FAILURE); + } task_env.Setup( sgp_config.TASK_ENV_CFG_PATH(), sgp_config.TASK_IO_BANK_SIZE(), @@ -599,6 +614,36 @@ void SGPWorld::GenerateDefaultProgram(bool is_host){ prog_builder.SaveProgramFile(prog_builder.CreateNandProgram(PROGRAM_LENGTH), path); } +void SGPWorld::GenerateDefaultTaskEnvironment(){ + std::string path = sgp_config.TASK_ENV_CFG_PATH(); + + std::ofstream envFile(path); + + if (!envFile) { + std::cout << "Error: Could not create new environment file" << std::endl; + std::exit(EXIT_FAILURE); + } + + envFile << R"({ + "shared": { + "tasks": [ + {"name": "NAND", "value": 1, "reward_mode": "add"}, + {"name": "NOT", "value": 1, "reward_mode": "add"}, + {"name": "OR_NOT", "value": 2, "reward_mode": "add"}, + {"name": "AND", "value": 2, "reward_mode": "add"}, + {"name": "OR", "value": 4, "reward_mode": "add"}, + {"name": "AND_NOT", "value": 4, "reward_mode": "add"}, + {"name": "NOR", "value": 8, "reward_mode": "add"}, + {"name": "XOR", "value": 8, "reward_mode": "add"}, + {"name": "EQU", "value": 16, "reward_mode": "add"} + ] + } +})"; + + envFile.close(); + +} + } #endif \ No newline at end of file diff --git a/source/sgp_mode/tasks/LogicTaskEnvironment.h b/source/sgp_mode/tasks/LogicTaskEnvironment.h index d67402ef..8992a617 100644 --- a/source/sgp_mode/tasks/LogicTaskEnvironment.h +++ b/source/sgp_mode/tasks/LogicTaskEnvironment.h @@ -181,15 +181,8 @@ void LogicTaskEnvironment::LoadTasks(const std::string& env_filepath) { // Then, tasks can be associated with a particular resource pool. // === Parse environment file === - // Check if given environment file exists. Exit if not. - const bool env_file_exists = std::filesystem::exists(env_filepath); - if (!env_file_exists) { - std::cout << "Environment file does not exist: " << env_filepath << std::endl; + emp_assert(std::filesystem::exists(env_filepath)); - //Check if config is default, then create file of default task(differntial) - std::exit(EXIT_FAILURE); - } - // If environment file exists, read it. std::ifstream env_ifstream(env_filepath); nlohmann::json env_json; env_ifstream >> env_json; diff --git a/source/test/sgp_mode_test/functional_tests/ProgramBuilder.test.cc b/source/test/sgp_mode_test/functional_tests/ProgramBuilder.test.cc index 956baf02..92465207 100644 --- a/source/test/sgp_mode_test/functional_tests/ProgramBuilder.test.cc +++ b/source/test/sgp_mode_test/functional_tests/ProgramBuilder.test.cc @@ -157,7 +157,7 @@ TEST_CASE("ProgramBuilder generates a programs as advertised", "[sgp]") { ); world.AssignNewEnvIO(hw.GetCPUState()); - // Run organism's hardware for 52 steps + // Run organism's hardware for 102 steps hw.RunCPUStep(102); auto& output_buffer = hw.GetCPUState().GetOutputBuffer(); CheckTaskProfile( From cad8cf3511b3d7f54f67368df033fd35aa2bf4a8 Mon Sep 17 00:00:00 2001 From: EliasH-E Date: Wed, 12 Aug 2026 14:12:15 -0500 Subject: [PATCH 18/18] added documentation to default generator programs --- source/sgp_mode/SGPWorldSetup.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/source/sgp_mode/SGPWorldSetup.cc b/source/sgp_mode/SGPWorldSetup.cc index 92de8d9b..904be834 100644 --- a/source/sgp_mode/SGPWorldSetup.cc +++ b/source/sgp_mode/SGPWorldSetup.cc @@ -602,7 +602,13 @@ void SGPWorld::SetupMutator() { // same with endosymbionts / etc } - +/** + * Input: Bool, Whether the missing default program is the host or sym program. + * + * Output: None. + * + * Purpose: Creates the default genome and then ends the simulation + */ void SGPWorld::GenerateDefaultProgram(bool is_host){ std::string path; if(is_host){ @@ -614,6 +620,13 @@ void SGPWorld::GenerateDefaultProgram(bool is_host){ prog_builder.SaveProgramFile(prog_builder.CreateNandProgram(PROGRAM_LENGTH), path); } +/** + * Input: None + * + * Output: None + * + * Purpose: Creates the default task environment and then ends the simulation + */ void SGPWorld::GenerateDefaultTaskEnvironment(){ std::string path = sgp_config.TASK_ENV_CFG_PATH();