Trails of ants converge or diverge through lens-shaped impediments, resembling principles of optics

Analogies across disciplines often indicate the existence of universal principles such as optimization, while the underlying proximate mechanisms may differ. It was reported recently that trails of ants refract at the border of substrates, on which walking speeds differ. This phenomenon is analogous to the travel-time-minimizing routes of light refracting at the borders between different media. Here, we further demonstrate that ant tracks converge or diverge across lens-shaped impediments similar to light rays through concave or convex optical lenses. The results suggest that the optical principle of travel time reduction may apply to ants. We propose a simple mathematical model that assumes nonlinear positive feedback in pheromone accumulation. It provides a possible explanation of the observed similarity between ant behavior and optics, and it is the first quantitative theoretical demonstration that pheromone-based proximate mechanisms of trail formation may produce this similarity. However, the future detailed empirical observations of ant behavior on impediment edges during the process of pheromone trail formation are needed in order to evaluate alternative explanations for this similarity.

Optimization is a central principle underlying a variety of physical, chemical, and biological phenomena 1 including ecology and evolution of biological organisms 2,3 . It is possible that similar underlying principles of optimization may lead to similarities between biological and physical phenomena.
Optimization of foraging efficiency by individuals or groups (e.g. colonies of social insects) is a product of natural selection for optimal foraging 2 . One of the mechanisms involved in foraging optimization is the ability of animals to minimize their travel time during foraging trips [4][5][6][7] . For example, colonies of ants are able to establish foraging traffic in a time-minimizing manner: army ants Eciton burchelli are able to form the trails along which flow of the traffic is maximized 8 , and Argentine ants Iridomyrmex humilis can collectively form pheromone-marked foraging trails that reduce the travel time on bifurcated bridges 9 . Ants may reach such a colony-level optimization through interactions among individuals without central control over their behavior. One of the crucial processes of the trail formation includes individuals marking their travel path from the food source to the nest with a pheromone. This pheromone-marked path is later used by other foragers who travel between the nest and the food source adding their own pheromone to the trail to reinforce the path. Additional processes involved in the formation of foraging trails include path integration, spatial memory, or edge-following [10][11][12][13][14][15] . This ability of ants to optimize the collective performance through the decentralized processes at the level of an individual has inspired other fields of science such as robotics and computer science 16,17 .
The principle of reduced travel time also governs the behavior of light rays. According to Fermat's least-time principle, which is an axiomatic principle in optics, a ray of light travels from a certain point to another through a time-minimizing trail. In optics, the time-minimizing path does not need to be distance-minimizing. When a light ray traverses across a border between two media of different light propagation speeds (different refractive indices), it bends (refracts) in such a manner that minimizes the light's travel time through the two media. Snell's law, or the law of refraction, was derived from Fermat's principle in order to compute the angles of incidence Results experiments. We observed foraging tracks of the Japanese carpenter ant, Camponotus japonicus, across the passable impediments of three shapes: convex, band, and concave ( Fig. 1b1-b3). The impediments were located between the nest and the feeder ('Bait' in Fig. 1c). We performed two sets of experiments, and each set comprised three treatments (impediment shapes) at three independent colonies, resulting in 18 recorded trials. From a frame-by-frame analysis of video of each trial, we calculated a relative frequency distribution (blue-colored distribution in Fig. 1d) of ants' locations (defined by values of displacement from the midline, y i ) weighted by each ant's horizontal speed at each coordinate (v i,h ; Fig. 1c,e) within the impediment's analysis region (a dark band in Fig. 1c; see Methods for details). The weighted standard deviation S was used as an index of dispersion (See Methods for the detailed explanations) and it was compared to the expected dispersion. Additionally, in order to determine the expected dispersion, we used walking speeds of ants recorded in each trial to calculate the relationships between the displacement from the midline (y i ) and the expected travel time (example in Fig. 1f; details and results for all tests are given in the Supplementary Materials).
As predicted, the index of dispersion S varied by the shape of the impediments in our empirical data ( Fig. 2a-d; mixed-model ANOVA, F = 6.661, df = 2, p = 0.011; nest ID and set ID were considered as random effects). S across the convex-shaped impediment (Fig. 2a1,d-blue dots) was significantly higher than S across the band-shaped (Fig. 2b1,d-yellow dots) and concave-shaped (Fig. 2c1,d-red dots) impediments (Post-hoc Tukey's honest significant difference (HSD) test, Z = 2.489, p = 0.034; Z = 3.556, p = 0.001, respectively). We, however, did not observe a significant difference of S between the band-and concave-shaped impediments (Post-hoc Tukey's HSD test, Z = −1.067, p = 0.535).

