Liu Lei

Ramón Escobedo

Clément Sire

Guy Théraulaz

Guy Theraulaz
email: guy.theraulaz@univ-tlse3.fr

Computational and robotic modeling reveal parsimonious combinations of interactions between individuals in schooling fish

Keywords: collective behavior, flocking, fish school, interaction networks, computa-26 tional modeling, collective robotics. 27

HAL is

of more than two fish.

151

The interaction between two fish was shown to be a combination of a repulsive (at 152 short distance of order 1 BL -body length) and a long-range (in particular, compared to 153 zebrafish [START_REF] Escobedo | A data-driven method for reconstructing and modelling 1290 social interactions in animal groups[END_REF]) attractive interaction at larger distance, and of an alignment interaction 154 which tends to make the two fish align their heading direction. The attraction and 155 alignment interaction functions determine the new heading angle of the focal fish in 156 terms of the instantaneous relative state of the two fish, characterized by the distance 157 between them, the viewing angle with which the neighbor is perceived by the focal fish, 158 and their relative orientation (see Fig. 2). The additional change in heading angle due 159 to the repulsive interaction between a fish and the wall of a circular tank is expressed in 160 terms of the distance and relative angle of the fish to the wall (see Fig. 2). Finally, in 161 addition to the fish-wall and fish-fish interactions, the change in heading angle includes 162 a stochastic contribution describing the spontaneous fluctuations in the motion of the 163 fish. In [START_REF] Calovi | Disentangling and modeling interactions in fish with 1286 burst-and-coast swimming reveal distinct alignment and attraction behaviors[END_REF], the model was shown to quantitatively reproduce many fine measurable 164 quantities in one-fish and two-fish experiments, ultimately producing a very precise 165 description of the motion of one or two fish. For the sake of completeness, the model 166 and its fish-wall and fish-fish interaction functions are summarized in the Materials and 167 Methods section (Eqs. [START_REF] Camazine | Self-Organization in Biological Systems[END_REF][START_REF] Couzin | Self-organization and collective behavior in 1267 vertebrates[END_REF][START_REF] Lopez | From behavioural 1269 analyses to models of collective motion in fish schools[END_REF][START_REF] Cavagna | From empirical data to inter-individual interactions: unveiling 1272 the rules of collective animal behavior[END_REF][START_REF] Sumpter | The principles of collective animal behaviour[END_REF][START_REF] Sasaki | The Psychology of Superorganisms: Collective 1277 Decision Making by Insect Societies[END_REF][START_REF] Detrain | Self-organized structures in a superorgan-1279 ism: Do ants "behave" like molecules?[END_REF][START_REF] Detrain | Collective decision-making and foraging 1281 patterns in ants and honeybees[END_REF][START_REF] Seeley | Wisdom of the Hive[END_REF][START_REF] Seeley | Honeybee Democracy[END_REF][START_REF] Calovi | Disentangling and modeling interactions in fish with 1286 burst-and-coast swimming reveal distinct alignment and attraction behaviors[END_REF][START_REF] Escobedo | A data-driven method for reconstructing and modelling 1290 social interactions in animal groups[END_REF]; see [START_REF] Calovi | Disentangling and modeling interactions in fish with 1286 burst-and-coast swimming reveal distinct alignment and attraction behaviors[END_REF] for a more detailed description and justification 168 of the model; see [START_REF] Calovi | Disentangling and modeling interactions in fish with 1286 burst-and-coast swimming reveal distinct alignment and attraction behaviors[END_REF][START_REF] Escobedo | A data-driven method for reconstructing and modelling 1290 social interactions in animal groups[END_REF] for the extraction procedure of the interactions).

169

When more than two fish are swimming in the tank (N > 2), the social pairwise 170 interactions must be combined. In the framework of the fish model, it is natural to assume 171 that the heading angle change of a focal fish is the sum of the pairwise contributions of 172 some of its N -1 neighbors. The resulting interaction thus depends on two factors: the 173 number k of considered neighbors and the strategy to select them.

174

We explore three different strategies of interaction between individuals and their 175 neighbors in groups of size N = 5, comparing actual fish experiments with the resulting fish model and a control procedure to resolve collisions. The first strategy is based on 178 the distance, so that individuals interact with their k nearest neighbors, with k = 1, 2, 3.

The second strategy is a random strategy, where the k neighbors are randomly sampled 180 among the other N -1 individuals. Finally, the third strategy is based on the influence, 181 defined below, where the k selected neighbors are those having the largest influence on 182 the focal individual (as determined by the precise two-fish model of [START_REF] Calovi | Disentangling and modeling interactions in fish with 1286 burst-and-coast swimming reveal distinct alignment and attraction behaviors[END_REF]). We also study 183 the cases where there is no interaction between individuals (k = 0), and where each individual interacts with all its neighbors (k = 4).

185

The influence I ij (t) of a neighbor j on a focal individual i at time t is defined as the 186 intensity of the contribution of this neighbor j to the instantaneous heading variation 187 of the focal individual i, as given by the firmly tested two-fish model of [START_REF] Calovi | Disentangling and modeling interactions in fish with 1286 burst-and-coast swimming reveal distinct alignment and attraction behaviors[END_REF]. The individuals i and j, ψ ij is the viewing angle with which i perceives j (i.e., the angle 191 between the velocity of i and the vector ij), and φ ij is the difference of their heading 192 angles, a measure of the alignment between i and j (see Fig. 2). The influence I ij (t) is 193 evaluated at each kicking time of individual i by means of the analytical expressions of 194 the pairwise interaction functions derived in [START_REF] Calovi | Disentangling and modeling interactions in fish with 1286 burst-and-coast swimming reveal distinct alignment and attraction behaviors[END_REF] for fish swimming in pairs, according 195 to Eq. ( 9) in the Materials and Methods section.

196

To prevent cognitive overload, a reasonable assumption is that individual fish filter 197 the information from their environment and thus limit their attention to a small set of 198 their most salient neighbors [25-27] (to be followed; or to be avoided, by moving away 199 or by aligning their headings), making the notion of most influential neighbors quite • by calculating the instantaneous influence I ij (t) for each neighbor j of i and 210 selecting the k neighbors with the largest influence (strategy 3; most influential).

211

The strategy is thus characterized by the number k of neighbors taken into account in 212 the social interaction and the criterion used to select them (nearest, random, or most 213 influential). The strategy remains unchanged along the whole simulation. However, 214 the identity of the neighbors selected to interact with a given agent can change from one 215 kick to another, and must be updated at each kicking time of this agent. For instance, 216 when using the nearest strategy with k = 2 in a group of N = 5 agents, the agents 217 taken into account in the social interaction in the n-th kick of agent 1 can be the agents 2 218 and 3, and the agents 4 and 3 in its (n + 1)-th kick. In order to select these k neighbors at 219 a specific kick, the N -1 agents must be sorted according to the criterion corresponding 220 to the strategy used in the simulation. This sorting process is carried out at each kicking of the barycenter close to |θ B w | ≈ 90 • (Fig. 7). In fact, the peak in the PDF of |θ B w | is 245 slightly below 90 • , since the fish are more often going toward the wall than away from 246 it [START_REF] Calovi | Disentangling and modeling interactions in fish with 1286 burst-and-coast swimming reveal distinct alignment and attraction behaviors[END_REF].

247

We also find a collective pattern where individual fish rotate around the barycenter B 248 of the group in a direction which is opposite to the direction of rotation of the group around 249 the center T of the tank (see Fig. 3 and S4 Video). We call this collective movement a 250 counter-milling behavior, and define the instantaneous degree of counter-milling Q(t) as 251 a measure in [-1, 1] of the intensity with which both rotation movements are in opposed 252 directions (see the Materials and Methods section for the precise mathematical definition 253 of Q(t) and its general interpretation). When Q(t) < 0, the fish rotate around their 254 barycenter B in the opposite direction to that of the group around T (counter-milling),

255

while when Q(t) > 0, the fish rotate in the same direction around B as the group rotates 256 around T (super-milling). Fig. 8 shows that the fish exhibit a counter-milling behavior 257 much more frequently than a super-milling behavior. Counter-milling behaviors result 258 from the fact that fish located at the front of the group have to reduce their speed as 259 they get closer to the wall of the tank. Fish located at the back of the group (that 260 are generally farther from the wall [START_REF] Calovi | Disentangling and modeling interactions in fish with 1286 burst-and-coast swimming reveal distinct alignment and attraction behaviors[END_REF]) move faster and outrun the slowing down fish,

261

ultimately relegating them to the back of the group. This process gives rise to the 262 rotation of individual fish around the group center, in the opposite direction to the one 263 that the group displays around the tank (Fig. 3). This collective behavior resembles a 264 coordinated swimming by relays which is nevertheless due to simple physical constraints,

265
as already reported on wolf-packs hunting preys moving in circles [31]. in an unbounded domain. As for the group polarization P (Fig. 5), the three strategies 306 lead to a PDF clearly peaked near P ≈ 0.9 (and a smaller peak near P ≈ 0. significantly better results than the nearest and random strategies (see Table 1).

321

For k = 2, the three strategies lead to a collective behavior in much better agreement 322 with the fish experiments (see Table 1). In particular, the nearest strategy now system-323 atically leads to compact groups, with a PDF of the group cohesion C (Fig. 4) similar to the one obtained for the random strategy (both peaked around C ≈ 6.5 cm). The 325 most influential strategy produces a PDF in good agreement with fish experiments (both sharply peaked around C ≈ 5 cm). The PDF of the polarization is now sharply 327 peaked at P = 1 for the three strategies, with a slightly lower level of polarization for recovered for the nearest strategy (Figs. 6 and7; Table 1), the two other strategies 331 leading to slightly broader PDF but much narrower compared to the case k = 1. The 332 counter-milling Q is enhanced for the three strategies compared to the case k = 1 and 333 appears stronger than for fish experiments (Fig. 8). The deterioration of the model and10AB). When agents only interact with their 367 most influential neighbor, the group is highly cohesive (C ≈ 0.1 m, Fig. 9A), but less 368 than in the arena (C ≈ 0.07 m, Fig. 4C). However, the polarization is higher when the 369 group swim in an unbounded domain (mean of P ≈ 0.93, Fig. 10A) in comparison to 370 the arena (mean of P ≈ 0.78, Fig. 5C). Therefore, the confinement due to the arena 371 reinforces the group cohesion and weakens the group polarization, which still remains at 372 a high level for the most influential strategy.

