Dynamic Organization of Flocking Behaviors in a Large Scale Boids Model
Total Page:16
File Type:pdf, Size:1020Kb
Dynamic Organization of Flocking Behaviors in a Large Scale Boids Model Norihiro Maruyama, Daichi Saito, Yasuhiro Hashimoto, and Takashi Ikegami The Graduate School of Arts and Sciences, University of Tokyo, Tokyo, Japan fmaruyama, saito, yasuhiro, [email protected] http://sacral.c.u-tokyo.ac.jp Abstract. Simulation of a half million flocks is studied by using a simple boids model originally proposed by Craig Reynolds. It was modeled with a differential equation on the 3D space with a periodic boundary. Flocking is collective behavior of active agents, which is often observed in the real world (e.g. swarm starling birds is a good example). It is, nevertheless, hard to define flocks (or their boundaries) in a rigorous way. First of all, even in a same swarm, the members are constantly updated, and secondly, flocks sometimes merge or divide dynamically. In order to define individual flocks and to capture the dynamic features of them, We applied a DBSCAN and a non-negative matrix factoriza- tion (NMF) to the boid dataset. Flocking behavior has different kind of individual dynamics depending on the size of flocking. A function of different flocks is discussed with the use of NMF. Keywords: Flocking · Boids · NMF · Parallel Computing 1 Introduction Collective behaviors can be qualitatively different by increasing the number of agents, i.e. a colony or group size. In the actual observation, e.g., the individual bees change their behaviors depending on the colony size [9]. Also the fish change their performance of sensing the environmental gradient depending on the school size.[7]. In the previous works [6, 3, 5], we simulated half a million birds ensemble by using a boids model [8] and found that qualitatively different behavior emerges when the total number of individuals exceeds 10,000 or so. Flocks of different sizes and forms interact in a parallel motion. Different types of fluctuation (i.e. density or velocity fluctuation) become dominant in different size flocks; a corre- lation of the local density fluctuation becomes dominant in the larger size flocks and that of the velocity fluctuation dominates in the smaller size flocks. A purpose of this paper is to revisit the collective behavior of the large flock- ing behavior with a more effective simulation algorithm. On simple clustering methods such as DBSCAN or SOM (Self-Organizing Map) , we consider the different velocities of boids, having better clustering results [5]. In this paper, we compare the results of DBSCAN clustering with the results of the Non-negative Matrix factorization (NMF) to study the dynamic modes of flocking behavior. 2 N. Maruyama et al. 2 Simulation Model and Method 2.1 Boids Model The dynamics of boids is described by three simple rules based on Craig Reynold's original model [8]. We translated it as the differential equation on the 3D space with a periodic boundary condition. Σj2Satt xj xi − xj ∆vi = Watt(xi − ) + Wrep(Σj2Srep ) natt jxi − xj j Σj2Sali vj +Wali(vi − ) nali The position of each boid (i) is updated based on the velocity, vi, deter- ministically and iteratively. The attraction, repulsion, and alignment terms are represented by the first, second, and third terms, respectively. Each rule has an interaction range around each agent, as denoted by Satt, Srep, and Sali, respec- tively. In the equation, the amplitudes of those interactions are given by Watt, Wrep, and Wali, respectively. The interaction ranges, with a 3D circular sector of their angles towards the front, are fixed as π=2, π=2, and π=3, respectively. In or- der to avoid any excess increase or decrease in speed, we bound the amplitude of speed between Vmin and Vmax, which we think as an important parameters. The system is investigated with parameter set on table 1 which is same as our pre- vious work [6]. The parameter values including the density of boids are selected to observe larger flocks. Parameter Value Parameter Value range of attraction 0.05 [unit] angle of attraction π=2 range of alignment 0.05 [unit] angle of alignment π=3 range of repulsion 0.01 [unit] angle of repulsion π=2 field size 0.4 - 3.2 [unit] number of individuals 2,048 - 524,288 max speed 0.005 [unit/step] min speed 0.001 [unit/step] Watt 0.008 Wali 0.06 Wrep 0.002 initial position randomly distributed initial velocity randomly distributed time step increment 1 density 16,384 [num/unit3] boundary condition periodic Table 1. Parameter values used in this simulation 2.2 Parallelization Unlike the previous works which are based on GPGPU computations [1, 2, 6], we carry on the parallelized simulation with a computer cluster for investigating the dynamics of large scale populations. The advantage of using a computer Dynamic Organization of Flocking Behaviors in a Large Scale Boids Model 3 cluster is its high scalability for the number of agents comparing with GPGPU computation. Initially we simply partitioned the three dimensional simulation space into subspaces, which corresponded to each simulation nodes. Each simulation node calculates agents belonging to its node, then nodes exchange information of the agents leaving/entering with the neighbouring nodes. Since the computer cluster we used has six-dimensional inter-node connections (K-computer), three dimensions is adopted for arranging the simulation space. At one simulation node, a simple algorithm that calculates a distance matrix of all agents needs the order of O(N 2) computation time. But if we assume that there is an upper limit on the local density and the interaction distance between individuals is sufficiently shorter with respect to the size of the space, this computation time can be reduced to O(N). In particular, the simulation space is divided into a grid with the size of about twice as large as the interaction distance, and individuals belonging to each grid are managed as a list. It is only necessary to calculate the distance matrix in this list and its list of the adjacent grid (see below Figure 1). Fig. 1. Diagram of parallelization methods on a simulation node. 4 N. Maruyama et al. 2.3 A Classification algorithm We visualize the boids dynamics in the 3D space as in Figure 2. Fig. 2. 2D projection of result of simulation with N = 32768. ball-like patterns (large black lump) and snake-like (string-like) patterns can be observed. We can recognize string-like swarm connects ball-like swarm by individual fast flowing. As is seen in this figure, agents are inhomogeneously distributed in the space by taking characteristic shapes. Those flocks are mutually interacting each other and dynamically changing. As is discussed in the previous works [6, 3], the size distribution of different flocks show a power-law behavior and different kinds of fluctuation exist for different flock sizes [5]. However all these analysis depend on how we classify flocks with what types of algorithm we apply. We mainly applied two kinds of clustering algorithm; DBSCAN is a density based clustering algorithm, which (briefly speaking) gath- ers the internal data points that are surrounded by more than k points and the peripheral points that has the internal points in their neighbors but sparsely surrounded. Figure 3 demonstrates an example of classifying the distinct flocks after di- viding all the agents into two classes by their velocity amplitude. As is seen in the figure, we have slow ( a broad peak on the left) and fast boids (a sharp peak on the right) agents. Then we apply DBSCAN to each group to see how different flocks distribute over space, which are displayed on the low column. Dynamic Organization of Flocking Behaviors in a Large Scale Boids Model 5 Fig. 3. Top: Distribution of velocity and velocity fluctuation of whole individuals. Bottom: Result of DBSCAN clustering for fast group and slow group. Different color label different flocks. 6 N. Maruyama et al. Most unexpected observation here is that fast agents exist on the surface of larger size flocks and also they compose string-like flocks. Flocks are organized temporary and will be generated or collapsed spontaneously. By the simple ob- servation, agents are escaping from large flocks by forming string-like pattens. We thus adopted the following method to extract dynamic mode associated with the spontaneous organization and collapsing of flocking behaviors. 2.4 NMF analysis To understand when and which type of mode of flock's dynamics are organized and collapsed, we used non-negative matrix factorization (NMF), which has become a popular decomposition algorithm ([4]). Given a non-negative matrix X (m × n matrix X), NMF finds the non-negative matrix factors W and H such as: X ' WH; In the case of the current analysis, n is the number of individual agents and m is the size of the time frame. Each entry of the matrix is given by magnitude of the agent's velocity. This matrix can be approximately factorized into the m × r matrix W and the r × n matrix H. Since relatively a few number of basis vectors are used to represent any data vectors, a good approximation can only be achieved if the basis vectors discover the structure that is latent in the data. We here adopted the generalized Kullback-Leibler (KL) divergence to determine the matrix factorization. A critical parameter in NMF is the factorization rank r, which defines the number of dynamic mode used to approximate the target matrix. Using the NMF method and the target matrix, a common way of setting the value of r is to try different values and compute some result quality measures, and then choose the best value for r accordingly. Here we arbitrary choose r that seem to correspond to flocking behaviors.