Model.
To quantitatively express the hypothesis that pheromone-based processes underlie the similarity between ant behavior and optics, we built a set of simple mathematical formulae that could explain and predict the frequency distribution along the analysis region (symbols used in the model are explained in the Table S4 of Supplementary Materials). The idea behind the formulae is that initially, each foraging ant chooses the point of the passage (y-value in the model) when traveling to the nest and to the bait. At the early stage of foraging when there are no pheromone trails, each y-value has equal probability to be chosen by a foraging ant. Each foraging ant at the early stage in our model maintains its point of passage in the subsequent travels until attraction to pheromone changes the individual's behavior. We assumed in the model that the substrate-specific walking speeds of ants are constant, resulting in trail-specific travel time (T) values. The model also assumes that an ant deposit a constant amount of pheromone per unit length, independently of an ant's walking speed, the travel distance, and total travel time along that path. We thought it was a reasonable assumption considering the absence of empirical data on the possible relationships between walking speed of an individual ant and the concentration of the pheromone deposited along the trail by that ant for this species. Under these assumptions, we expected the initial rate of pheromone accumulation by foraging ants (in an experimental trial) is higher for the trails with shorter travel time (T) because ants that use the shorter path can travel back and forth from bait to the nest (or vice versa) more frequently while depositing the pheromone each time. That is, each point in the trail is more frequently visited by foraging ants if travel time is short, and this leads to faster accumulation of the pheromone on this path. The initially faster pheromone accumulation triggers a positive reinforcement mechanism: The deposited pheromone attracts even more pheromone-depositing ants, who additionally contribute to the increase of the pheromone deposit. Therefore, we assumed that after the pheromone trails are fully formed, the traverse frequency (f) along www.nature.com/scientificreports www.nature.com/scientificreports/  Figure 1. The schematics of light rays passing through optical lenses (a1-a3), the materials and methods used in the research (b1-b3, c,d), and the methods of mathematical analysis (e,f). (a1-a3)-Violet-shading represents light rays that reach the target through the lens, while yellow-shading represents those that cannot reach the target. For the convex lens (a1), if properly positioned, all target-reaching paths of light from the source are time-minimizing. For the flat plane (a2) and concave lens (a3), the target-reaching light rays form narrow beams. (b1-b3)-The shapes of convex-shaped (b1), band-shaped (b2), and concave-shaped (b3) impediments made of Velcro to reduce the walking speed of ants. (c)-Schematics of the experimental arena with a convexshaped impediment. The impediment is marked with light gray, and the 2-cm-wide analysis region is marked with dark gray. The area within 2 cm from the walls of the experimental arena was exempted from the analysis. (d)-An example of the weighted relative frequency distribution of ant locations defined as the displacements from the midline (y-axis in (e); ranging from −28 to 28 cm). (e)-An example of a computed path linking the entrance and the bait through the impediment at a certain displacement (d) from the midline. Here, the path (blue line) crosses the impediment at d = 16 cm from the midline. Given that an ant's average speed on the paper-lined surface is 1 cm/s and the average speed through the Velcro is 0.39 cm/s, it takes 77.8 s to travel the path whose traverse position is d (See Methods for the details). By the shape of the equation, ants crossing the concave-shaped impediment near the midline would experience the minimum travel time, and those crossing the impediment distantly from the midline would face a highly increased travel time (Fig. 1f, red line). However, for the convex-shaped impediment, ants could choose a wider range of trails near the midline without facing a highly increased travel time (Fig. 1f, blue line). Therefore, we predicted a wider dispersion of trails around the midline in convex-shaped impediment than in band-or concave-shaped ones.
By comparing the theoretical and empirical results, we found that for a specific range of k values (12, 13, or 14), the theoretical values of Ŝ generated for each of the 18 tests using the equations (  Table S3).