373

However, when agents only interact with their first nearest neighbor, the group 374 disintegrates very quickly and then diffuses, with C 2 (t) growing linearly with the time t 375 (Fig. 9C), and P (t) oscillating around 0.6 (Fig. 10B). Compact groups are recovered for 376 the nearest strategy with k = 2, 3, but the most influential strategy systematically 377 leads to more cohesive and more polarized groups (Fig. 9AB).

378

In order to better understand to what extent the group cohesion depends on the also simulated the model by truncating the attraction interaction between two agents i 381 and j when their distance d ij is greater than a cut-off distance d cut : F Att (d ij ) = 0, if d cut decreases below some critical value d * cut , we expect that the group will break and that the agents will ultimately freely diffuse, illustrating the importance of the range 385 of the attraction interaction to ensure the cohesion of the group (see Fig. 9DE) and Fig. 10DE).

387

For the most influential strategy with k = 1, the group remains highly cohesive (Fig. 9D) and highly polarized (Fig. 10D) for d cut > d and an engineering-minded control system to deal with real-world physical constraints.

445

Our robotic platform provides a concrete implementation of these two elements and

446
understanding their interplay and their combined impact on the collective behavior of 447 robots is certainly one of the main motivation of the experiments presented here. the robots that have a longer range than the interactions between fish. In addition, the that the results for k = 1 are similar to those obtained for k = 0, with a marginal 486 improvement of the group cohesion and polarization. On the other hand, when the 487 robots interact with their most influential neighbor (S7 Video), the group is highly 488 cohesive (C ∼ 6.5 cm; Fig. 4F) and highly polarized (large peak at P = 1 in Fig. 5F).

489

The robots collectively move close to the border (r B w ∼ 7 cm; Fig. 6F). Counter-milling is 2).

517

Except for the weaker polarization, the results for the random strategy are similar to 518 the ones obtained for the most influential strategy with k = 2 (see Table 2 andS11 519 Video).

520

For k = 3, the results for the nearest strategy (see S12 Video) improve drastically 521 and are in comparable agreement with fish experiments as the results for the random 522 strategy (S13 Video), and on par with those for the most influential strategy for 523 k = 1, 2 (see Table 2). For the nearest and random strategies (sharing 2, and often 524 3, common neighbors for k = 3), groups are highly cohesive (Fig. 4DE) and polarized 525 (Fig. 5DE), with a narrower PDF of C than in fish experiments, pointing to the robot 526 groups having less internal fluctuations than fish groups. Accordingly, the PDF of r B w 527 (Fig. 6DE) is peaked at the same value as in fish experiments, r B w ≈ 5.5 cm, but is again 560

Here, we addressed this question in groups of five H. rhodostomus swimming in a 561 circular tank. This species of fish is of particular interest because of its tendency to form 562 highly polarized groups and its burst-and-coast swimming mode [START_REF] Calovi | Disentangling and modeling interactions in fish with 1286 burst-and-coast swimming reveal distinct alignment and attraction behaviors[END_REF], which allows us to 563 consider that each fish adjusts its heading direction at the onset of each bursting phase, 564 that is labeled as a "kick". Just before these brief accelerations, a fish integrates and 565 filters the information coming from its environment and picks its resulting new heading.

566

In our experiments, groups of five fish remain highly cohesive, almost perfectly rarely considered in the context of fish models, the implementation of the k-most 657 influential and k-nearest strategies could also be optimized by exploiting grid 658 algorithms commonly used in computational physics and astrophysics.

659

However, beyond its purely computational complexity, the possible biological relevance 660 of the most influential strategy (with small k) for fish and potentially other animals 661 is certainly an important question. In vertebrates, and in particular in fish, the midbrain (Fig. 11). We now describe the elements of a Cuboid (numbers between parentheses 716 refer to labels in Fig. 11). Each robot is equipped with two differential wheels [START_REF] Cavagna | From empirical data to inter-individual interactions: unveiling 1272 the rules of collective animal behavior[END_REF] 717 driven by small DC motors [START_REF] Seeley | Honeybee Democracy[END_REF]. The small belts (9) connect wheels to the DC motors, avoid collisions with obstacles and other robots (see the blue box in Fig. 13).

799

The main difference between the HIL simulation and the software simulation is the 800 real time control of the behavior of each robot, which is achieved by the Motion Control 801 and the Real Time Control modules (see the red box in Fig. 13).

802

The Motion Control module can produce two kinds of motion patterns: rotating and 803 moving straight. The first motion pattern is Spot Rotation, which means that the robot 804 rotates around its center by means of wheels differential driving. The speed control of 805 the two wheels is described by the following equation:

806 V R,i = -V L,i = p t δφ ci ,
where V R,i and V L,i are the speeds of the right and left wheels of the robot respectively,

811 V R,i = V L,i = p m l ci ,
where p m is a constant factor of proportionality and l ci is the value of the kick length, 812 which is also determined by the Real Time Control module.

813

The loops (for all robots) in the Real Time Control is about 13 ms (Fig. 13).

852

Implementation of the behavioral model in the robots. We use the LabVIEW 853 object-oriented programming (OOP) tool to design the distributed control software 854 for the Cuboids robots (Fig. 13). It first establishes independent memories for each 855 robot as an agent to store real time information, such as robot ID, location and heading T (0, 0) is set to the center of the tank (Fig. 1).

941

We found that trajectory tracking was satisfactorily accurate. However, fish were 942 often misidentified, making impossible the direct use of the data provided by the tracking 943 system. We thus implemented a procedure of identity reassignment that provided us 944 with the proper individual trajectories. In short, the procedure is a sorting algorithm 945 where fish identities are successively reassigned in such a way that the coordinates of 946 each fish at the next time step are the closest ones to the coordinates they had at the 947 previous time. That is, the fish i at time t is assigned the coordinates of fish j at time 948 t + ∆t that minimize the distance covered by the 5 fish.

949

Data were then grouped in a single file, counting 1.077.300 times, i.e., almost 12 hours

950
where the position of each fish is known. Then, times where at least one fish freezes 951 were removed. Fish often remain stationary. We considered that a fish is at rest when 952 the distance covered in 60 frames is smaller than 30 pixels, that is, when the mean speed 953 is smaller than 6.6 mm/s during at least 2.4 seconds. We discarded more than half of 954 the data using this procedure (around 5.5 hours of data remaining). We then extracted 955 the continuous sequences lasting at least 20 seconds, obtaining 293 sequences for a total 956 duration of around 3h 10mn.

957

Fish trajectories were then segmented according to the burst-and-coast typical 958 behavior of this species [START_REF] Calovi | Disentangling and modeling interactions in fish with 1286 burst-and-coast swimming reveal distinct alignment and attraction behaviors[END_REF] (see Fig. 1C). We used a time window of 0.2 s to find the 959 local minima of the velocity. These points are used to define the onset of a kick event.

960

We detected 60312 kicks, which means that a fish makes in average around 1 kick/s.

961

In [START_REF] Calovi | Disentangling and modeling interactions in fish with 1286 burst-and-coast swimming reveal distinct alignment and attraction behaviors[END_REF], no statistically meaningful left/right asymmetry in the trajectories of single 962 fish (∼300000 kicks recorded) or pairs of fish (∼200000 kicks recorded) was observed.

963

Hence, for any observed trajectory, the mirror trajectory (that is the same one, but 964 as observed from the bottom of the tank instead of from the top) would have exactly 965 the same probability to be observed. Assuming the absence of left/right asymmetry for 966 groups of 5 fish (as observed for 1 and 2 fish), leads to the same conclusion. Groups

982

To calculate the heading angle of a fish at time t, we considered that the direction 983 of motion is well approximated by the velocity vector of the fish at that time t. The 984 heading angle φ(t) of a fish is thus given by the angle that its velocity v = (v x , v y ) makes 985 with the horizontal line, that is,

986 φ(t) = ATAN2 (v y (t), v x (t)) . (1)
Positive angles are measured in counter-clockwise direction and ATAN2 returns a value in 987 (-π, π]. The components of the velocity are estimated with backward finite differences, 988 i.e., v x (t) = (x(t) -x(t -∆t))/∆t and v y (t) = (y(t) -y(t -∆t))/∆t.

989

The robot trajectories were extracted with a custom-made tracking software based 3).

996

Hemigrammus rhodostomus displays a "burst-and-coast" swimming behavior char-997 acterized by sequences of sudden speed increases called "kicks", each followed by a In our model, we consider that a fish makes the decision to change its heading and 1001 to pick its new kick length and duration exactly at the onset of each kick [START_REF] Calovi | Disentangling and modeling interactions in fish with 1286 burst-and-coast swimming reveal distinct alignment and attraction behaviors[END_REF]. The 1002 behavior of an agent i is thus described by a sequence of kicking times t n i at which 1003 the agent i performs its n-th kick. An agent selects a new heading depending on the 1004 instantaneous state of its environment (other fish; obstacles), as perceived exactly at 1005 the onset of a new kick, although the results of [28] suggest that the integration of 1006 the necessary information by an actual fish can take a few tenths of a second during 1007 the previous gliding period. Hence, at each of its kicking times t n i , the agent i collects 1008 the information of its instantaneous relative position and heading with respect to the 1009 obstacles and to the other agents, and selects the length and duration of its n-th kick, l n i 1010 and τ n i respectively, and its change of direction, δφ n i . Each agent has its own sequence 1011 of kicking times, which are not necessarily equally spaced: decision model:

