Is there a way to modify an agent in the buffer zone of Repast HPC Grid, and propagate those changes back to the original agent?

23 Views Asked by At

My question is regarding modifying agents on another process. I am using a grid, where I have static agents, one agent per grid cell. Each agent can get its direct neighbours using the Moore2DGridQuery. Then depending on the neighbouring agents states, they can choose one of their neighbours and change their state. Pretty much in the same way with the Humans and Zombies, where a zombie can infect a human. However, since the the agent can modify a direct neighbour, that means the neighbour could be an agent in the buffer zone. So if I want to "infect" and agent in the buffer zone and propagate that back to the original agent, what is the best possible approach to doing this?

1

There are 1 best solutions below

3
Nick Collier On

There's really no built-in way to do this. Synchronization is from the original to the ghost / buffered agent. The intention is that the non-ghost (non-buffered) agents are active, and would, for example, look around at their neighbors and then change themselves in someway. Is it possible to refactor your agent behavior with that in mind?

You could code your own mechanism for this reverse synchonization but you'd have to use MPI directly, sending agent ids and the updated state, rather than any of Repast HPC's synchronization mechanisms. If you are doing that probably the easiest way is to send all the changes to rank 0 and then have each rank query rank 0 for any applicable changes. Again though that's MPI programming and not strictly related to Repast HPC.