Discussion
The results suggest that ants, similar to photons (rays of lights), tend to travel along time-reducing paths, which is consistent with general optimization principles 1 , laws of optics, and optimal foraging theory 2-6 . Specifically, optimal foraging theories predict that natural selection may result in the ability of animals to maximize foraging efficiency by minimizing travel time during foraging trips 4-6 . Both ant trails and light routes are the outcomes of multiple agents' behavior (individuals or photons), and there is no central control to coordinate collective behavior. However, there is no need for a photon to 'remember' its previous trajectories, and physical interactions with the environment suffice to generate the time-minimizing propagation. Ants, on the other hand, utilize their own memory [19][20][21] as well as the pheromone laid by other workers along the trail. The previous study 18 hypothesized that the pheromone-based process is the underlying principle of similarity to optics. Our model grasped the core properties of trail formation, and the model results are congruent with the empirical results. The proposed model thereby fulfills two empirical conditions: it is consistent with the positive feedback process involved in pheromone trail formation, and it predicts a similarity between the observed ants' behavior and the laws of optics.
Although the empirically observed differences in track dispersion among impediment shapes are generally consistent with the predictions from time-minimizing principles, a substantial variation was observed, and thus other factors should be considered. In tests of concave-shaped and band-shaped impediments, where the direct path was clearly time-minimizing, some ants used paths deviating from it. In the convex-shaped impediments, in contrast, some ants still used the direct path yielding a disadvantage in travel time. For the former case, the density of ants on the trail may have bolstered the dispersion as ants try to avoid collision with others 10 , or as ants tend to deviate from the pheromone path 22 . For the latter case, ants could have instinctively preferred the direct path. In nature, where the direct path is generally time-minimizing, ants could have evolved a tendency to follow the direct path. It is possible that ants integrate time-reducing and distance-reducing manners. Studies show that ants have information about the local topographies and utilize path integration, spatial and geometric cues when navigating [11][12][13]19 . Furthermore, ants may not only consider time or distance minimization, but also energy efficiency maximization as an important criterion in optimal path formation 23 . Thus, the actual path may be slightly different from the time-minimizing path, leading to the lack of precise agreement with the expectation based on time minimization. Scenic familiarity may have affected the dynamics of trail formation through repeated trials as well 24 . Besides, there is evidence that coordinated collective behavior is not an essential factor for the trail formation: memories of individuals may suffice to form the robust trails in certain conditions 20,21 . Moreover, ants may be trapped in suboptimal routes due to the positive feedback from pheromone deposition 9 , which could be another reason for the discordance of ant trails and predictions.
Ants also tend to follow structural edges 14,15 which is visible in Fig. 2a1, b1, c1. We observed that some ants veer when they arrive at the Velcro impediment, and they follow along the edge before crossing into the Velcro. However, our simple model does not consider this effect when calculating time required to walk from the food to the nest. Otherwise, we assumed that the difference of travel time generated by edge-following has minimal effects on the results from an ideal model. In reality, however, we suspect that due to the shape of the impediment, the edge-following ants might be more likely to diverge from the impediment's midline for convex-shaped impediments and converge towards midline for concave-shaped impediments. In such a situation, the edge-following behavior may affect the observed differences in the dispersion (S) among different impediment shapes. Therefore, in future experiments of similar design, it is necessary to measure the temporal changes in the pheromone deposition behavior, pheromone concentrations, volatility, edge-following behavior, and distribution of tracks crossing the impediment to empirically determine the mechanism responsible for the observed results. As we observed only the later stage (60-90 min after the initiation) of the trail formation process, individual movements at the early stages of trail formation must be analyzed in order to fully understand the mechanism responsible for the observed differences in the dispersion (S) among different impediment shapes after one hour of trail-forming activities by ants. We suggest that the index of trail dispersion, S, proposed in our study, could be useful in the future research of ant trails' formation. of impediment shape on the theoretical dispersion index (Ŝ) calculated for each experiment from the data of ants' walking speeds on the paper-lined surface (v N ) and on the Velcro surface (v V ) shown in Table S1 in Supplementary Materials. In (d) and (e), the blue dots indicate the convex-shaped impediment treatment (CX), yellow dots, the band-shaped treatment (BD), and red dots, the concave-shaped (CC) impediment treatment. Black circles indicate the average value of S (or Ŝ) for each treatment, and error bars represent 95% confidence intervals. 95% CI for band-shaped impediment in (e) was too small to show (± 2 mm).
In summary, this is the first empirical demonstration that the differences in spatial dispersion of trails by ants across different lens-shaped impediments are generally similar to the dispersion differences of travel-time-minimizing routes of light rays across optical lenses of different shapes. Furthermore, the observed differences can be predicted from a simple mathematical model that captures the nonlinear nature of the pheromone trail formation process. The model suggests that the similarity with optics might be a consequence of travel-time-reducing principles that govern the two entirely different processes: the collective trail formation by ants and the behavior of light across media. However, detailed empirical observations of ant behavior on impediment edges during the process of pheromone trail formation are necessary to evaluate alternative explanations for this similarity.