t n+1 i -t n i = t n i -t n-1 i . In
1022 u n+1 i = u n i + l n i e (φ n+1 i ), (2)
φ n+1 i = φ n i + δφ n i , (3)
where u n+1 i and φ n+1 i are the vector position and the heading of agent i at the end of its speed of fish right after a kick was found to be v 0 ∼ 14 cm/s, and the speed was then 1034 found to decay exponentially during the gliding phase, with a relaxation time τ 0 = 0.8 s 1035 (a feature implemented in the model in [START_REF] Calovi | Disentangling and modeling interactions in fish with 1286 burst-and-coast swimming reveal distinct alignment and attraction behaviors[END_REF]). Thus, the duration of the time step τ n i , 1036 updated at each kicking time of agent i, is determined by the length of the kick and the 1037 peak speed of the fish [START_REF] Calovi | Disentangling and modeling interactions in fish with 1286 burst-and-coast swimming reveal distinct alignment and attraction behaviors[END_REF].

1038

The variation of the heading angle of agent i between two of its kicks is given by the 1039 sum of the variations induced by its environment, that is,

1040 δφ n i = δφ n w,i + δφ n R,i + j,i δφ n ij , (4)
where δφ n w,i is the angular variation caused by static obstacles (the wall of the fish tank 1041 or the border of the robot platform), δφ n R,i is a random Gaussian white noise reflecting 1042 the spontaneous fluctuations in the motion of the agent, and δφ n i,j is the angular variation 1043 induced by the social interaction of the agent i with the agent j.

1044

The notation j, i indicates that the sum is performed over all the agents j considered

I ij (t n i ).
Once sorted, the k first agents are considered in the sum in Eq. ( 4).

1053

Each contribution to the angle variation can be expressed in terms of decoupled 1054 functions of the instantaneous state of the agents, that is, the distance and relative 1055 orientation to the wall r w and θ w , and the distance d, viewing angle ψ, and relative 1056 alignment φ between the focal fish and its considered neighbor (see Fig. 2A). The 1057 derivation of these functions is based on physical principles of symmetry of the angular 1058 functions and a sophisticated reconstruction procedure detailed in Calovi et al. [START_REF] Calovi | Disentangling and modeling interactions in fish with 1286 burst-and-coast swimming reveal distinct alignment and attraction behaviors[END_REF] for 1059 the case of H. rhodostomus and in [START_REF] Escobedo | A data-driven method for reconstructing and modelling 1290 social interactions in animal groups[END_REF] for the general case of animal groups.

1062

• The repulsive effect of the wall is a centripetal force that depends only on the 1063 distance to the wall r w and the relative angle of the heading to the wall θ w .

F w (r w ) = γ w exp - r w l w 2 , O w (θ w ) = β w sin(θ w ) 1 + 0.7 cos(2θ w ) , (5)
where γ w = 0.15 is the intensity of the force (F w (0) = γ w ), l w = 0.06 m is the range

1076 δφ R (r w ) = γ R 1 -α exp - r w l w 2 g, (6)
where γ R = 0.45, α = 2/3, and g is a random number sampled from a standard • The interaction between agents can be decomposed into two terms of attraction 1082 and alignment which depend only on the relative state of both interacting agents:

1083 δφ ij (d ij , ψ ij , φ ij ) = δφ ij Att + δφ ij Ali , (7)
= δφ Att (d ij , ψ ij , φ ij ) + δφ Ali (d ij , ψ ij , φ ij ), (8)
where the relative state of fish j with respect to fish i is given by d ij , the distance 1084 between them; ψ ij , the viewing angle with which fish i perceives fish j; and 1085 φ ij = φ j -φ i , the difference between their heading angle.

1086

We then define the influence I ij (t) of a neighbor j on a focal individual i as the 1087 absolute contribution of this neighbor to the instantaneous heading change of the 1088 focal individual δφ i (t) in Eq. ( 4), that is, for j = 1, . . . , N , j = i:

1089 I ij (t) = δφ ij Att (t) + δφ ij Ali (t) . (9)
This precise definition is central to the implementation of the most influential 1090 interaction strategy involving the k most influential neighbors of a given focal fish i 1091 (i.e., the k neighbors with the largest influence I ij (t))

1092

Following [START_REF] Calovi | Disentangling and modeling interactions in fish with 1286 burst-and-coast swimming reveal distinct alignment and attraction behaviors[END_REF], we assume that both the attraction and the alignment functions

(d ij , ψ ij , φ ij ) = 1096 F Att (d ij ) O Att (ψ ij ) E Att (φ ij ), where 1097
F Att (d) = γ Att d d Att -1 1 1 + (d/l Att ) 2 , (10)
O Att (ψ) = β Att sin(ψ) 1 -0.33 cos(ψ) ,

E Att (φ) = λ Att 1 -0.48 cos(φ) -0.31 cos(2φ) .

of the interaction, and l Att = 20 cm characterizes the range where attraction is the angular functions [START_REF] Calovi | Disentangling and modeling interactions in fish with 1286 burst-and-coast swimming reveal distinct alignment and attraction behaviors[END_REF][START_REF] Escobedo | A data-driven method for reconstructing and modelling 1290 social interactions in animal groups[END_REF]. The names of the angular functions stand precisely 1106 for their parity (Odd/Even).

1107

In the alignment, we have

δφ Ali (d ij , ψ ij , φ ij ) = F Ali (d ij ) E Ali (ψ ij ) O Ali (φ ij ), where 1108
F Ali (d) = γ Ali d d Ali + 1 exp - d l Ali 2 , (13)
E Ali (ψ) = β Ali 1 + 0.6 cos(ψ) -0.32 cos(2ψ) , (14)
O Ali (φ) = λ Ali sin(φ) 1 + 0.3 cos(2φ) , (15)
with d Ali = 6 cm, l Ali = 20 cm, γ Ali = 0.09, β Ali = 0.9012, λ Ali = 1.6385.

1109

The parameter values are those derived in [START_REF] Calovi | Disentangling and modeling interactions in fish with 1286 burst-and-coast swimming reveal distinct alignment and attraction behaviors[END_REF] for the simulation model when fish 1110 swim in pairs and are summarized in Table 3 (fish model and robots). More details 1111 regarding the model, including the extraction of the above interaction functions, can be 1112 found in [START_REF] Calovi | Disentangling and modeling interactions in fish with 1286 burst-and-coast swimming reveal distinct alignment and attraction behaviors[END_REF]. Table 3).

1117

We have considered the most influential and nearest interaction strategies, that 1128

We first analyzed the impact on group cohesion and polarization (Fig. 9 and Fig. 10) of the barycenter B (center of mass) of the group with respect to the reference system 1152 of the tank:

1153 x B (t) = 1 N N i=1 x i (t), v B x (t) = 1 N N i=1 v i x (t), (16)
with similar expressions for y B (t) and v B y (t). The heading angle of the barycenter is 1154 then given by φ B = ATAN2(v B y , v B x ).

1155

The barycenter defines a system of reference in which the relative position and velocity 1156 of a fish, that we denote with a bar, are such that xi = x i -x B and vi

x = v i x -v B x 1157
(same expressions for the y-components). In the reference system of the barycenter, the 1158 angle of the position of a fish is given by θi = ATAN2(ȳ i , xi ), so the relative heading in 1159

this reference system is φi = ATAN2(v i y , vi x ) = φ i -φ B .
We can thus define the angle of incidence of a fish with respect to a circle centered at the barycenter as θi w = φiθi .

The angle θi w is the equivalent to the angle of incidence to the wall θ i w that we use in 1162 the reference system of the tank, and serves to measure the angular velocity of a fish 1163 with respect to the barycenter, in the reference system of the barycenter.

1164

The five observables used to quantify the behavior of a group are defined as follows:

C(t) = 1 N N i=1 u i -u B 2 , (17)
where u i -u B is the distance from fish i to the barycenter B of the N fish.

P (t) = 1 N N i=1 e i (t) , (18)
where e i = v i / v i = (cos(φ i ), sin(φ i )) is the unit vector in the direction of motion 1172 of the individual fish, given by its velocity vector v i .

and point in the same direction, while a value of P close to 0 would mean that the

r B w (t) = R - x B (t) 2 + y B (t) 2 , (19)
Note that when the individuals move in a cohesive group, r B w is typically of the 1186 same order as the mean distance of agents to the wall r w = (1/N ) N i=1 r i w .

1187 When the group is not cohesive, r B w is of order of the radius of the tank.

θ B w (t) = ATAN2 v B y (t), v B x (t) . (20)
When the group swims along the wall θ B w (t) ≈ ±π/2 (i.e., θ B w (t) ≈ ±90 • ).

