As you can see in the iterator allagents(model)
, agent 5 which is the hydrophone is first. i.e. it records the number of dolphins before they get to move.
The order of the calls to agent_step!
is the schedule and it can be explicitly changed. Perhaps just changing the order of adding the agents (to add hydrophones first) would do the trick, but it is best to set the schedule explicitly.
Try using:
model = ABM(SoundAgent, space2d;
scheduler = Schedulers.by_id,
rng = MersenneTwister(seed)
)
in initialize_model
.