Methods experimental procedures.
Experiments were performed at three Camponotus japonicus colonies (denoted by A1, MS, and MG). An average distance between colonies was 131.7 m, and they were located at Seoul National University Gwanak campus (latitude = 37° 27′ N; longitude = 126° 57′ E). We conducted trials at MS, MG in 2016 and at A1 in 2017. (The number of ants on the arena for each colony is described in Table S2) As ants from different colonies often scuffle 25 , by moving an ant from one colony to the vicinity of another colonies' entrance, we were able to confirm that the three colonies were distinct from each other. The colonies we chose were large enough for the ants to form trails (average number of ants on the experimental arena during analysis period> 17). As the pheromone leading to the ephemeral food source evaporates relatively rapidly 26,27 , a certain minimal number of ants might be required for the trail formation that resembles optical rules (however, no information on such evaporation of pheromone for our study species exists). However, the excessively large colonies were avoided because the bait near a gigantic colony is densely covered and fringed by many ants. If so, some ants are physically marginalized from the bait and cannot participate in the ordinary foraging process.
We prepared a 100 mm-wide Velcro tape (manufactured by Dong Yang Rubber) and cut it into 3 shapes: convex, band, and concave shapes. We rigged a tripod, a camcorder, and a 600 mm × 600 mm experimental arena with one of the impediments located in the middle of the arena as shown in Fig. 1 and in Fig. 3a near a colony's entrance. The arena was surrounded by 3-cm-high walls on which synthetic grease was daubed to hinder ants from climbing the walls.
Initially, we manually placed the ants alongside the bait and started filming right after a sufficient number (normally more than 5) of ants showed interest in the bait. We filmed for at least 90 minutes. All the videos were recorded with a 30-fps-camcorder during daytime under the shade made by nearby buildings to avoid overheating caused by direct sunlight.
The bait was composed of canned tuna with constant contents of sugar (mixture ratio of tuna to sugar = 17:1). The surface portion without the Velcro was covered with papers that were replaced on each round of an experiment to remove pheromone deposition. The Velcro was rubbed with an ethanol solution after each round of an experiment and dried for more than one day to remove the effect of the remaining pheromone.
At each colony, we performed two sets of experiments. Each set was composed of three treatments: concave-, band-, convex-shaped impediments, yielding 18 videos in total. We randomly mixed the order of the impediment in each set. The gap between the two sets in the same colony was 17.7 days on average (minimal gap: 11 days). This gap should be sufficient for the outside foragers to be replaced because the life expectancy of the outside foragers is known to be short (e.g. P. owyhee, 14 days 28 ; C. bicolor, 6.1 days 29 ). The average duration of each set was 5 days.
Video analysis and the data matrix. Using Adobe Premiere Pro CC, we adjusted contrast and brightness to facilitate the tracking efficiency by the video tracking software AnTracks (http://www.antracks.org). The arena in the video was adjusted into the square shape to correct the distortion caused by camera alignment. If an ant stood stationary for more than 5 s on the analysis region, we removed the corresponding points from the analysis by covering the points with a white layer. In that way, we exclusively analyzed mobile foraging ants. Images from the videos that are evidently not ants such as dirt, other insects, or shades of Velcro fibers were also erased from video by applying such layers.
We analyzed the edited videos from 60 to 90 min (30-min excerpt) after the initiation of filming when the trails were assumed to be stabilized. The video was transported to AnTracks to extract positions of ants in each frame. AnTracks provided the positions, trajectory IDs, time, and other information about ants' movement. Then, we used MATLAB R2017a to analyze the extracted coordinates.
Firstly, we excluded positions of ants with walking speeds outside the range between 1.5 cm/s and 20 cm/s. Walking slower than 1.5 cm/s were considered to be stationary, and objects which moved faster than 20 cm/s were considered erratic (they might have been flying insects). We also excluded trajectories whose duration is less than 0.5 s as extremely short trajectories are likely to be the traces of temporary shades or other flying insects.
We generated 'heatmaps' to visualize the distribution of walking ants on the whole experimental arena. Each heatmap is composed of 600 × 600 grids. As the side length of the experimental arena is 600 mm, a grid in a heatmap represents 1 mm × 1 mm area. Slower walking ants generate more coordinates during tracing and are more likely to contribute to more grids. In order to remove this bias, the contribution of a mobile ant to a grid should increase proportionately to the walking speed. Hence, each record of an ant in a grid was weighted by the corresponding walking speed at each position. The brighter grid color (higher grid values), therefore, indicates that ants were more likely to cross that grid. Examples of heatmaps are shown in Fig. 2a1, b1,c1.
The statistical analysis was conducted on the data recorded from a narrow analysis region (Fig. 3). Consecutive frame-by-frame positions (x, y coordinates) of the same ant within the analysis region form a trajectory. This enabled us to calculate the walking speed at each position. From the distance an ant moved between two consecutive frames (Δt =1/30 s), we calculated the walking speed of each position in a trajectory as www.nature.com/scientificreports www.nature.com/scientificreports/ ity vector's horizontal component which is parallel to the midline or x-axis in Fig. 3a,b) according to the formula = − Δ . For each of the 18 tests, we put data from all ant tracks into a data matrix containing two columns of coordinates, one column of speed values, and one column of horizontal speed values for all ant records in a test. This data was then subjected to analysis in order to extract a variable representing the degree of dispersion of foraging ants in each of the 18 tests.
Data analysis: an overview. We used the data matrix to determine how much the trajectories of ants traversing the impediment deviated from the midline. Let v i denote the speed of i-th traced coordinate and y i the i-th displacement from the midline. v i and y i are from the data matrix (Fig. 3a,b). In order to measure the dispersion, we decided to use the weighted standard deviation of y i 's within the analysis region (we refer to it as the index of dispersion, S). Weights of y i 's are horizontal speed associated with each data point. We used horizontal speed because the number of points per track within the analysis region is larger for slowly moving ants than that a b  www.nature.com/scientificreports www.nature.com/scientificreports/ of fast-moving ants. Ants with longer trails on the analysis region also have a similar bias. If all of the y i 's coordinates in the data matrix have the same weight when calculating the standard deviation of y i 's, the contribution of ants with longer trails or slow speed to the S (e.g. P1 in Fig. 3c) would be disproportionately larger than the contribution of ants with shorter trails or fast speed (e.g. P2 in Fig. 3c). It is, however, not sufficient to weight the distribution by the speed value to remove this bias as indicated by Fig. 3d. We, therefore, have multiplied the value of y-coordinates by the horizontal speed value.
In this way, even though the slow and longer tracks contribute a large number of data points, each of the data points is weighted less than each of the few data points of fast and straight tracks. By this measure, each track contributes equally to the total frequency distribution regardless of the walking speed, distance traveled, and turning frequency while traversing the analysis region. Therefore, this distribution is similar to the relative distribution of the number of tracks crossing the analysis region at various displacements (y) from the midline. Examples of the weighted frequency distributions are shown in Fig. 2. Finally, we calculated weighted standard deviation S as an index of dispersion of ant tracks crossing the analysis region. Small values of S indicate the convergence of trails on the impediment, and large values indicate the divergence. Mathematical formulae and details are described in the following section.
After obtaining S for each test, we used the linear mixed-effects models to evaluate the effect of the impediment shape on the S using the lmer function (the package lme4 in R (Bates et al. 2015)). In the model, the nest ID and the set ID were considered as random effects. When comparing mathematical expectations and empirical results, we used the Wilcoxon signed-rank test (in MATLAB R2017a).
Data analysis: mathematical calculations to obtain the index of dispersion, S. As the fidelity of tracking is not perfect for small ants, the traced trajectories of some ants are disconnected and fragmented. When using an analysis line rather than an analysis region for the count of traverses, the trajectories of ants whose segments do not cross the analysis line will not be counted. When adopting an analysis region, though some traces are fragmented, each segment can contribute to the overall results as long as the segment is contained in the analysis region. Therefore, utilizing the analysis region is relatively robust against tracking fidelity and continuity problems while producing similar results to the coordinate count on the line.
Let v i,h denote the horizontal speed of i-th traced coordinate. Also, let γ → X Y ([ , ]) denote the trajectory of an ant that links one point on the boundary of analysis region (X) and another point on the other side of the boundary (Y). γ → X Y ([ , ]) is theoretically continuous but discrete in an empirical sense, because it was measured in each frame whose duration is 1/30 s. As ants rarely turn backward on the impediment, we assumed that the sign of the horizontal velocity remains unchanged. We did not use the speed between two consecutive frames as weights because by doing so, we would have introduced a bias: ants with longer trajectories would have become overrepresented in the frequency distribution of y-values (Fig. 3d). Mathematically speaking, let ϕ j be the set of speed where L is the distance an ant moved on the analysis region in a single (convoluted) trajectory, and Δt is a duration of a frame (1/30 s). This is derived from the simple equation that ∑ Δ v t i equals the distance that an ant moved. As Δt is constant, the summation of the speed values on the analysis region is in proportion to the actual distance on which the ant moved. Accordingly, multiplying y i by the v i as the weight will produce biased results: For instance, if an ant curved its path on the analysis region as P1 in Fig. 3d, its distance would increase though both ants traversed the analysis region once.
To avoid these problems, we used horizontal speed values (v h ) as the weight associated with y i 's. Unlike the aforementioned methods, whichever paths ants take through the impediment, the sum of the horizontal movement in a single passage is equivalent to the width of the impediment, given that there is no turning back. In other words, where D is the width of the analysis region. Thus, horizontal speed on the is an appropriate measure that is robust against turns and walking speed.
Similarly, as the stepwise version of the equation, the following similarity holds (Fig. 3e,f).
where v i,h (v i,h ≥ 0) is the horizontal speed in the i-th frame in a specific trajectory, and ϕ j is the set of horizontal speed values in γ → X Y ([ , ]). Therefore, once the sign of the horizontal velocity is maintained, whichever direction and speed an ant exhibits, the sum of horizontal speed values is nearly constant for every traverse. This property allowed us to adopt horizontal speed as the weight for building the frequency distribution of y-values, from which the dispersion index, S, was derived. Examples of such weighted frequency distributions are shown in Fig. 2.
Hence, the index of dispersion used for the analysis is the weighted standard deviation of the ants' y-positions on the impediment weighted by their horizontal speeds, that is, , . All y i 's are included in the analysis region with non-zero horizontal speed values and N a is the total number of such y i 's.
This index gets larger as more ants generate dispersing paths. We used this index to compare dispersion among experimental treatments.
Description of formulae. As many of the ants passing through the Velcro moved nearly horizontally, and for simplicity of the model, ants are assumed to travel horizontally on the impediment. Ants were also assumed to travel directly in a straight line toward the entrance, bait, or edge of the impediment while on the paper-lined surface (Fig. 1e). Accordingly, the shape and configuration of the path are totally dependent on the y-coordinate of the passage point (equivalent to the y i 's in Fig. 3). As long as the speeds on the paper and on the impediment are fixed, the total travel time is determined by the distance an ant moves on each surface divided by the corresponding speed. where L N (y) and L V (y) are the distances an ant needs to travel on the paper-lined and on the Velcro surface (N stands for normal; V for Velcro), respectively; v N and v V are the speed values on the paper-lined surface and on the Velcro surface, respectively. Speed values in this process are assumed to be constant. Assuming constant speed, T(y) can be written as follows.
where v r is the relative ratio of v V to v N . The formation of pheromone trails by ants relies on positive feedback between the number of the ants using the trail and the amount of the pheromone, which exhibits nonlinear relationship 30,31 . As the first-line design of the formulae to embrace these facts, we assumed that the relative frequency density along the impediment's y-coordinates is in proportion to the k-th power of 1/T(y). In this way, the longer traveling time induces weaker trails, while the shorter traveling time induces even stronger trails. One can accordingly derive the relative frequency of the traverse across the analysis region as follows:  (Table S3) indicate that no significant difference was observed between theoretical and empirical observations when k = 12, 13, and 14.