Q(t) ∈ [-1, 1]: 1191 Q(t) = 1 N N i=1 sin( θi w ((t)) × SIGN 1 N N i=1 sin(θ i w (t)) (21) = Γ B (t) × SIGN Γ(t) . (22)
A group of fish rotating around the center of the tank with a rotation index Γ(t) Angles and reference systems. (A) Distances, angles, and velocity vectors of agents i and j in the absolute reference system centered in T (0, 0). Positive values of angles are fixed in the anticlockwise direction. θ i is the position angle of agent i with respect to T and the horizontal line; r w,i is the distance of agent i from the nearest wall; φ i is the heading angle of agent i, determined by its velocity vector v i ; θ w,i is the relative angle of agent i with the wall; d ij is the distance between agents i and j; ψ ij is the viewing angle with which agent i perceives agent j, i.e., the angle between the velocity of i and the vector ij (we show the angle ψ ji = ψ ij with which j perceives i, for the sake of readability of the figure); φ ij = φ j -φ i is the difference of heading between agents i and j, and δφ i is the variation of heading of agent i. (B) Relative reference system centered in the barycenter of the group B(x B , y B ). Relative variables are denoted with a bar. Angle θw,i = φiθi is the angle of incidence of the relative speed of agent i with respect to a circle centered in B.

  188 influence I ij (t) depends on the relative state of the neighbor j with respect to the focal 189 individual i, determined by the triplet (d ij , ψ ij , φ ij ), where d ij is the distance between 190

201

  The model for N > 2 agents thus proceeds as follows: at the time when the agent 202 performs a new kick, its change in heading angle is calculated by adding the effects of 203 the wall and the spontaneous noise to the effects of the k neighbors selected among the 204 other N -1 individuals according to one of the three strategies presented above: 205 • by calculating the instantaneous distance between the focal individual i and each 206 of its N -1 neighbors and selecting the k nearest neighbors (strategy 1; nearest); 207 • by randomly sampling k individuals among the N -1 neighbors of i (strategy 2; 208 random); 209

266

  Simulation results of the computational model267 Collective motion in a circular tank 268 Panels (ABC) of Figs. 4-8 show the probability distribution functions for our 5 quantifiers 269 as obtained in numerical simulations of the fish model. The panels correspond respectively 270 to the strategy in which agents interact with their k nearest neighbors (A), with 271 k neighbors chosen randomly (B), and with k neighbors selected according to their 272 influence on the focal agent (C). For these three strategies (nearest; random; most 273 influential), we have considered all the possible values of the number of interacting 274 neighbors, k = 1, 2, 3, together with the case where there is no interaction between 275 agents (k = 0) and the case where each agent interacts with every other agent (k = 4

301

  influential strategy clearly leads to the sharper distribution of C (peaked around 302 C ≈ 6.5 cm, compared to C ≈ 10 cm for the random strategy). The next section will 303 show that, contrary to the nearest strategy, the most influential strategy with 304 k = 1 can lead to compactness of the group even for larger groups (N = 6-70) moving 305

316

  reach the degree of cohesion and polarization (and their correlation) observed in groups 317 of fish (S1 Fig, S2 Fig). The most influential strategy density maps for k = 1 already 318 present the main features of the fish experiments, despite a still too broad spreading 319 in the (C, P ) plane. Overall, for k = 1, the most influential strategy gives rise to

334

  results for the counter-milling compared to k = 1 and experiments suggests that the 335 internal structure of a fish group is more rigid than predicted by the model, actual fish 336 behaving closer to particles rotating on a vinyl record (see the interpretation of Q in 337 Materials and Methods). Compared to the case k = 1, where they were particularly far 338 from the experimental maps, polarization vs cohesion density maps for the nearest 339 and random strategies and k = 2 show a correlation between P and C in much better 340 agreement with experiments (S1 Fig, S2 Fig). The most influential strategy results, 341 already fair for k = 1, also improve. The nearest strategy leads to the best agreement 342 with experiments in the representation of S1 Fig, while the most influential strategy 343 leads to the best results in the representation of S2 Fig. 344 When interacting with k = 3 neighbors, the results are almost identical for the 345 three strategies because neighbors are the same a high percentage of the time.

350 and Fig. 4 )

 4 , while using the 3 most influential ones, instead of 2, does not improve 351 significantly any of the measures, including density maps (S1 Fig, S2 Fig). As already 352 noted for k = 2, the counter-milling remains too pronounced compared to experiments 353 for the three strategies and k = 3 (see Fig. 8 and S5 Fig).

354Finally,

  Figs. 9 and 10 show respectively the time evolution of group cohesion and polarization

448

  Fig, and the density maps of cohesion and polarization are shown in S3 Fig and S4 Fig.454

472

  When k = 0, robots move independently from each other when they are sufficiently 473 far from each other, and tend to remain dispersed along the border of the arena (S5 474 Video). The group cohesion is weak (cohesion peaked at C ∼ 12 cm; Fig. 4DEF), and 475 the distance of the barycenter to the wall is large (r B w ∼ 12 cm; Fig. 6DEF). Robots are 476 relatively more cohesive and closer to the wall compared to the fish model for k = 0 due 477 to volume exclusion effects (two colliding robots can end up going in the same direction 478 as a result of the control procedure) and because the confining effects of the border of 479 the arena are stronger in robots than in agents (see also S3 Fig and S6 Fig). Robots are 480 not polarized, as already observed in the fish model simulations for the same condition Interacting only with k = 1 nearest neighbor does not allow robots to coordinate their 483 motion and move as a coherent group (see S6 Video). Panel (D) of Figs. 4-8 (cohesion; 484 polarization; distance to the wall; angle with respect to the wall; counter-milling) show 485

490

  Fig). Overall, and as confirmed by the Hellinger distances listed inTable 2, the most 497

  528narrower, with much less weight at distances r B w > 8 cm. The PDF of θ B w (Fig.6DE) is in good agreement with fish experiments, and counter-milling is clearly obtained (S6 Fig).

530

  When robots interact with k = 4 neighbors (S14 Video), the results are very similar to 531 the case k = 3 within the non negligible statistical fluctuations due to our shorter robot 532 experiments compared to the fish experiments and fish model simulations. to those found in the simulations of the model, despite the robots being submitted 535 to real-world physical constraints. Yet, for robots, the most influential strategy 536 with k = 1 is found to lead to cohesive and polarized groups (like in the model), while 537 the nearest strategy with k = 1 does not lead to any significant group coordination 538 (weaker coordination for the model in a confining domain, but no cohesive groups in an 539 unbounded domain). 540 Discussion 541 Collective motion involving the coherent movements of groups of individuals is primarily 542 a coordination problem. Each individual within a group must precisely adjust its 543 behavior to that of its neighbors in order to produce coordinated motion. Determining 544 how these relevant neighbors are selected at the individual scale is therefore a key 545 element to understand the coordination mechanisms in moving animal groups. Previous 546 experimental works on fish and birds have identified interacting neighbors using short-547 term directional correlations [17,34] or anisotropy of the position of the nearest neighbors 548 [21]. In a starling flocks (Sturnus vulgaris), each bird coordinates its motion with a finite 549 number of closest neighbors (typically seven), irrespective of their distance [21]. However, 550 in fish schools, experimental studies suggest that each individual only interacts with a 551 smaller number of influential neighbors. For instance, in the mosquitofish (Gambusia 552 holbrooki ), each fish mostly interacts with a single nearest neighbor [35]. In the rummy 553 nose tetra (Hemigrammus rhodostomus) during collective U-turns [28, 36], the analysis 554 of directional correlations between fish suggests that each fish mainly reacts to one or 555 two neighbors at a time [28]. These results are in line with theoretical works that have 556 suggested that, instead of averaging the contributions of a large number of neighbors, 557 as suggested by many models [18-20, 23, 37, 38], individuals could pay attention to only 558 a small number of neighbors [25-28, 39]. This mechanism would overcome the natural 559 cognitive limitation of the amount of information that each individual can handle [33].

  567 polarized, and swim along and close to the wall of the tank, keeping the same direction of 568 rotation for very long periods [36]. Fish groups also display a remarkable counter-milling 569 collective behavior where individual fish rotate around the group barycenter in the 570 opposite direction to that of the group in the tank, so that individuals alternate their 571 positions at the front of the group. 572 Based on a previous work in which we have reconstructed and modeled the form of the 573 interactions of H. rhodostomus fish swimming in pairs [14], we analyzed three strategies 574 for combining the pairwise interactions between a focal fish and a number k = 1 to 3 of 575 its neighbors by means of a computational model and a robotic platform. In the nearest 576 strategy, neighbors are selected according to their distance to the focal individual. In 577 the random strategy, neighbors are randomly chosen, and in the most influential 578 strategy, neighbors are selected according to the intensity of their contribution to the 579 heading variation of the focal individual. The impact of these strategies on the resulting

