@@ -65,7 +65,7 @@ void SGPWorld::SetupSymbionts(unsigned long *total_syms) {
6565 */
6666void SGPWorld::SetupTaskProfileFun () {
6767 if (sgp_config->TRACK_PARENT_TASKS ()) {
68- fun_get_task_profile = [](const emp::Ptr<Organism> org) -> emp::BitSet<CPU_BITSET_LENGTH >&{
68+ fun_get_task_profile = [](const emp::Ptr<Organism> org) -> const emp::BitSet<CPU_BITSET_LENGTH >&{
6969 if (org->IsHost ()) {
7070 return *org.DynamicCast <SGPHost>()->GetCPU ().state .parent_tasks_performed ;
7171 }
@@ -147,7 +147,7 @@ void SGPWorld::ProcessReproductionQueue() {
147147 *
148148 * Purpose: Searches through up to 10 hosts in the world to find a host that the symbiont can infect.
149149 */
150- int SGPWorld::GetNeighborHost (size_t source_id, emp::BitSet<CPU_BITSET_LENGTH >& symbiont_tasks){
150+ int SGPWorld::GetNeighborHost (size_t source_id, const emp::BitSet<CPU_BITSET_LENGTH >& symbiont_tasks){
151151 // Attempt to find host that matches some tasks
152152 for (int i = 0 ; i < 10 ; i++) {
153153 emp::WorldPosition neighbor = GetRandomNeighborPos (source_id);
@@ -170,7 +170,7 @@ int SGPWorld::GetNeighborHost (size_t source_id, emp::BitSet<CPU_BITSET_LENGTH>&
170170 *
171171 * Purpose: To check for task matching before transmission
172172 */
173- bool SGPWorld::TaskMatchCheck (emp::BitSet<CPU_BITSET_LENGTH >& symbiont_tasks, emp::BitSet<CPU_BITSET_LENGTH >& host_tasks) {
173+ bool SGPWorld::TaskMatchCheck (const emp::BitSet<CPU_BITSET_LENGTH >& symbiont_tasks, const emp::BitSet<CPU_BITSET_LENGTH >& host_tasks) {
174174 if (sgp_config->INTERACTION_MECHANISM () == NUTRIENT ) {
175175 return true ;
176176 }
@@ -230,10 +230,15 @@ emp::WorldPosition SGPWorld::SymDoBirth(emp::Ptr<Organism> sym_baby, emp::WorldP
230230 std::iota (e.begin (), e.end (), 0 );
231231 emp::Shuffle (*random_ptr, e);
232232
233+ emp::DataMonitor<size_t >& escapee_sucess_data_node = GetStressEscapeeOffspringSuccessCount ();
234+
233235 for (size_t escapee_i : e) {
234236 StressEscapeeOffspring& escapee_data = symbiont_stress_escapee_offspring[escapee_i];
235237 // TODO:stress escape data nodes
236- PlaceSymbiontInHost (escapee_data.escapee_offspring , escapee_data.infection_tasks , escapee_data.parent_pos );
238+ emp::WorldPosition new_pos = PlaceSymbiontInHost (escapee_data.escapee_offspring , escapee_data.infection_tasks , escapee_data.parent_pos );
239+ if (new_pos.IsValid ()) {
240+ escapee_sucess_data_node.AddDatum (1 );
241+ }
237242 }
238243
239244 symbiont_stress_escapee_offspring.clear ();
@@ -246,11 +251,11 @@ emp::WorldPosition SGPWorld::SymDoBirth(emp::Ptr<Organism> sym_baby, emp::WorldP
246251 *
247252 * Purpose: Calculate preferential ousting success
248253 */
249- bool SGPWorld::PreferentialOustingAllowed (emp::BitSet<CPU_BITSET_LENGTH >& incoming_sym_tasks, emp::Ptr<Organism> host){
250- emp::BitSet<CPU_BITSET_LENGTH >& host_tasks = fun_get_task_profile (host);
254+ bool SGPWorld::PreferentialOustingAllowed (const emp::BitSet<CPU_BITSET_LENGTH >& incoming_sym_tasks, emp::Ptr<Organism> host){
255+ const emp::BitSet<CPU_BITSET_LENGTH >& host_tasks = fun_get_task_profile (host);
251256
252257 for (emp::Ptr<Organism> sym : host->GetSymbionts ()){
253- emp::BitSet<CPU_BITSET_LENGTH >& target_sym_tasks = fun_get_task_profile (sym);
258+ const emp::BitSet<CPU_BITSET_LENGTH >& target_sym_tasks = fun_get_task_profile (sym);
254259
255260 if (sgp_config->PREFERENTIAL_OUSTING () == 1 ){
256261 // if has worse task match with any hosted sym, fail
@@ -276,7 +281,7 @@ emp::WorldPosition SGPWorld::SymDoBirth(emp::Ptr<Organism> sym_baby, emp::WorldP
276281 *
277282 * Purpose: Place a symbiont based on the passed task set
278283 */
279- emp::WorldPosition SGPWorld::PlaceSymbiontInHost (emp::Ptr<Organism> symbiont, emp::BitSet<CPU_BITSET_LENGTH >& symbiont_infection_tasks, size_t source_pos) {
284+ emp::WorldPosition SGPWorld::PlaceSymbiontInHost (emp::Ptr<Organism> symbiont, const emp::BitSet<CPU_BITSET_LENGTH >& symbiont_infection_tasks, size_t source_pos) {
280285 int new_host_pos = GetNeighborHost (source_pos, symbiont_infection_tasks);
281286 if (new_host_pos > -1 ) { // -1 means no living neighbors
282287 if (sgp_config->OUSTING () && sgp_config->PREFERENTIAL_OUSTING () && (int )pop[new_host_pos]->GetSymbionts ().size () == sgp_config->SYM_LIMIT ()) {
0 commit comments