BONABEAU APPS

The aggressor-defender game

An agent-based model of the game in Funes, Orme and Bonabeau (Artificial Life IX, 2004) and Bonabeau, Funes and Orme ("Exploratory Design of Swarms", 2003). Each player picks two others, A and B, and follows one of two rules: move so that B is between A and you (Rule 1), or move so that you are between A and B (Rule 2). The sandbox lets you set the ratio of rules and the full relationship graph; the evolution tab breeds graphs from the playgrounds you select.

Rule 1: keep B between A and meRule 2: stay between A and Bred arrow: my Ablue arrow: my B
2

How the agents move

Positions update as Ai ← Ai + σeiθ with σ = δ = 2r per step, where r is an agent's radius. σ is cut back when the step would run into a wall or another agent. Rule 1 (keep B between A and me) follows the regions of Figure 1(a): coming from A's side of B the agent heads for the point u beside B, from the far side for v; once close to B it travels around B's edge to w, the point just past B on the line from A through B; anywhere farther along that line it moves straight onto the line and stops, because there the rule is satisfied. Rule 2 moves toward the closest point on the segment from A to B. Noise follows Figure 7: a random vector drawn in a square of side νδ is added to the intended step and the sum is renormalized.

Implementation notes
  • Rule 1 near B: Figure 1(a) sends an agent in the small square next to B (region 3) straight to w, but that straight path cuts through B's body, so with collisions on the agent gets pushed back and can stall between v and w. Here, within 4r of B the agent instead follows B's edge to w. In a test with A and B held fixed, agents ended with B between A and themselves in 500 of 500 random starts, against 289 of 500 with the straight-line version.
  • All agents take their step at once, then overlapping bodies are pushed apart in a few passes and kept inside the walls. This soft collision handling stands in for the paper's reduced speed on contact; hard blocking leaves agents wedged in several small clusters and never produces the single cluster of Rule 2.
  • An agent closer than δ to its target moves exactly onto it, so a satisfied agent stands still. Agents inside a cluster keep jostling because the pushes and the pull toward the target do not settle exactly.
  • An agent may choose the same person as A and B (the paper mentions this case); it may not choose itself.
  • Clusters in the statistics are groups of agents linked by center distances of at most 3r.
  • With periodic boundaries the arena is a torus (dashed outline). Every distance uses the nearest image: an agent looks at the nearest copy of its A, and at the copy of B nearest to that A, so the segment from A to B is the short way around. Arrows point to those copies, and agents crossing an edge are drawn on both sides.
  • Network text format, one line per agent: rule A B with 1-based indices.