How do I resolve 'conflicts' between agents?

A common scenario to handle in simulations is modeling conflicts between agents. For example, suppose two agents want to move to the same position, but in the simulation only agent should occupy the same position at the same time. How should I represent that in my simulation?

In HASH it’s important to remember that
1.) all agent to agent interactions happen through messages or through checking their neighbors.
2.) Every agent executes in parallel.

If two agents are trying to occupy the same position, they’ll need to communicate with each other or through a third party to determine which of them can move in to the given spot.

Similarly if two or more agents want to access a resource from another agent, some type of decision logic needs to be implemented for resolving conflicts. For example here’s a link to Sugarscape, in which agents search for and collect “sugar”. When an agent moves to a patch of sugar it sends a message to the patch, requesting sugar (ln 37 in sugar_agent.js) . The patch then sends sugar to only one of the agents who made a request (ln 20-30 in sugar_patch.js ). This prevents multiple agents from “grabbing” the limited resource in parallel.

We’ve written more on this topic in our docs Designing with the Actor Model.