Paper deep dive
EvoFlock: evolved inverse design of multi-agent motion
Craig Reynolds
Intelligence
Status: succeeded | Model: Gemma-4-26B-A4B | Prompt: intel-v1 | Confidence: 91%
Last extracted: 7/9/2026, 7:44:13 AM
Summary
This paper introduces EvoFlock, an automatic inverse design framework for tuning multi-agent motion models. It employs a steady-state genetic algorithm to optimize a user-defined multi-objective fitness function, effectively handling complex parameter interactions. Key objectives include separation, obstacle avoidance, and flight speed, with alignment emerging naturally from spacing optimization.
Entities (10)
Relation Signals (8)
Craig Reynolds → authored → EvoFlock
confidence 99% · EvoFlock: evolved inverse design of multi-agent motion Craig Reynolds
EvoFlock → uses → Genetic Algorithm
confidence 95% · EvoFlock uses a genetic algorithm (GA), a technique based loosely on concepts of biological evolution
EvoFlock → implements → Inverse Design
confidence 92% · This paper addresses the issue of adjusting or tuning multi-agent motion models toward a given behavioral goal. This is the inverse design paradigm
Multi-agent Motion Simulation → includes → Boids
confidence 90% · Since the 1980s, several models of group motion have been developed, including boids and others
Genetic Algorithm → optimizes → Objective Function
confidence 90% · The optimization process used in these experiments is a genetic algorithm... The user provides a objective... function.
EvoFlock → targets → Multi-agent Motion Simulation
confidence 90% · This paper describes an automatic method for adjusting or tuning models of multi-agent motion.
Objective Function → utilizes → Hypervolume
confidence 88% · A simple and commonly used scalarizer is called hypervolume, which simply multiplies together the components of a multiple-objective value.
Separation → causes → Alignment
Cypher Suggestions (0)
No Cypher suggestions yet.
Abstract
Abstract:This paper describes an automatic method for adjusting or tuning models of multi-agent motion. Simulating the motion of bird flocks, human crowds, vehicle traffic, and other multi-agent systems is a widely used technique. These simulations model the behavior of a single group member (bird, human, or vehicle). The group behaviors (flock, crowd, traffic) emerge from interactions between group members. These models typically have many numerical control parameters. Even if each parameter is intuitive in isolation, their interaction can be complex and nonlinear. It is challenging to determine which parameters to adjust for the desired change in group behavior. Changing one aspect of group behavior often causes other aspects to change, leading to a tedious process of incremental changes. This work takes an inverse design approach. The desired group behavior is measured with a user-defined objective(/fitness/loss) function and optimized with a genetic algorithm. The objective function used here for basic flocking rewards proper spacing with neighbors, flying near a desired speed, and avoiding obstacles. Interestingly, the vivid alignment seen in bird flocks appears to emerge from maintaining proper spacing between flockmates.
Tags
Links
- Source: https://arxiv.org/abs/2606.25280v1
- Canonical: https://arxiv.org/abs/2606.25280v1
Trouble viewing inline? Open PDF directly →
Full Text
49,339 characters extracted from source content.
Expand or collapse full text
EvoFlock: evolved inverse design of multi-agent motion Craig Reynolds unaffiliated researcher cwr@red3d.com Abstract This paper describes an automatic method for adjusting or tuning models of multi-agent motion. Simulating the motion of bird flocks, human crowds, vehicle traffic, and other multi-agent systems is a widely used technique. These simulations model the behavior of a single group member (bird, human, or vehicle). The group behaviors (flock, crowd, traffic) emerge from interactions between group members. These models typically have many numerical control parameters. Even if each parameter is intuitive in isolation, their interaction can be complex and nonlinear. It is challenging to determine which parameters to adjust for the desired change in group behavior. Changing one aspect of group behavior often causes other aspects to change, leading to a tedious process of incremental changes. This work takes an inverse design approach. The desired group behavior is measured with a user-defined objective(/fitness/loss) function and optimized with a genetic algorithm. The objective function used here for basic flocking rewards proper spacing with neighbors, flying near a desired speed, and avoiding obstacles. Interestingly, the vivid alignment seen in bird flocks appears to emerge from maintaining proper spacing between flockmates. Keywords: multi-agent, inverse design, optimization, evolutionary computation, genetic algorithm, multi-objective, boids, flocks, herds, schools, crowds, traffic. Data/Code available at: https://github.com/cwreynolds/evoflock †©2026 Craig Reynolds. Published under a Creative Commons Attribution 4.0 International (C BY 4.0) license. Figure 1: (A) Normalized multi-objective fitness space. For two objectives, a unit square. (B) The Pareto front for two mutually conflicting objectives. (Like reliability and affordability in the hypothetical bridge design example.) The objectives can not all be fully satisfied at any point along the front. Visually: the “distance” from (1, 1) to the red curve. (C) Two “mostly compatible” objectives (which is to say: not-mutually-conflicting objectives) more typical of criteria for flock tuning. Here, the Pareto front passes near the global optimum. (D) Scalarization of a multiple-objective fitness value, using hypervolume: the product of all objective scores. In this 2D example it is the blue rectangle’s area. Problems of type (C) can often be solved automatically with scalarized fitness. Problems of type (B) may require human judgment to select from among solutions along the Pareto front. Introduction Simulation models of multi-agent motion are used in many fields including: animation, games, biology, robotic swarms, urban planning, training autonomous vehicles, and other applications. Since the 1980s, several models of group motion have been developed, including boids and others (see Related Work). These allow creating simulations of flocks and other group motions, which most observers will recognize as some form of flocking. This paper will usually refer to bird flocks, with the assumption that other types of group motion (herds, schools, crowds, traffic, drone swarms) can be similarly modeled. This project addresses the issue of adjusting or tuning multi-agent motion models toward a given behavioral goal. This is the inverse design paradigm: formally state a goal, then use optimization to “coax” the model to match. For example, modifying an existing model of bird flocks to instead portray fish schools. Or starting from a model of flocking crows and changing it to flocking sparrows. Similarly, starting from a generic abstract flock model and fitting it to field observations of a particular species of real birds in nature. Or to take a plausibly realistic model of a natural bird flock, and change it, say for storytelling purposes, to convey a flock of birds that are happy, or angry. A boids-like simulation model typically has a collection of numeric parameters (“knobs”) that control its action. EvoFlock is a software framework that automatically finds a set of near-optimal parameters for a simulation-based multi-agent system. The flock model used for these experiments is a predefined hand-written parametric “black box” model whose input is a parameter set (consisting of 15 numbers, see Table 1). The user provides a objective (also known as fitness or loss) function. It takes a candidate parameter set, runs a simulation, and returns a score reflecting how well the behavioral goals were met. The optimization process runs (for about two hours on a laptop) and produces a high quality parameter set, as measured by the user-supplied objective function (see e.g. Figure LABEL:fig:boid_flock). For a user of this optimization framework, it is convenient that the flock model is treated as a black box. Almost no restrictions are imposed on a preexisting model by this optimization framework: not on model design, source code availability, or programming language. (As can be an issue if optimization uses gradient descent via automatic differentiation (Baydin et al., 2018).) In the past, flock models have been tuned manually, often a frustrating and time-consuming process. For a new model, adjusting parameters is required simply to create group motion that looks like plausible flocking. Any modification to a group motion model (e.g. birds→ ) requires further adjustments to the parameters. Each such adjustment requires selecting which parameter(s) to change and how much to increase or decrease them. The main difficulty is that effects of control parameters may overlap and interact in non-linear ways. Changing one usually requires changing others to compensate. Potentially many parameters need to be changed, leading to a tedious series of edits and tests. This paper is about automating that adjustment process using metrics of flock quality and an optimization process. The metrics use multiple objectives. The nature of those objectives and how to add new ones will be described in sections An objective function for flocking and Adding an Objective. The optimization process used in these experiments is a genetic algorithm, described in section Optimization with Genetic Algorithms. A summary of (“hyper”)parameters for this framework is given in Table 2. See the c++ code for this project. Video 1 shows flock simulations based on this approach. Figure 2: One update step of the (SSGA) evolutionary optimization process, using a 3-way tournament: (a) uniformly select one of the sub-populations, (b) from that sub-population, uniformly select three individuals, each holding a flock parameter set, (c) get fitness for each, either by running flock simulations (orange), or using the fitness cached from previous tournaments (green), (d) sort the three by fitness, (e) the worst (least fit) individual is deleted, (f) the best two individuals mate (crossover) to create a new individual, (g,h) that new individual replaces the worst of the three back in the population. Removing the worst individuals, rather than promoting the best, is a form of negative selection which tends to preserve diversity in the population. Related Work Since the 1980s, many simulation-based models of bird flocks have been proposed. They have broadly similar intent, with many differences in their modeling philosophy and computational technique. These models include boids and many others: Aoki (1982), Okubo (1986), Reynolds (1987), Heppner and Grenander (1990), Tu and Terzopoulos (1994), Vicsek et al. (1995), Toner and Tu (1998), Couzin et al. (2002), Bajec et al. (2005), Cucker and Smale (2007), Moškon et al. (2007), Cavagna and Giardina (2008), Bajec and Heppner (2009), Bhattacharya and Vicsek (2010), Vásárhelyi et al. (2018), and Hoetzlein (2024). “Tuning” the many parameters of these flock models can be difficult. EvoFlock seeks to help. It is a robust gradient-free evolutionary optimizer for parameter tuning to create (or improve or re-target) multi-agent motion models. EvoFlock handles large numbers of fast moving agents with potentially conflicting goals. It optimizes parameters to meet multiple procedural objectives, allowing for complex inverse design tasks. An early, but not very successful, attempt at evolutionary inverse design for flock simulations (Reynolds, 1993) used genetic programming. (GP is a variation of the genetic algorithm (GA).) Funes et al. (2004) used interactive GA to find individual behaviors that produce “interesting” group behaviors, referring to this approach as an inverse problem. Stonedahl and Wilensky (2011) use a GA to search parameter spaces using an objective function running flock simulations based on NetLogo (Tisue and Wilensky, 2004). Similarly, Demšar and Bajec (2017) attempted “to evolve collective behavior from scratch.” Vásárhelyi et al. (2018) used a GA to tune flocking models suitable for the flight dynamics of a swarm of real drones. Stolfi and Danoy (2025) use evolutionary optimization to design robotic swarms for “escorting” tasks. Other than those evolutionary-based solutions, most previous work on automatic tuning of flock/multi-agent models has used reinforcement learning (RL) (Sutton and Barto, 1998) as the optimization technique. For example, see recent excellent work on making high-quality driver agents for a multi-agent traffic simulation (Cornelisse et al., 2025) and (Cusumano-Towner et al., 2025). They use self-play where agents learn (“bootstrap”) from interacting with each other. EvoFlock also has an aspect of self-play as flockmates learn to synchronize and cooperate with each other. A recently posted preprint uses reinforcement learning with an objective function very similar to the one used here (Brambati et al., 2025). See also research on drone-based communication networks Sun et al. (2025) that seek to maintain good spatial coverage while minimizing energy usage. Close in spirit to EvoFlock is recent work on automatically tuning 2d herd models from overhead video (Gong et al., 2025). From drone video of (say) sheep flocks, the system provides a dense simulated flock that reacts to simulated terrain quite like real sheep flocks would. A recent example of controlling the dynamics of multi-agent motion using physically-based deep neural networks can be found in Kim et al. (2025). Notable, if somewhat tangential: Jaderberg et al. (2019) uses a hybrid approach to learn human-level game-playing agents for multiplayer games. It uses population-based reinforcement learning, which combines aspects of RL, population-based GA, and the self-play mentioned above. Also a flock-like variant on particle swarm optimization: Hereford and Blum (2011). Similar in theme to EvoFlock, but for non-flocking but still self-organizing particle systems: Parkar et al. (2024). The general topic of inverse design is related to the larger field of morphogenetic engineering (Doursat et al., 2012). An analog of this work is described in El Saliby et al. (2024) when using artificial neural networks for continuous control tasks, where the weights of a fixed neural architecture are efficiently tuned (learned) using evolutionary optimization. EvoFlock was developed as part of a larger ongoing collaboration investigating new approaches to inverse design of multi-agent motion. This related work has not yet been published. Description of the Technique This section discusses the various components of the optimization process for adjusting parameters of a flock, or other kinds of multi-agent motion models. See Figure 3. Optimization with Genetic Algorithms Optimization can be used to find a set of simulation parameters that best fit the behavioral goals, as given by an objective function. EvoFlock uses a genetic algorithm (GA), a technique based loosely on concepts of biological evolution, as seen in the natural world. Evolution was first described by Darwin (1859) and Wallace (1858). Genetic algorithms were first described by Holland (1975). A modern survey of the larger field of evolutionary computation can be found in De Jong (2016). A genetic algorithm maintains a population of candidate solutions. Usually, the population contains a fixed number (tens to thousands) of candidate solutions, often called individuals. Typically, each individual is a fixed-sized vector of numeric parameter values. The population may be further divided into demes or islands, representing semi-isolated breeding subpopulations. This is thought to promote diversity by pursuing different solutions in parallel. In an island model, there is usually some kind of migration where individuals occasionally move from one island to another. A GA is a population-based stochastic approach to optimization and discovery. Unlike random search, they are a random process guided by the frequency of useful partial solutions in the population, a model of biological gene frequency in a species’ genome. The “genome” of a GA changes over time under the influence of the objective function. For example, a model parameter might be changed by mutation: adding a small signed zero-centered random value, to change it a bit from its previous value. Perhaps more importantly, individuals are modified by crossover where two parent individuals are recombined to create a new offspring. In a rough model of biological crossover involving parental DNA, two parental parameter sets are merged into one, by taking each parameter at random from one parent or the other (called uniform crossover). Many variations on genetic algorithms have been developed over the years. Sometimes, the entire population of individuals is updated in parallel, as a generation, and that process is repeated tens to hundreds of times. The approach used here, known as steady state genetic algorithms (SSGA) updates individuals one at a time (Syswerda, 1991). If a generational GA is run for G generations with a population of P individuals, a corresponding SSGA runs for G×PG×P steps. A preexisting GA framework called LazyPredator is used for this project. See Figure 2 for a diagram of the SSGA update cycle, and the “tournament of three individuals” based on negative selection which promotes diversity in the population. LazyPredator’s default 3-way tournament SSGA approach, and its hyperparameters, were used largely unchanged from previous unrelated projects. Figure 3: Overall structure of the flock optimization presented here. A generic optimization base (green) operates on a user’s flock inverse design problem (blue). The user’s description includes a parameter set specification and an objective function, the latter containing a flock simulator and score keeping utilities. Figure 4: Plot of scalarized fitness (and its component metrics) over 30,000 steps of evolutionary time. The black bold trace (ending at 0.83) is the cumulative best population fitness. The bold gray trace (bottommost) is population average fitness. The colored traces correspond to best and average values (saturated and pastel) for the three component fitness objectives: obstacle avoidance (red), separation (green), and speed (blue). Data from run 20250711a. Objective Function EvoFlock is based on optimizing a set of parameters for a flock (multi-agent motion) model. Optimization procedures are guided by an objective function. In many optimization problems, the overall objective is a combination of several potentially contradictory goals. This is called multi-objective optimization (Deb, 2001). To motivate this concept, consider building a bridge over a river. A key goal is that the bridge is reliable: that it will carry the required loads without collapsing. Another important goal is to minimize the cost of building the bridge. These criteria are directly opposed. A very strong bridge is reliable but costly. A very cheap bridge is unlikely to be reliable. This trade-off is often called Pareto optimality. Tuples of such Pareto optimal values form the Pareto front, see Figure 1(b). Multi-Objective Optimization Genetic algorithms were first used for problems with a single scalar fitness value. These have the advantage of having a total order. However, like the bridge building example above, many problems inherently have multiple objectives (see Figure 1(B)). For contradictory goals (e.g. reliable vs. cheap) a human expert may need to select a best solution of those along the Pareto front. Luckily, flock optimization problems addressed here seem to be in the “mostly compatible” type of multiple objective problems (that is, not-mutually-exclusive objectives, see Figure 1(C)) and so can be solved automatically with scalarization. A scalarizer maps from multiple objective values to a single scaler value that somehow summarizes the multiple objective values. A simple and commonly used scalarizer is called hypervolume, which simply multiplies together the components of a multiple-objective value. The name hypervolume refers to a n-dimensional box whose edges correspond to the components of a multiple objective value (see Figure 1(D)). Hypervolume has the property that its value changes in proportion to changes in each component. So, for example, the hypervolume goes up (or down) as any single component goes up (or down). This holds as long as none of the components is zero, which “hides” contributions of other components. To avoid this, the hypervolume variant used here remaps the fitness range from [0, 1] to [ϵε, 1] before taking the product. (ϵε is 0.01 for the “normalized fitness” values used here.) Parameter set for a flocking model The focus of EvoFlock is on inverse design, the optimization of parameter sets to achieve group behavior under the direction of an objective function. As such, details of a particular flocking model are largely off-topic. However, just to ground the discussion for readers unfamiliar with flocking models, a quick overview is given here. Most flock models are written from the perspective of an individual boid (agent) at a single time step. The boid identifies its neighbors. (The model used in this work uses topological distance to find the seven nearest neighbors (Cavagna and Giardina, 2008).) The boid reacts to its neighbors by computing steering forces (Reynolds, 1999) related to their distance and angle. It may also need to steer to avoid obstacles. These component steering forces are combined (often by 3D vector addition) then applied to the boid’s physics model (often a simple self-propelled particle model). Figure 5: Score for desired separation distance to a boid’s nearest neighbor. This function is highest when the centers of two boids are between 2 and 4 body diameters apart. The default boid body diameter is 1. The separation score for an entire flock simulation is the average of this function, over all boid-steps. (That is, for 200 boids on 500 simulation steps, so 100,000 boid steps.) Figure 6: Score for obstacle avoidance. It is the fraction of collision-free boid-steps (on [0, 1]) raised to a high power (500). This function is nearly zero until the number of collision-free steps is about 99%. Figure 7: Score for desired boid speed, here ∼ 20 meters per second. This function is highest when speed is between 19 and 21 m/s and falls off to zero outside that range. The speed score for an entire flock simulation is the average of this function over all boid-steps. Each of these steering behaviors has parameters, such as weights, distances, and angles. (For example, the weight given to alignment behavior, or the minimum time before a predicted obstacle collision at which the boid should steer to avoid.) There are also parameters related to its physical model, such as the maximum force it can apply. The collection of all these make up the flock’s parameter set which is adjusted by optimization according the the objective function. See Table 1 for details of the parameter set used in these experiments. An objective function for flocking Having described the components of EvoFlock (see Description of the Technique), this section focuses on the specific objective(/fitness/loss) function used to optimize a multi-agent motion model for flocking, see Figure 4 The objectives described below are based on measurements made during a flock simulation. While the simulation is run, “bookkeeping” code gathers statistics. (This happens while updating each individual boid step, after a flock update step, and at the end of a simulation). Those metrics are recorded and accessed by the evolutionary optimization framework after it runs a flock simulation. Objective for Separation A key observation is that the birds in a flock are grouped closely together but nearly always avoid colliding with flockmates. These goals (close together, no collisions) can be seen as a requirement that the distance between simulated boids fall within a given distance interval. Specifically, for each boid, we determine its nearest neighbor and measure the distance between their centers. A score is computed on the basis of that distance. See Figure 7. It is zero if the distance is too small (potential collision) or too large (insufficient flock density). Within that acceptable distance range, its value is one. Outside that desired range, piecewise linear ramps transition down to zero. An equally iconic property of natural flocks is that birds are aligned, flying on nearly parallel paths with their neighbors. An interesting result of this work is that this alignment appears to emerge from the “acceptable neighbor distance” metric. It was not necessary to have an explicit optimization objective for alignment. The optimization for proper separation appears to cause the alignment. Objective for Obstacle Avoidance The example application in this work can be described as “flocking in the presence of obstacles” as shown in Figure LABEL:fig:boid_flock. For collision avoidance, the goal is not to merely reduce the number of obstacle collisions, but to effectively eliminate them. These fitness tests (typically) run 200 boids for 500 simulation steps. The relevant statistic is the total number of avoided boid-obstacle collisions over 100,000 boid-steps in a flock simulation. To strongly emphasize the importance of collision avoidance, the normalized obstacle avoidance count (on [0, 1]) is exponentiated to the 500th power. This pushes nearly the whole score’s range down to almost zero, except for a small region near a perfect score of one. This effectively rejects flock parameter sets with more than a handful of collisions per flock simulation. An informal threshold in these experiments has been ≤ 10 collisions per 100,000 boid-steps. See Figure 7. At each time step, part of each boid’s simulation is predicting future obstacle collisions and applying steering force to avoid them. The same code detects obstacle avoidance failures. In simulation, this is a matter of a boid having incorrectly passed through the surface of an obstacle (a zero-crossing of the obstacle’s signed distance function). A kinematic constraint is invoked to move the boid back to the correct side of the boundary. This failure is recorded in a per-simulation collision counter. Objective for Flight Speed Early in these experiments (following early boid models (Reynolds, 1987)) each boid’s flight speed was kinematically clipped to remain below a maximum speed (20 meters per second). Later, a third flock optimization objective was added to establish a target speed range. A new behavior was added to each boid to apply a signed force along its direction of motion to adjust its flight speed toward the desired range. The strength of this behavior became one of the flock parameters to be optimized in the inverse flock design process. Flight speed can be left to “float” during optimization. Unfortunately, there is an annoyingly large basin of attractions around not moving (speed=0). It seems likely that any given motion-based inverse design problem would imply a range of valid speeds. This suggests that the speed range should be given in the inverse design problem statement. For example, modeling vehicle traffic and pedestrian crowds would imply very different speed ranges. Figure 7 shows a speed score function used in these experiments. It has a target range in the interval [19, 21] with a fixed support ramping down to zero outside that range. Figure 8: Score for boosting boid path curvature by slightly penalizing especially low curvature. Measured as average over all boid-steps of flock run. Score ramps from 0.8 to 1.0 for curvature on [0, 0.1] then clips at 1 for higher curvature. Description Range Units max force [0, 100] newtons forward weight [0, 100] none separate weight [0, 100] none align weight [0, 100] none cohere weight [0, 100] none predictive avoid weight [0, 100] none static avoid weight [0, 100] none max dist separate [0, 100] meters max dist align [0, 100] meters max dist cohere [0, 100] meters angle separate [-1, +1] cos(a) angle align [-1, +1] cos(a) angle cohere [-1, +1] cos(a) fly away max dist [0, 100] meters min time to collide [0, 10] seconds Table 1: Flock model parameters subject to optimization: a collection of scalar values, each with an associated range. They are initially randomized then optimized over time according to the objective function. These values are held in a c++ class called FlockParameters along with “constant” parameters (flock population, time step, etc.) which are not subject to the optimization process. Adding an Objective EvoFlock aims to simplify both creating and modifying flock models. This section describes such a modification, adding a new fitness objective to the “flocking with obstacles” behavior described in the previous section (three objectives: separation in range, speed in range, and avoid obstacles). The flocking motion that results is competent and smooth. Let us assume for some application-specific reason, the quality of motion is judged to be “too smooth.” This can be seen as a tendency of the previous three objectives to minimize the boid’s path curvature. Perhaps intentionally boosting the curvature would counteract that “too smooth” quality of motion? (For example, changing from “boring” to a more “playful” quality of motion?) The Boid class used by EvoFlock already provided an accessor for its instantaneous path curvature. A candidate “flock curvature” score could be simply averaging that over all boid-steps. A test run showed that the instantaneous curvature of a boid’s path is approximately on [0, 2]. The average curvature over a run is on [0, 1] at the beginning, but about [0, 0.04] at the end. This supports the notion that basic flocking minimizes curvature. An objective metric for boosting curvature might map the average curvature of a run to a normalized fitness score. Prototyping this code change took about an hour of programmer effort, followed by a few two-hour optimization runs to find effective hyperparameters: a linear mapping (with clipping) from a curvature range of [0, 0.1] to a score range of [0.8, 1], see Figure 8. This is effectively a fitness penalty of 20% for zero path curvature, ramping up to no penalty for “quite curvy.” A sample of the resulting flock motion can be seen in Video 2, a simulation with 1000 boids, using flock parameters evolved with this new curvature-boosting objective. (Compare with the non-curvature-boosting Video 1 mentioned in the Introduction.) Description Value Notes boids per flock 200 flock simulation steps 500 ∼ 16.6 sec simulation time step 1/30 130 seconds boid body diameter 1 meter boid body mass 1 kilogram boid max force < 100 newtons boid speed range 19 to 21 m/s obs avoid exponent 500 k nearest neighbors 7 cf. StarFlag evolution population 300 individuals evolution steps 30,000 SSGA steps equivalent generations 100 hypervolume epsilon 0.01 ϵε migrations per step 0.05 run time: flock sim ∼ 0.25 seconds 200×500200×500 run time: evolution ∼ 2 hours Table 2: Hyperparameters for the evolutionary inverse design framework. Run times are on a 2021 Apple Macbook Pro M1 Max. “StarFlag” is Cavagna and Giardina (2008) Conclusions This work shows that evolutionary optimization, via a genetic algorithm, can successfully find a set of parameters for a “black box” boid flocking model. This suggests that other similar multi-agent motion models — for example, multi-robot terrain search — might also be solved using a genetic algorithm in a similar way, using an objective with some similarity to those discussed here. One advantage of using evolutionary optimization for this type of inverse design problem is that the multi-agent simulation can be treated as a “black box.” As such, there are few constraints on how the simulation is implemented. In contrast, using stochastic gradient descent (SGD) (Robbins and Monro, 1951) requires that the flock model be differentiable, either analytically or via automatic differentiation (Baydin et al., 2018). Conveniently, evolutionary optimization only requires only a flock simulation’s scalar fitness value, no gradients are needed. A surprising finding of this work is that the alignment of birds in a flock seems to emerge from maintaining proper spacing between flockmates. In retrospect this seems plausible: a group of fast moving animals, with a desire to remain close-but-not-too-close to each other, while dodging around obstacles, must travel on parallel curved paths. However, before these experiments, it was not clear whether an objective function specifically to require alignment would be needed. A note about GA population size versus the number of SSGA updates (see Figure 2). Some experiments were made increasing the evolutionary population from 500 to 1000, while holding the total number of SSGA updates constant at 30,000. The hope was that more individuals (more flock parameter sets) might allow a better solution to be found by using a wider coverage of the parameter space. The opposite seemed to be true. Larger populations led to worse results (often summarized as the best scalar fitness at end of run). In contrast, reducing the population from 500 to 300 produced somewhat better results, but 150 was worse. Finally, for a population size of 300, more steps seemed to help: running 30,000 updates produced fitness around 0.82, while running 60,000 updates produced fitness around 0.88. Apparently, having more updates per individual produces better results. Figure 9: A histogram of final best fitness from 38 identical runs, varying only by random seeds Limitations Because EvoFlock is a stochastic algorithm, the quality of the results varies from run to run. (For the three-objective version, typical end-of-run best fitness is around 0.83, but can be as low as 0.76. See Figure 9.) This procedure is not deterministic, both because the random number generator is seeded from wall clock time for each run and because the objective function is multithreaded and so is inherently nondeterministic. The current objective function runs four flock simulations for each parameter set. These are run in parallel threads on separate CPU cores, so there is little time penalty. However, if not for this 4× load, the cores would be free for other types of parallelism within one flock simulation. The four simulations are an attempt to reduce fitness variance of the randomized simulations, to avoid “lucky” high scores. (Of the four fitness values, the lowest (worst) is returned from the objective function as a conservative estimate.) Recent work (Antipov and Doerr, 2025) has shown that this extra computation may be misguided, and that the overall quality of results do not suffer from using noisy raw fitness values. Future Work The examples in this work were based on tightly enclosed spaces cluttered with obstacles, as in Figure LABEL:fig:boid_flock. These environments mean boids are always in “emergency mode” trying to avoid collisions with obstacles or with their flockmates. What happens when these constraints are relaxed? Other researchers have looked at “open space flocking” (Hoetzlein, 2024) and (Brambati et al., 2025). A parameter set found by EvoFlock, for crowded environments, has disappointing behavior when applied to open space. Small “subflocks” head off in different directions without further interaction. This is especially true for the 3 objective version (separation, speed, obstacle), and to a lesser extent, the 4 objective version (with curvature). Digging deeper into open space flocking, such as “murmurations,” seems a worthwhile direction for future work. A work-in-progress test using EvoFlock for open space murmuration can be seen in Video 3. Similarly, multi-agent models with non-uniform agents (Montanari et al., 2025) and non-reciprocal behaviors (Choi et al., 2025), (Weis and Hanai, 2025) are promising future research topics. Potential applications could include predator-prey models or automobile-bike-pedestrian traffic models. These evolutionary techniques may help tune parameters for modeling various types of stigmergic behavior, as when social insects collaborate, via signals in the environment, to build communal structures: ant colonies, termite mounds, bee honeycomb (Camazine et al., 2003). The formulation of speed score (Figure 7) and separation score (Figure 7) include “ramps” outside the target range. Are these necessary or even helpful? The robust sampling provided by 100,000 scores per run may tend to “smooth out” those scores without the extra complexity of choosing slopes for ramps. EvoFlock finds good results using the genetic algorithm (Holland, 1975). It would be interesting to try a version using genetic programming (Koza, 1992). This would eliminate the need to start by hand coding a “black box flocking model” and could perhaps evolve it from scratch. An anonymous reviewer suggested that the steady-state genetic algorithm used here may not perform as well as continuous space evolution strategies (Hansen et al., 2021) such as “Covariance Matrix Adaptation Evolution Strategy”. However, the SSGA used here seemed to perform well in this application, for both quality of results and speed of optimization. As mentioned just above, a future goal of this work is to skip the stage of writing black-box models by hand by using genetic programming. The optimizer framework used here, LazyPredetor, is based on GP, performing GA via a source level transformation. Acknowledgements This work is part of a larger project. Many thanks for conversations and camaraderie to my collaborators: Gilbert Bernstein, Matthew Shang, Jennifer Luo, Ryan Zambrotta, and Tzu-Mao Li. Thanks to Ronin Barzel for a careful review of an early draft of this paper. I also want to thank my long time (30 year?) friend and ALife colleague, Inman Harvey, whose deep insights taught me so much about evolutionary computation and scholarship. [Note: I wrote that in an early draft in 2025. Now in June 2026 as I prepare this final draft, comes the sad news that Inman has passed away. May his memory be a blessing.] To Andy Kopra for discussions that led to my 1993 paper. Thanks to John Holland for genetic algorithms and to John Koza for introducing me to GP and GA. Thanks to the anonymous reviewers for helpful suggestions. Finally, to my family for their loving support. References D. Antipov and B. Doerr (2025) Evolutionary Algorithms Are Significantly More Robust to Noise When They Ignore It. arXiv. Note: arXiv:2409.00306 [cs]Comment: Full version of the paper accepted to IJCAI 2025 External Links: Link, Document Cited by: Limitations. I. Aoki (1982) A simulation study of the schooling mechanism in fish. Bulletin of the Japanese society of scientific fisheries 48 (8), p. 1081–1088. External Links: Link, Document Cited by: Related Work. I. L. Bajec and F. H. Heppner (2009) Organized flight in birds. Animal Behaviour 78 (4), p. 777–789. External Links: ISSN 00033472, Link, Document Cited by: Related Work. I. L. Bajec, N. Zimica, and M. Mraza (2005) Simulating flocks on the wing: the fuzzy approach. Journal of Theoretical Biology 233 (2), p. 199–220. External Links: ISSN 00225193, Link, Document Cited by: Related Work. A. G. Baydin, B. A. Pearlmutter, A. A. Radul, and J. M. Siskind (2018) Automatic Differentiation in Machine Learning: a Survey. Journal of Machine Learning Research 18 (153), p. 1–43. External Links: ISSN 1533-7928, Link Cited by: Introduction, Conclusions. K. Bhattacharya and T. Vicsek (2010) Collective decision making in cohesive flocks. New Journal of Physics 12 (9), p. 093019. Note: arXiv:1007.4453 [physics] External Links: ISSN 1367-2630, Link, Document Cited by: Related Work. M. Brambati, A. Celani, M. Gherardi, and F. Ginelli (2025) Learning to flock in open space by avoiding collisions and staying together. arXiv. Note: arXiv:2506.15587 [cond-mat]Comment: 13 pages + appendices External Links: Link, Document Cited by: Related Work, Future Work. S. Camazine, J. Deneubourg, N. R. Franks, J. Sneyd, G. Theraula, and E. Bonabeau (2003) Self-organization in biological systems. Princeton Studies in Complexity, Princeton University Press, Princeton, NJ (en). Cited by: Future Work. A. Cavagna and I. Giardina (2008) The seventh starling. Significance 5 (2), p. 62–66 (en). Note: https://onlinelibrary.wiley.com/doi/pdf/10.1111/j.1740-9713.2008.00288.x…The results of this measurement were surprising. All existing models and theories of collective animal behaviour have assumed that each animal interacted with all neighbours within a fixed distance. The STARFLAG data showed something quite different: each bird interacts with a fixed number of neighbours, irrespective of their physical distance. This number is approximately equal to seven. The difference with the assumptions of the models is stark: the data show clearly that the distance within which birds interact is not fixed at all, but rather it depends on the density of the flock. In a packed flock, the seven neighbours you are interacting with are close to you, whereas in a loose, sparse flock they are more distant. Using technical jargon, we may say that birds use aătopologicalădefinition of the distance, rather than a standardămetricădefinition… External Links: ISSN 1740-9713, Link, Document Cited by: Related Work, Parameter set for a flocking model, Table 2. J. Choi, J. D. Noh, and H. Rieger (2025) Flocking with random non-reciprocal interactions. arXiv. Note: arXiv:2506.22060 [cond-mat]Comment: 9 pages, 7 figures External Links: Link, Document Cited by: Future Work. D. Cornelisse, A. Pandya, K. Joseph, J. Suárez, and E. Vinitsky (2025) Building reliable sim driving agents by scaling self-play. arXiv. Note: arXiv:2502.14706 [cs]Comment: v3 External Links: Link, Document Cited by: Related Work. I. D. Couzin, J. Krause, R. James, G. D. Ruxton, and N. R. Franks (2002) Collective Memory and Spatial Sorting in Animal Groups. Journal of Theoretical Biology 218 (1), p. 1–11. External Links: ISSN 00225193, Link, Document Cited by: Related Work. F. Cucker and S. Smale (2007) Emergent Behavior in Flocks. IEEE Transactions on Automatic Control 52 (5), p. 852–862. Note: Conference Name: IEEE Transactions on Automatic Control External Links: ISSN 1558-2523, Link, Document Cited by: Related Work. M. Cusumano-Towner, D. Hafner, A. Hertzberg, B. Huval, A. Petrenko, E. Vinitsky, E. Wijmans, T. Killian, S. Bowers, O. Sener, P. Krähenbühl, and V. Koltun (2025) Robust Autonomy Emerges from Self-Play. arXiv. Note: arXiv:2502.03349 [cs] External Links: Link, Document Cited by: Related Work. C. Darwin (1859) On the Origin of Species by Means of Natural Selection. Murray, London. Note: or the Preservation of Favored Races in the Struggle for Life Cited by: Optimization with Genetic Algorithms. K. A. De Jong (2016) Evolutionary computation: a unified approach. Bradford Books, Cambridge, MA. External Links: ISBN 978-0-262-52960-0 Cited by: Optimization with Genetic Algorithms. K. Deb (2001) Multi-Objective Optimization using Evolutionary Algorithms. Wiley Interscience Series in Systems and Optimization, John Wiley & Sons, Chichester, England (en). Cited by: Objective Function. J. Demšar and I. L. Bajec (2017) Evolution of Collective Behaviour in an Artificial World Using Linguistic Fuzzy Rule-Based Systems. PLOS ONE 12 (1), p. e0168876 (en). Note: Publisher: Public Library of Science External Links: ISSN 1932-6203, Link, Document Cited by: Related Work. R. Doursat, H. Sayama, and O. Michel (2012) Morphogenetic engineering: toward programmable complex systems. Springer. Cited by: Related Work. M. El Saliby, G. Nadizar, E. Salvato, and E. Medvet (2024) Eventually, all you need is a simple evolutionary algorithm (for neuroevolution of continuous control policies). In Proceedings of the Genetic and Evolutionary Computation Conference Companion, GECCO ’24 Companion, New York, NY, USA, p. 1904–1913. External Links: ISBN 979-8-4007-0495-6, Link, Document Cited by: Related Work. P. Funes, B. Orme, and E. Bonabeau (2004) Shaping collective behavior: an exploratory design approach. In Artificial Life IX: Proceedings of the Ninth International Conference on the Simulation and Synthesis of Living Systems, J. Pollack, M. A. Bedau, P. Husbands, R. A. Watson, and T. Ikegami (Eds.), Note: _eprint: https://direct.mit.edu/book/chapter-pdf/2322595/9780262291392_cbl.pdf External Links: ISBN 978-0-262-29139-2, Link, Document Cited by: Related Work. X. Gong, J. Gain, D. Rohmer, S. Lyonnet, J. Pettré, and M. Cani (2025) Herds From Video: Learning a Microscopic Herd Model From Macroscopic Motion Data. Computer Graphics Forum 44 (6), p. e70225 (en). External Links: ISSN 1467-8659, Link, Document Cited by: Related Work. N. Hansen, A. Auger, R. Ros, O. Mersmann, T. Tušar, and D. Brockhoff (2021) COCO: A Platform for Comparing Continuous Optimizers in a Black-Box Setting. Optimization Methods and Software 36 (1), p. 114–144 (en). Note: arXiv:1603.08785 [cs.AI]Comment: Optimization Methods and Software, Taylor & Francis, In press, p.1-31 External Links: ISSN 1055-6788, 1029-4937, Link, Document Cited by: Future Work. F. Heppner and U. Grenander (1990) A Stochastic Nonlinear Model for Coordinate Bird Flocks. In The Ubiquity of Chaos, p. 233–238. External Links: ISBN 978-0-87168-350-2, Link Cited by: Related Work. J. Hereford and C. Blum (2011) FlockOpt: A new swarm optimization algorithm based on collective behavior of starling birds. In Third World Congress on Nature & Biologically Inspired Computing, p. 17–22. External Links: Document Cited by: Related Work. R. C. Hoetzlein (2024) Flock2: A model for orientation-based social flocking. Journal of Theoretical Biology 593, p. 111880. External Links: ISSN 0022-5193, Link, Document Cited by: Related Work, Future Work. J. H. Holland (1975) Adaptation in natural and artificial systems. Complex Adaptive Systems, MIT Press, A Bradford Book, Cambridge, MA (en). Note: (https://doi.org/10.7551/mitpress/1090.001.0001, 1992 open access edition) External Links: ISBN 978-0-262-58111-0, Link Cited by: Optimization with Genetic Algorithms, Future Work. M. Jaderberg, W. M. Czarnecki, I. Dunning, L. Marris, G. Lever, A. G. Castaneda, C. Beattie, N. C. Rabinowitz, A. S. Morcos, A. Ruderman, N. Sonnerat, T. Green, L. Deason, J. Z. Leibo, D. Silver, D. Hassabis, K. Kavukcuoglu, and T. Graepel (2019) Human-level performance in first-person multiplayer games with population-based deep reinforcement learning. Science 364 (6443), p. 859–865. Note: arXiv:1807.01281 [cs, stat] External Links: ISSN 0036-8075, 1095-9203, Link, Document Cited by: Related Work. D. Kim, J. Lee, and H. Kim (2025) Commanding emergent behavior with neural networks. Cell Reports Physical Science 6 (10) (English). External Links: ISSN 2666-3864, Link, Document Cited by: Related Work. J. R. Koza (1992) Genetic Programming: On the Programming of Computers by Means of Natural Selection (Complex Adaptive Systems). First edition, MIT Press, A Bradford Book, Cambridge, Mass.. External Links: ISBN 9780262527910, Link Cited by: Future Work. A. N. Montanari, A. E. D. Barioni, C. Duan, and A. E. Motter (2025) Optimal flock formation induced by agent heterogeneity. arXiv. Note: arXiv:2504.12297 [cond-mat] External Links: Link, Document Cited by: Future Work. M. Moškon, F. Heppner, M. Mraz, N. Zimic, and I. Lebar Bajec (2007) Fuzzy model of bird flock foraging behavior. In Proceedings of EUROSIM 2007, Vol. 2, Ljubljana, Slovenia. External Links: Link Cited by: Related Work. A. Okubo (1986) Dynamical aspects of animal grouping: Swarms, schools, flocks, and herds. Advances in Biophysics 22, p. 1–94. External Links: ISSN 0065227X, Link, Document Cited by: Related Work. D. Parkar, K. G. Leyba, R. A. Faerber, and J. J. Daymude (2024) Evolving Collective Behavior in Self-Organizing Particle Systems. In Proceedings of the 2024 Artificial Life Conference, Cambridge, MA (en). External Links: Link, Document Cited by: Related Work. C. W. Reynolds (1987) Flocks, Herds and Schools: A Distributed Behavioral Model. In Proceedings of the 14th annual conference on Computer graphics and interactive techniques, M. C. Stone (Ed.), SIGGRAPH ’87, Vol. 21, New York, NY, p. 25–34. External Links: ISBN 0-89791-227-6, Link, Document Cited by: Related Work, Objective for Flight Speed. C. W. Reynolds (1993) An Evolved, Vision-Based Behavioral Model of Coordinated Group Motion. In From Animals to Animats 2: Proceedings of the Second International Conference on Simulation of Adaptive Behavior, Note: https://direct.mit.edu/book/chapter-pdf/2314157/9780262287159_cby.pdf External Links: ISBN 978-0-262-28715-9, Link, Document Cited by: Related Work. C. Reynolds (1999) Steering Behaviors for Autonomous Characters. In Game Developers Conference 1999, San Francisco, California, p. 763–782. External Links: Link Cited by: Parameter set for a flocking model. H. Robbins and S. Monro (1951) A Stochastic Approximation Method. The Annals of Mathematical Statistics 22 (3), p. 400–407. Note: Publisher: Institute of Mathematical Statistics External Links: ISSN 0003-4851, 2168-8990, Link, Document Cited by: Conclusions. D. H. Stolfi and G. Danoy (2025) Escorting drone swarm formation: a swarm intelligence and evolutionary optimisation approach. Swarm Intelligence 19 (3), p. 245–272 (en). External Links: ISSN 1935-3820, Link, Document Cited by: Related Work. F. Stonedahl and U. Wilensky (2011) Finding Forms of Flocking: Evolutionary Search in ABM Parameter-Spaces. In Multi-Agent-Based Simulation XI, T. Bosse, A. Geller, and C. M. Jonker (Eds.), Berlin, Heidelberg, p. 61–75 (en). External Links: ISBN 978-3-642-18345-4, Document Cited by: Related Work. T. Sun, N. Guo, H. Gu, Y. Peng, and Z. Feng (2025) Integrated Communication and Control for Energy-Efficient UAV Swarms: A Multi-Agent Reinforcement Learning Approach. arXiv. Note: arXiv:2509.23905 [cs] External Links: Link, Document Cited by: Related Work. R. S. Sutton and A. G. Barto (1998) Reinforcement Learning: An Introduction. MIT Press. External Links: Link Cited by: Related Work. G. Syswerda (1991) A Study of Reproduction in Generational and Steady-State Genetic Algorithms. In Foundations of Genetic Algorithms, G. J. E. Rawlins (Ed.), Vol. 1, p. 94–101 (en). External Links: Link, Document Cited by: Optimization with Genetic Algorithms. S. Tisue and U. Wilensky (2004) NetLogo: Design and implementation of a multi-agent modeling environment. In Proceedings of Agent 2004, Vol. 2004, Chicago, IL., p. 7–9. Cited by: Related Work. J. Toner and Y. Tu (1998) Flocks, herds, and schools: A quantitative theory of flocking. Phys. Rev. E 58 (4), p. 4828–4858. External Links: ISSN 1063-651X, Link, Document Cited by: Related Work. X. Tu and D. Terzopoulos (1994) Artificial fishes: physics, locomotion, perception, behavior. In Proceedings of the 21st annual conference on Computer graphics and interactive techniques, SIGGRAPH ’94, New York, NY, USA, p. 43–50. External Links: ISBN 978-0-89791-667-7, Link, Document Cited by: Related Work. G. Vásárhelyi, Cs, G. Somorjai, T. Nepusz, A. E. Eiben, and T. Vicsek (2018) Optimized flocking of autonomous drones in confined environments. Science Robotics 3 (20). Note: “…In this paper, we propose such a flocking model for real drones incorporating an evolutionary optimization framework with carefully chosen order parameters and fitness functions…” External Links: Link, Document Cited by: Related Work, Related Work. T. Vicsek, A. Czirók, E. Ben-Jacob, I. Cohen, and O. Shochet (1995) Novel Type of Phase Transition in a System of Self-Driven Particles. Physical Review Letters 75 (6), p. 1226–1229. Note: Publisher: American Physical Society External Links: Link, Document Cited by: Related Work. A. R. Wallace (1858) On the Tendency of Varieties to depart indefinitely from the Original Type. Journal of the proceedings of the Linnean Society, Zoology 3, p. 53–62. Note: https://archive.org/details/wallace-1858-journalofproceed-00linn External Links: Link Cited by: Optimization with Genetic Algorithms. C. Weis and R. Hanai (2025) Generalized non-reciprocal phase transitions in multipopulation systems. arXiv. Note: arXiv:2507.16763 [cond-mat]Comment: 15 pages, 7 figures External Links: Link, Document Cited by: Future Work.