662

  and forebrain networks are carrying out computation in parallel to process the visual 663 information and select the most salient stimuli that are the focus of attention. The 664 midbrain network continuously monitors the environment for behaviorally relevant 665 stimuli[40]. This is a primary site where the information about the neighbors is filtered 666 for cognitive decision. Then, the forebrain network selects those stimuli on which the fish 667 focuses its attention. The interaction strategies that we have investigated in this work 668 correspond to different ways for an individual to focus its attention on the stimuli (i.e., 669 its relevant neighbors). In the context of fish schools, individuals filter the information 670 from their environment and thus limit their attention to a small set of their most salient 671 neighbors [25-27], hence giving priority to the few neighbors to be avoided (by moving 672 away or by aligning their headings) or the ones to be followed. These few neighbors 673 requiring an immediate action from the focal fish should, by definition, trigger a larger 674 response than other neighbors, hence making the notion of most influential neighbors 675 quite natural. Our results show that each fish interacts with typically two neighbors 676 that are the most salient, a process which reduces the amount of information that needs 677 attention and which hence permits to avoid any cognitive overload.678In conclusion, each individual must acquire a minimal amount of information about 679 the behavior of its neighbors for coordination to emerge at the group level, thus allowing 680 fish to avoid information overload when they move in large groups[33].Fish experimentscomply with the European legislation for animal welfare. 686 Study species. Rummy-nose tetras (Hemigrammus rhodostomus) were purchased 687 from Amazonie Labège (http://www.amazonie.com) in Toulouse, France. Fish were kept 688 in 150 l aquariums on a 12:12 hour, dark:light photoperiod, at 25.2 • C (±0.7 • C) and 689 were fed ad libitum with fish flakes. The average body length of the fish used in these 690 experiments is 31 mm (±2.5 mm). 691 Experimental setup. We used a rectangular experimental tank of size 120 × 120 cm, 692 made of glass, supported by a structure of metal beam 20 cm high. A plywood plate 693 was interposed between the mesh and the basin to dampen the forces exerted on the 694 glass basin by its own weight and water. This structure also enables the attenuation 695 of vibrations. The setup was placed in a chamber made by four opaque white curtains 696 surrounded by four LED light panels to provide an isotropic lighting. A circular tank of 697 radius R = 250 mm was set inside the experimental tank filled with 7 cm of water of 698 controlled quality (50% of water purified by reverse osmosis and 50% of water treated 699 by activated carbon) heated at 24.9 • C (±0.8 • C). Reflection of light due to the bottom 700 of the experimental tank is avoided thanks to a white PVC layer.701 Each trial started by placing groups of N = 5 fish randomly sampled from the 702 breeding tank into the circular tank. Fish were let for 10 minutes to habituate before 703 the start of the trial. A trial then consisted of one hour of fish freely swimming in 704 the circular tank with experimenters out of the room. Fish trajectories were recorded 705 by a Sony HandyCam HD camera filming from above the setup at 25 Hz (25 frames 706 per second) in HDTV resolution (1920×1080p). We performed 11 trials with groups of 707 N = 5 fish, and for each trial, we used different fish taken from the breeding tank. 708 Robotic platform 709 Robots. We used a robotic platform composed by small compact mobile robots that 710 we named "Cuboids", a name chosen in reference to the first realistic computer program 711 that simulated the flocking behavior in birds and the schooling behavior in fish, called 712 "Boids", developed in 1986 by Craig Reynolds [41]. The Cuboids robots were specifically 713 designed by us for this experiment. 714 Cuboids have a square basis of 40 × 40 mm, they are 60 mm high and weigh 50 g 715

718a 3 -

 3 which can drive the robot with a maximum speed of 50 mm/s. The two wheels are 719 mounted on a central axis[START_REF] Lopez | From behavioural 1269 analyses to models of collective motion in fish schools[END_REF]. An IEEE 802.11n/WIFI module[START_REF] Sumpter | The principles of collective animal behaviour[END_REF] with a range of 720 approximately 200 m is used for communication network between robot and a wireless router. A Li-Poly rechargeable battery[START_REF] Escobedo | A data-driven method for reconstructing and modelling 1290 social interactions in animal groups[END_REF] provided energy for about 6 hours in our 722 experimental conditions. In addition, a coil[START_REF] Seeley | Wisdom of the Hive[END_REF] located under the robot, can be used 723 to charge the robot wirelessly while it is working. The charging circuit is located on 724 the side board[START_REF] Detrain | Collective decision-making and foraging 1281 patterns in ants and honeybees[END_REF]. The robot bottom hosts a 32-bit, 168 MHz ARM microprocessor 725 STM32F4[START_REF] Calovi | Disentangling and modeling interactions in fish with 1286 burst-and-coast swimming reveal distinct alignment and attraction behaviors[END_REF], which can provide multi control loops with the time duration up to bars (4), which can simultaneously provide power and communication bus.730Each Cuboid also has several sensors to measure the relative positions of other robots 731 in its neighborhood and to send and receive messages from these robots. Within a 732 sensing range of about 20 cm, a robot can send messages (infrared signals) by the center 733 IR transmitter[START_REF] Moussaïd | Collective infor-1261 mation processing in swarms, flocks and crowds[END_REF]. There are two IR receivers (2) on both sides of the robots, which 734 can determine the distance of a neighboring robot that transmits the infrared signal.735From the two distance values provided by the IR receivers, the angle with which this 736 neighboring robot is perceived by the focal robot can be calculated by triangulation. 737 Furthermore, the relative position of the neighboring robot to the focal one can be 738 computed by the information of the distance and the angle of perception acquired before. 739 On the other side, the IR signal also carries a short message that includes information 740 on robot ID, orientation angle, speed and states. The heading of a Cuboid is measured 741 by a motion tracking sensor MPU-9250 (18). This device consists of a 3-Axis gyroscope, 742 Axis accelerometer, and a 3-Axis magnetometer. Hence, the MPU-9250 is a 9-axis 743 Motion Tracking device that also combines a Digital Motion Processor. With its I2C bus 744 connected with PIC18F25K22, the MPU-9250 can directly provide complete 9-axis 745 Motion Fusion output to the microcontroller. These sensing and local communication 746 devices have not been used in the experiments that have been done in a supervised 747 mode. 748 We tested the model with the robotic platform because there are many physical aspects 749 that have to be considered to assess the robustness of the coordination mechanisms when 750 they are implemented in a physical hardware. These physical aspects include the friction 751 of wheels, the noise of gear box, the blurring of the camera, the wrong identification of 752 the tracker, the delay of the communication, the overload of computation, the blocking 753 of the onboard communication bus, the square shape collision of the robot frame, the 754 mismatch parameters of the interaction model, the impact of the obstacle avoidance 755 protocol, and the non-holonomic constraint of the robot. All these physical aspects can 756 have a large effect on the individual and collective behaviors (especially when robots 757 move in a crowded space) and are difficult to include in a model. 758 Experimental platform. The robotic experimental setup consisted of a circular 759 arena of radius 420 mm resting on a 1 × 1 m square flat surface with a camera (Basler 760 piA2400-17gc) mounted on the top (see Fig. 12). The setup was placed in a chamber 761 made by 3 opaque wooden boards and 1 white curtain. 2 LED light panels provide a 762 diffused lighting. A circular cardboard wall of radius R = 420 mm delimited the border 763 of experimental platform. The floor of the experimental platform was made with a rough 764 wooden board that prevented the reflections of light. A computer is connected to the 765 camera to supervise the actions of the robots in the arena, and to perform the necessary 766 image processing to track each robot and compute in real time its position (x, y) and 767 heading angle φ. 768 The clock cycle of the imaging process module is 300 ms, a limit imposed by the 769 camera updating speed. A tracking software (Robots ID Tracker), based on the Kalman 770 filter technology, is then used to assign the location data to the right robots on a shorter 771 time scale (every 20 ms). These data are used in real time to control the reaction of 772 each robot in its changing environment, and are also stored in the computer for off-line 773 a posteriori trajectory analysis. Thanks to the high precision of our tracking system, we 774 are able to compute in real time and for each robot i the quantities that characterize its 775 instantaneous state with respect to its environment: the distance and relative orientation 776 to the wall r i w and θ i w , and the distance, relative angular position, and relative orientation 777 with respect to other robots j, d ij , ψ ij and φ ij , respectively (Fig. 2). All this information 778 is used to compute the output of the interactions of a robot with its local environment behavior is driven by the mathematical fish model, which combines the interactions with 781 the obstacles and with the other robots, and generates the control signals dispatched 782 in a distributed way to each individual robot through a WIFI communication router 783 (HUAWEI WS831). 784 Although the robot has its own sensors to ensure it autonomous control and move-785 ments, in this work, we used a remote-control mode. This is because our goal was to 786 compare the performances between the software simulation and the robot experiment 787 with the same computational model and the same local information input (see the 788 Hardware In Loop simulation in Fig. 13; [42]).

789Fig. 13 (

 13 Fig. 13 (red and blue boxes) shows the "Hardware In Loop" (HIL) simulation used

807 p t

  is a constant factor of proportionality, and δφ ci is the real-time value of the heading 808 variation, which is determined by the Real Time Control module. The second motion 809 pattern that the robot can display is Moving Straight, where the speeds of the left and 810 right wheels are the same:

848

  and used a specific protocol to broadcast in one loop the Motion Control command (V R,i , 849 V L,i ) to each respective robot i, based on TCP protocol, thus guaranteeing the speed 850 and the robustness of the communication channel. The average duration of one of these 851

967 of 5

 5 fish (as well as groups of 5 model fish or 5 robots) rotate clockwise (CW) or 968 counter-clockwise (CCW) around the center of the tank for long periods (collective 969 U-turns in groups of 2-20 fish have been studied in [36]). Therefore, for the much shorter 970 present fish (and especially robots) experiments compared to [14] (60312 recorded kicks, 971 instead of ∼500000), one would observe an artificial asymmetry (groups turning more 972 often CW than CCW, or the opposite) only due to the lack of statistical sampling of the 973 PLOS 20/51 set of 5 trajectories (fish and robots), we have added the mirror set (the trajectories 975 as seen from the bottom of the tank). Again, this procedure is perfectly sound once 976 the absence of left/right asymmetry observed in very long 1-and 2-fish experiments is 977 reasonably assumed to hold in our present 5-fish experiments (the model and its version 978 implemented in robots have obviously no left/right asymmetry, per construction). Note 979 that only the distribution of θ B w is affected by this symmetrization procedure, and not 980 the distributions of group cohesion, polarization, distance to the wall, counter-milling 981 index (the latter being a relative quantity), which are invariant by the mirror symmetry.

990on

  Kalman filter and pattern recognition technology [44]. Data were recorded every 991 ∆t = 0.04 s, and trajectories were then subjected to the same treatment. 992 Computational model 993 We use the same model to describe the time evolution of agents in the simulations and to 994 control the decisions of the robots in the experiments, albeit with different parameters to 995 accommodate for the different spatial and temporal scales in the two cases (see Table

  998quasi-passive deceleration and gliding period along a near straight line until the next 999 kick (Fig.1C, S1 Video, S3 Video).

  1000

  1012 addition, the motion of the different agents is asynchronous and their respective kicking 1013 times are in general different. As the environment changes from one kick to another (the 1014 agent moves with respect to the obstacles, and the other agents move with respect to 1015 the agent), the quantities l n i , τ n i , and δφ n i are updated at each kicking time of agent i, 1016 according to the number and identity of the agents taken into account in the evaluation 1017 of the effect of social interactions. In the present work, the number of agents taken into 1018 account in the social interactions remains constant, while the identity of the neighbors 1019 considered to interact with an agent is updated at each kicking time of this focal agent.

1023n-

  th kick, and e (φ n+1 i ) is the unitary vector pointing in the direction of angle φ n+1 i . At 1024 the end of the n-th kick of agent i, the time is t n+1 i = t n i + τ n i , which is the next kicking 1025 time of agent i. Note that one or more agents can perform one or more kicks between 1026 two successive kicks of agent i. In that case, the kicking agent collects the information 1027 about agent i (relative position and heading) to perform its own kick, while agent i is 1028 simply in the gliding phase following its last kick. 1029 The kick length l n i is sampled at each kicking time of agent i from the bell-shaped 1030 distribution of kick lengths obtained in our experiments of fish swimming in pairs [14], 1031 whose mean value is l = 7 cm. When the new computed position of the agent would be 1032 outside of the tank, a new kick length is sampled from the distribution. The typical 1033

1045

  to interact with agent i. The number k of agents considered to interact with an agent 1046 is part of what constitutes a social interaction strategy, and remains constant along 1047 the whole simulation. When k < N -1, the identity of these agents depends on the 1048 strategy, but also on the instantaneous state of the system, so that their identity must 1049 be updated at each kicking time of the focal agent i. At each kicking time t n i , the agents 1050 are sorted according to the criterion used in the interaction strategy: the distance to the 1051 focal agent d ij (t n i ), a random selection of neighbors, or the influence on the focal agent 1052

1060

  For completeness, we show these functions in S9 Fig and present here their analytical 1061 expressions with the parameter values necessary to reproduce the simulations.

1067•

  of the wall repulsion, and β w = 1.9157 is a normalization constant of the angular 1068 function O w (θ w ), so that the mean of the squared function in [-π, π] is equal to 1, 1069 that is, (1/2π) π -π O 2 w (θ)dθ = 1. All angular functions are normalized in this way, 1070 in order to allow the direct comparison of their shape in the different interactions. 1071 These parameter values are those used in the model simulations. They also appear 1072 in Table 3, together with the values used in the experiments with robots. 1073 The intensity of the stochastic spontaneous variation of heading δφ R depends on 1074 the distance to the wall r w , and decreases as the fish gets closer to the wall and 1075 becomes constrained by the boundary of the tank:

1077

  normal distribution (zero mean; unit variance). Random variations are minimal at 1078 the border, where r w = 0, δφ R = γ R (1 -α)g, and become larger as the individual 1079 moves away from the border, i.e., as r w grows. Far from the border, the exponential 1080 goes to zero and δφ R = γ R g.

  1081

  Att and δφ ij Ali can be decomposed as the product of three functions that each 1094 depend on only one of the three variables determining the relative state of the 1095 two fish. Thus, for the attraction interaction, we have δφ Att

1100maximum.β

  The angular functions O Att and E Att are respectively normalized with 1101 Att = 1.395 and λ Att = 0.9326. As already mentioned when describing the 1102 interaction with the wall, the three functional forms defined in (10-12) and the 1103 numerical values of the coefficients have been extracted from experimental data by 1104 means of a sophisticated procedure based on physical principles of symmetry of 1105

1113

  Computational model in an unbounded domain. Model simulations of agents 1114 swimming in an unbounded domain were carried out by removing the interaction with 1115 the wall (i.e., by setting γ w = 0; the rest of parameter values being those given in 1116

  1118 is, paying respectively attention to the k most influential neighbors or to the k-nearest 1119 neighbors, for k = 1, 2, 3, and 4, and the case where agents do not interact with each 1120 other (k = 0). Group cohesion and polarization are averaged over a large number of 1121 simulation runs n: C(t) = (1/n)n i=1 C i (t), where C i (t) is the group cohesion at time t 1122 in the i-th run. We used n = 1000. The duration of each simulation was sufficiently 1123 long to produce a total number of 10 4 kicks per run among the 5 agents (∼ 2.7 hours). 1124 A second series of simulations was carried out to produce 5 × 10 4 kicks (∼ 13.5 hours), 1125 finding the same qualitative results. Initial conditions of each run were always different, 1126 with all agents located at less than R = 25 cm (the radius of the arena) from the origin 1127 of coordinates.

1129F

  of reducing the attraction range in groups of N = 5 agents by truncating the attraction 1130 intensity function F Att when the neighbor is at a distance d ij > d cut from the focal agent: 1131 Att (d ij ) = 0, if d ij > d cut . For each value of d cut , the mean cohesion was calculated as 1132 the average over the last 10% of kicks over the 1000 runs carried out to obtain C(t) , and 1133 this, for both considered strategies and each value of k. When d cut is sufficiently large, 1134 the attraction range is sufficiently long and C(t) is close to the value corresponding to 1135 the mean cohesion of the group when F Att is not truncated. When d cut is smaller than 1136 a critical cut-off d * cut , the attraction range is too short and the agents simply diffuse, 1137 with C(t) ∼ t growing linearly in time Fig. 9. 1138 We then analyzed the group cohesion and polarization (Fig. 10 and S7 Fig) i) in 1139 large groups of N = 6, . . . , 70 agents for the most influential strategy with k = 1, ii)

1175N 3 .

 3 vectors point in different directions, but can also mean that vectors are collinear other half point South) so that they cancel each other. Similarly, when N = 5 and 1178 two normalized velocity vectors cancel each other (e.g., when 4 fish swim in the 1179 same direction e and one fish swims in the opposite direction -e ) would give rise 1180 to a resultant vector of norm P = (4 × 1 -1)/5 = 3/5 = 0.6, and if two pairs of 1181 fish cancel each other, then P = (3 × 1 -2 × (-1))/5 = 1/5 = 0.2.1182Note that uncorrelated headings would lead to P ∼ 1/ √ N , which becomes small 1183 only for large group size N , but which is markedly lower than 1 for any N ≥ 5.1184 Distance of the barycenter to the wall r B w (t) ∈ [0, R]:

  1185

1188 4 .

 4 Relative angle of the barycenter heading to the wall θ B w (t) ∈ [-π, π]:

  1189

1190 5 .

 5 Index of collective counter-milling and super-milling

1210

  Fig for robot experiments); ii) with the total number of data in a given range of the 1217

Fig 2 .

 2 Fig 2.Angles and reference systems. (A) Distances, angles, and velocity vectors of agents i and j in the absolute reference system centered in T (0, 0). Positive values of angles are fixed in the anticlockwise direction. θ i is the position angle of agent i with respect to T and the horizontal line; r w,i is the distance of agent i from the nearest wall; φ i is the heading angle of agent i, determined by its velocity vector v i ; θ w,i is the relative angle of agent i with the wall; d ij is the distance between agents i and j; ψ ij is the viewing angle with which agent i perceives agent j, i.e., the angle between the velocity of i and the vector ij (we show the angle ψ ji = ψ ij with which j perceives i, for the sake of readability of the figure); φ ij = φ j -φ i is the difference of heading between agents i and j, and δφ i is the variation of heading of agent i. (B) Relative reference system centered in the barycenter of the group B(x B , y B ). Relative variables are denoted with a bar. Angle θw,i = φiθi is the angle of incidence of the relative speed of agent i with respect to a circle centered in B.

Fig 3 .

 3 Fig 3. Counter-milling in fish experiments. Individual fish (small red arrows) turn counter-clockwise (CCW) around their barycenter, here located at B(0, 0), while the fish group rotates clockwise (CW) around the center of the tank, located at T (0, -14) in the reference system of the barycenter. Red arrows (of same length) denote relative fish heading, gray lines denote relative trajectories, and large orange circle denotes the average relative position of the border of the tank. The wide black arrow shows the direction of rotation of individual fish with respect to B (CCW), opposite to the wide gray arrow showing the direction of rotation of the group with respect to T (CW).

Fig 4 .

 4 Fig 4. Group cohesion. Probability density functions (PDF) of the group cohesion C for the experiments with 5 fish (red line in all panels), model simulations (panels ABC), and experiments with 5 robots (panels DEF), compared to the corresponding null models (k = 0, no interaction between individuals) in both simulations and robots (gray line in all panels). Distances have been rescaled by λ M = 0.87 for the model simulations, and by λ R = 0.35 for the robot experiments. The intensity of blue is proportional to the number of neighbors interacting with a focal individual (agent or robot), from k = 1 (light blue) to k = 4 (dark blue). Interaction strategies involve the k nearest neighbors (panels AD), k random neighbors (panels BE), and the k most influential neighbors (panels CF).

Fig 5 .

 5 Fig 5. Group polarization. PDF of the group polarization P for fish experiments (red line in all panels), model simulations (panels ABC), and robot experiments (panels DEF), compared to the corresponding null models (k = 0, no interaction between individuals) in both simulations and robots (gray line in all panels). Curves for agents (fish model and robots) are in blue and gray, depending on the value of k (see legend in panel B). Interaction strategies involve the k nearest neighbors (panels AD), k random neighbors (panels BE), and the k most influential neighbors (panels CF).

Fig 6 .

 6 Fig 6. Distance of the barycenter of the individuals to the wall. PDF of the distance r B w of the barycenter of the individuals from the wall for fish experiments (red line in all panels), model simulations (panels ABC), and robot experiments (panels DEF), compared to the corresponding null models (k = 0, no interaction between individuals) in both simulations and robots (gray line in all panels). Distances have been rescaled by λ M = 0.87 for the model simulations, and by λ R = 0.35 for the robot experiments. Curves for agents (fish model and robots) are in blue and gray, depending on the value of k (see legend in panel B). Interaction strategies involve the k nearest neighbors (panels AD), k random neighbors (panels BE), and the k most influential neighbors (panels CF).

Fig 7 .

 7 Fig 7. Relative angle of the heading of the barycenter of the group with the wall. PDF of the relative angle θ Bw of the heading of the barycenter of the group with the wall for fish experiments (red line in all panels), model simulations (panels ABC), and robot experiments (panels DEF), compared to the corresponding null models (k = 0, no interaction between individuals) in both simulations and robots (gray line in all panels). Curves for agents (fish model and robots) are in blue and gray, depending on the value of k (see legend in panel B). Interaction strategies involve the k nearest neighbors (panels AD), k random neighbors (panels BE), and the k most influential neighbors (panels CF).

Fig 8 .

 8 Fig 8. Counter-milling index. PDF of the counter-milling index Q for fish experiments (red line in all panels), model simulations (panels ABC), and robot experiments (panels DEF), compared to the corresponding null models (k = 0, no interaction between individuals) in both simulations and robots (gray line in all panels). Curves for agents (fish model and robots) are in blue and gray, depending on the value of k (see legend in panel B). Interaction strategies involve the k nearest neighbors (panels AD), k random neighbors (panels BE), and the k most influential neighbors (panels CF).

Fig 9 .

 9 Fig 9. Average cohesion of a group of 5 agents swimming in an unbounded domain. Model simulations for the most influential strategy (AD) and the nearest strategy (BCE), for k = 1, . . . , 4 (blue lines), together with the case with no interaction (k = 0, gray lines) and the mean cohesion for fish experiments (red lines in AB). For k = 0, cohesion is lost immediately, so that the gray line is not visible on the scale of panels AB. (C): Squared mean cohesion in the diffusive cases for k = 1 nearest neighbor and k = 0. (ABC): Average over 1000 runs with 10000 kicks (≈ 2.7 hours) per run. (DE): Mean cohesion averaged over the last 10% of the 1000 runs for different values of the cut-off distance d cut for the two strategies: (D) most influential, and (E) nearest. Panel (F): We plot the attraction function F Att (see Eq. 10), showing the critical values d * cut above which cohesion is preserved (vertical dashed lines): d * cut ∼ 0.8 m when the interacting neighbors are the k = 1, 2 or 3 most influential ones, the k = 3 nearest ones, or all the neighbors (k = 4); d * cut ≈ 3.5 m when interacting with the k = 2 nearest neighbors (d * cut does not exist when interacting only with the nearest neighbor).

Fig 10 .

 10 Fig 10. Average polarization of groups of 5 agents, and mean cohesion and polarization in larger groups (N = 5, . . . , 70), when agents are swimming in an unbounded domain. For N = 5, model simulations for the most influential strategy (AD) and the nearest strategy (BE), for k = 1, . . . , 4 (blue lines), together with the case with no interaction (k = 0, gray lines) and the mean polarization for fish experiments (red lines). Panel (C): Mean cohesion and polarization in large groups (N = 5, . . . , 70) for the most influential strategy (k = 1). Panel (F): Mean cohesion and polarization in a group of size N = 20 as a function of the number k of nearest neighbors with which focal individuals interact. The minimum of the cohesion is reached at k = 9, and the maximum of the polarization at k = 7.

Fig 11 . 51 Fig 12 .

 115112 Fig 11. Cuboid robots. (A) Photograph of a Cuboid robot. Credits to David Villa ScienceImage/CBI/CNRS, Toulouse, 2018. (B) Design structure of Cuboid robot; A-A represents a cutaway view.

Fig 13 .

 13 Fig 13. Software simulation and Hardware in Loop (HIL) simulation (from [42]). The structure of HIL is an extension of the software simulation, which consists of two extra parts: 1) a computer software (Image Processing, Motion Control, and Real Time Control modules) and 2) a physical hardware (Robot, camera and wireless router). In the software simulation, the Environment & Neighbor Measurement module converts the global position of a robot or a particle (x i , y i , φ i ) in the SPP software into local information (r w,i , θ w,i ) and (d ij , ψ ij , φ ij ). Then the computational model generates a new kick decision in the form of heading variation and kick length (δφ i , l i ). This new decision (δφ i , l i ) is then directly sent to the SPP(i) software. Once the state has been updated, a new global position is provided by the SPP(i) software (brown box) or the Hardware in loop simulation (red box). By contrast, the HIL simulation includes hardware, i.e., robots, camera and WIFI router (blue box). Furthermore, each robot i is controlled in real time by three more software modules running in the computer, which are the Image Processing, Motion Control, and Real Time Control modules (red box). The Image Processing module computes the global position of each robot (x c,i , y c,i , φ c,i ) from the information provided by the camera in real time. Then, the Real Time Control module converts the model decision (δφ i , l i ) into a real time decision in the robot (δφ c,i , l c,i ), which are the heading variation and kick length to perform the decision based on its real time position (x c,i , y c,i , φ c,i ). Finally, the Motion Control software generates left and right wheel motors speed control (V L,i , V R,i ) for each robot to achieve its decision (δφ c,i , l c,i ). Each robot receives these motor commands by WIFI signals, and performs the corresponding movements that are monitored by the camera.

Fig 14 .

 14 Fig 14. Flow chart of robot states machine. At any time a robot can be in one of the two following states: (1) the COMPUTE state for choosing a new target place, and(2) the MOVE state to reach the target place. In the COMPUTE state, the robot first selects influential neighbors, then it computes the pairwise influence of each neighbor, and finally it adds all influences to generate a new target place. Then, this new target place is validated to avoid collisions with the wall or another robot. If a valid target place cannot be found, the robot scans all space around itself for a valid target place. If the scanning method cannot find a valid target, the robot moves back over a distance of 80 mm and starts again the COMPUTE state. When a valid target place has been found, the robot switches into the MOVE state. The robot first rotates toward the target and then, moves straight to it. If another running neighbor blocks the path, the robot uses a procedure to avoid the obstacles.

  In the simulations of the model for N = 5, when the agents are interacting with 587 a single neighbor, this immediately leads to the formation of groups. Whatever the : the distributions of the group cohesion, the polarization, and the distance 637 of the barycenter of the group to the border of the tank are almost identical to those 638 obtained with the null model, in which no interaction exists between robots except for 639 collision avoidance. When robots interact with two neighbors, the agreement with the

	588 640
	589 641	strategy used to select a neighbor, the quantities used to quantify group behavior show results of fish experiments is improved, but it is only when robots interact with three
	590 642	that the exchange of information with a single neighbor leads agents to get closer to each nearest neighbors that the nearest strategy produces highly cohesive and polarized
	591 643	other, at least temporarily for the nearest strategy. However, whatever the strategy groups.
	592 644	considered, cohesion, polarization, and counter-milling are still weak compared to fish Overall, and even more convincingly than in the case of the fish model, the most
	593 645	experiments, although the most influential strategy convincingly leads to the best influential strategy leads to the best overall agreement with fish experiments for k = 1
	594 646	group coordination for k = 1. and k = 2, even producing strongly coordinated groups for k = 1. Compared to the
	595 647	The simulations of the model in an unbounded domain show that group cohesion is case of the fish model, the nearest strategy does not lead to any significant group
	596 648	maintained over long periods of time when agents only interact with their most influential coordination for k = 1, and only to moderately cohesive and polarized groups for k = 2,
	597 649	neighbor, provided the attraction range is above a critical threshold distance. However, yet being even less efficient than the random strategy. The robot collision avoidance
	598 650	when agents only interact with their nearest neighbor, this systematically leads to the protocol induces a strong effective repulsion between close neighbors, which screens the
		diffusive dispersion of the group. For groups of size up to N = 70, interacting with the behavioral interactions for the strategy based on these nearest neighbors.
	656
	627
	628	in our robotic platform, we also investigated the impact of the physical constraints and
	629	the collision avoidance protocol based on speed control on the group behavior. The
	630	most influential strategy is much more efficient than the two other strategies to
	631	ensure group cohesion and polarization (see Table 2). Remarkably, and as already
		observed in the model simulations, even when robots only interact with their most

580 collective behavior was then measured and analyzed by means of five quantities: group 581 cohesion, group polarization, distance and relative orientation of the barycenter with 582 respect to the border of the tank, and counter-milling index. 583 PLOS 12/51 number of neighbors, namely two, a group of individuals is able to reproduce the main 585 characteristics of the collective movements observed in the fish experiments. 586 599 most influential neighbor leads to compact groups, while one needs to consider typically 600 at least ∼ N/2 nearest neighbors to achieve the same result for the nearest strategy. 601 Therefore, the cohesion of the group observed in the arena is not a merely consequence 602 of the confinement of the agents, but mainly results from the higher quality of the 603 information provided by the influential neighbors in comparison to the one provided by 604 the nearest neighbors. 605 Then, when agents acquire more information about their environment (k = 2), all 606 the interaction strategies implemented in the model give rise to collective behaviors that 607 are in qualitative agreement with those observed in the experiments with fish, and a 608 quantitative agreement is even reached for some quantities characterizing group behavior 609 (see Table 1). When agents collect even more information about their environment 610 (i.e., when they pay attention to k = 3 neighbors), the agreement with fish experiments 611 is not improved if the neighbors are chosen according to their influence. However, 612 groups become more cohesive and polarized when the agents interact with their nearest 613 neighbors. Yet, for k = 3, the three strategies lead to comparable results, which is 614 consistent with the facts that two strategies have necessarily at least two common 615 neighbors for groups of five individuals. Note that for k = 2 and k = 3, and for all 616 three strategies, the intensity of the counter-milling is larger in the model than in fish 617 experiments, suggesting that the internal structure of real fish groups is more rigid than 618 predicted by the model. 619 In summary, the simulation results clearly indicate that group behaviors similar 620 to those observed in fish experiments can be reproduced by our model, provided that 621 individuals interact with at least two of their neighbors at each decision time and no 622 clear gain is obtained when agents interact with a third additional neighbor. When only 623 one interacting neighbor is considered, the most influential strategy leads to the 624 best group coordination, which even survives when the group moves in an unbounded 625 domain. 626 By implementing the behavioral fish model and the same local interaction strategies 632 influential neighbor, the group remains highly cohesive and polarized, and close to the 633 border. By contrast, when robots only interact with their nearest neighbor, they are 634 not able to exhibit any kind of coordinated behavior. Everything happens as if pairwise protocol651 Note that implementing the k-most influential strategy in a computational 652 model for larger groups of agents is not more computationally challenging than the 653 implementation of the more common k-nearest strategy, and is even less demanding 654 than the consideration of the first layer of neighbors in a Voronoi construction used in 655 many phenomenological flocking models [21, 22, 32]. For very large groups (N > 10000),

  Real Time Control module ensures the safe movement of each robot and helps If |δφ ci (t)| < δφ Threshold and l ci (t) < l Threshold , then There are two time-scales in the control for the robots. The long time scale is

	830
	831	else
		Do Moving straight for Motion Control in real-time.
	833
	834	the target is reached;
	835	Goto Compute state (computational model) for a new decision.
	836	5. If the path is not free, then
	837	Do Obstacle Avoidance procedure.
	838	6. End
	839 840
	817
	818 819
	820	Algorithm of the Real Time Control module
	821
		Input:

814

the robot to rotate and move straight towards a target place. This module first converts 815 the decision of the computational model (δφ i (t dec ), l i (t dec )) at the last decision time t dec 816 into a real-time decision that is then performed by the robot, (δφ ci (t), l ci (t)), t > t dec .

822

Computational Model decision: (δφ

i (t dec ), l i (t dec )), 2. l ci (t) = l i (t dec ) -x ci (t) -x i (t dec ) 2 + y ci (t) -y i (t

dec ) 2 . 828 3. If |δφ ci (t)| > δφ Threshold , then 829 Do Spot rotation for Motion Control in real-time. 832 4. 841 determined by the time taken in simulating the computational model, which is about 842 1.3 s. The short time-scale corresponds to the Real Time Control module, which operates 843 at a high frequency with respect to the real time motion of the robot. This module is 844 used to control the navigation of the robot toward the target and the obstacle avoidance 845 (see the table of Algorithm of the Real Time Control module). The maximum time 846 interval of the Real Time Control module is 20 ms for each robot. With such a fast 847 frequency, the communication channel is always busy. To solve this problem, we designed

  to the MOVE state and adjusts its wheels to move towards the decision 876 place in real time thanks to the Motion Control and Real Time Control modules. Since COMPUTE State: This state generates a new decision (δφ i (t dec ), l i (t dec )) for with about 8000 kicks in average for all the 5 robots. The duration time of Interacting with k = 1, 2 and 3 nearest neighbors: 61, 62 and 63 min respectively.

	927
	877	experiments performed for each condition was the following:
	878	other robots are moving around asynchronously, the robot must avoid these dynamic
	879 929	obstacles while being in the MOVE state. To prevent collisions between robots, we
	880 930 881 882 931	designed and implemented an obstacle avoidance protocol. When no valid targets can • Interacting with k = 1, 2 and 3 randomly chosen neighbors: 65, 128 and 48 min be generated during the COMPUTE state (due to the impediment imposed by nearby robots), the robot generates a valid target place by means of a scanning method and, respectively.
	883	alternatively, just moves back over a short distance. However, this circumstance rarely • Interacting with k = 1 and 2 most influential neighbors: 68 and 82 min respectively.
	884	occurs in our experiments (except in the absence of behavioral interactions, k = 0; see
	885 933	S5 Video).
	886	We describe below the two states and the additional procedures used to avoid collisions
	934	with dynamical obstacles. Data extraction and preprocessing
	888 935	Fish data were extracted from videos recorded during 11 sessions along 11 days in 2013,
	889	the focal robot by means of the computational model, which is programmed in by means of idTracker software version 2.1 [43], producing 11 data files with the position
		MATLAB. In this state, the robot takes the information about its local environment
	916
	865 866 917	place can be reached or not, in particular, to prevent the case where the agent could be target.
	867 918	intercepted by another agent, in which case the distance traveled by the agent will be • No Valid Target Procedure: This procedure is triggered when the robot is in the
	868 919	shorter than l i (t dec ). COMPUTE state and cannot generate a valid target place within 3 seconds. In
	869 920	The state machine control structure for an individual robot includes two main states: this situation, the robot scans the local environment from its front to the nearest
		COMPUTE state and MOVE state; see the flow chart of the robot state machine and neighbor located at one of its sides. If there exists a free space for generating a

856

(x ci (t), y ci (t), φ ci (t)) at time t, and real time decision (δφ ci (t), l ci (t)). We design a state 857 machine control structure to implement the HIL simulation control for each robot. With 858 the new speed control command determined by the Motion Control module, the actuators 859 of the robot are controlled wirelessly by the WIFI signals sent by the computer. The 860 robot controls its wheels to move towards the new target place while LED colors display 861 the state of the robot. 862 Robots use a constant kick length l i (t dec ) of around 8 cm, that is, twice the body 863 length of a robot, which corresponds to the mean kick length measured in experiments 864 with five fish. Using a constant straight step also allows to check if the new target 870 the finite state machine diagram in Fig. 14 and S8 Fig respectively. The robots are 871 programmed to perform a burst-and-coast movement mimicking the swimming mode of 872 fish. When a robot is in the COMPUTE state at time t dec , the computational model 873 determines a new decision (δφ i (t dec ), l i (t dec )) (see hereafter and [14] for the description robot switches 887 • 890 (r w,i , θ w,i ) and selects the neighbors to be taken into account corresponding to the 891 current local interaction strategy. Then, the robot computes the variation of its 892 heading angle δφ i (t dec ) that, combined with the kick length l i (t dec ), determines a 893 new target place. The location of the new target is then checked and validated 894 by the OOP software so as to avoid any collision with static obstacles, before the 895 robot switches to the MOVE state (see Fig. 14, S8 Fig). While a robot is in the 896 COMPUTE State, the white LED light is turned on. 897 • MOVE State: In this state the robot evaluates whether its heading angle φ ci is 898 aligned with the new pace target. If the deviation δφ ci is too large, the robot 899 first rotates towards the target and then moves straight until it reaches the target, 900 thanks to the Motion Control module. Then, when the robot successfully reaches 901 the target, it returns to the COMPUTE state to determine a new target. While a 902 robot is in the MOVE State, the green LED light is turned on. 903 • Obstacle Avoidance Protocol: This procedure is triggered as soon as the target 904 path of the focal robot i crosses the safety zone of another robot j. The safety 905 zone is a circular area around a robot of diameter of 80 mm. In this case, the 906 focal robot i first stops and computes whether it can continue moving or not, 907 according to the information it has about the distance d ij and relative angular 908 position ψ ij of the neighboring robot. If the focal robot has the moving priority 909 (determined by a large value of the angle of perception, |ψ ij | > 90 • , meaning that 910 the robot is a temporary leader [14]), or if the distance is larger than the diameter 911 of the circle of security (d ij > 80 mm, meaning that the robot j is far enough), 912 the moving condition is satisfied and the focal robot i successfully switches back 913 into the MOVE state. If not, it repeatedly checks the values d ij and ψ ij until the 914 moving condition is satisfied. If the focal robot cannot go back into the MOVE 915 state within 3 seconds, it toggles to the COMPUTE state to determine a new 921 target place, the robot toggles to the MOVE state. If, after scanning, no free space 922 is available for moving, the robot moves back over a predefined distance of 80 mm 923 (approximately two robot body lengths) and then toggles to the COMPUTE state 924 to determine a new target place. interactions 928 • 932 • Interacting with k = 0 and k = 4 neighbors: 150 min in both cases. 936 (in pixels) of each fish in each frame, with a time step of ∆t = 0.04 s (corresponding 937 to images taken with a frequency of 25 fps). Data were located in a rectangle of size 938 [471.23, 1478.48] × [47.949, 1002.68] containing the circular tank of diameter 50 cm. The 939 conversion factor from pixels to meters is 0.53 × 10 -3 m/pix. The origin of coordinates 940

Table 3 .

 3 Values and units of the parameters for model simulations and robot experiments.

	Parameter	Symbol Model Robots
	Intensity of heading random fluctuations	γ R	0.45	0.1
	Fluctuations reduction factor when close to wall	α	0.67	1
	Intensity of wall repulsion	γ w	0.15	0.79
	Range of wall repulsion (cm)	l w	6	11
	Intensity of attraction/repulsion	γ Att	0.12	0.18
	Range of attraction between individuals (cm)	l Att	20	37
	Distance of balance of attraction/repulsion (cm)	d Att	3	18
	Intensity of alignment	γ Ali	0.09	0.04
	Range of alignment between individuals (cm)	l Ali	20	37
	Distance of alignment (cm)	d Ali	6	5
	Average duration between successive kicks (s)	τ	0.5	1.3
	Mean length between two successive kicks (cm)	l	7	7.4
	Typical individual velocity in active period (cm/s)	v 0	14	3.75
	Relaxation time (s)	τ 0	0.8	0.9

d ij > d cut, where F Att is defined in Eq. (10) of the Materials and Methods section. When

ms. Besides, another 8-bit microcontroller PIC18F25k22 is mounted on the top sensor 727 board (1), which controls a LCD screen[START_REF] Parrish | Self-organized fish schools: 1292 An examination of emergent properties[END_REF] to display information and a

3-colors

Current position and heading: (x ci (t), y ci (t)), φ ci (t).

PLOS51/51

Acknowledgments 1253

We thank the three anonymous referees for their thoughtful comments on the manuscript.

1254

We are grateful to Patrick Arrufat and Gérard Latil for technical assistance.

Author Summary

Ethics statement. Our fish experiments have been approved by the Ethics Committee Table 1. Model simulations vs fish experiments. Distance D(Fish | Model) between the probability distribution function (PDF) of the 5 observables used to quantify the collective motion in the fish model and the corresponding PDF obtained in fish experiments. We list the results for the 3 different interaction strategies implemented in the fish model and the associated value of k for the number of interacting neighbors. The last column All corresponds to the average of the 5 corresponding distances, an arbitrary but reasonable global quantifier to assess the overall agreement of a given condition with the results of fish experiments. For k = 1, the most influential strategy gives significantly better results than the two other strategies and already leads to a fair agreement with fish experiments.