# The Geometrical Structure of Bifurcations During Spatial Decision-Making

Dan Gorbonos1, Nir S. Gov4 and Iain D. Couzin1,2,3 1Department of Collective
Behaviour, Max Planck Institute of Animal Behavior, 78464 Konstanz, Germany
2Centre for the Advanced Study of Collective Behaviour, University of
Konstanz, 78464 Konstanz, Germany  3Department of Biology, University of
Konstanz, 78464 Konstanz, Germany  4Department of Chemical and Biological
Physics, Weizmann Institute of Science, Israel

###### Abstract

Animals must constantly make decisions on the move, such as when choosing
among multiple options, or “targets”, in space. Recent evidence suggests that
this results from a recursive feedback between the (vectorial) neural
representation of the targets and the resulting motion defined by this
consensus, which then changes the egocentric neural representation of the the
options, and so on. Here we employ a simple model of this process to both
explore how its dynamics account for the experimentally-observed abruptly-
branching trajectories exhibited by animals during spatial decision-making,
and to provide new insights into spatiotemporal computation. Essential neural
dynamics, notably local excitation and long-range inhibition, are captured in
our model via spin-system dynamics, with groups of Ising-spins representing
neural “activity bumps” corresponding to target directions (as in a neural
ring-attractor network, for example). Analysis, employing a novel “mean-field
trajectory” approach, reveals the nature of the spontaneous symmetry
breaking—bifurcations in the model that result in literal bifurcations in
trajectory space and how it results in new geometric principles for
spatiotemporal decision-making. We find that all bifurcation points, beyond
the very first, fall on a small number of “bifurcation curves”. It is the
spatial organization of these curves that is shown to be key to determining
the shape of the trajectories, such as self-similar or space filling,
exhibited during decision-making, irrespective of the trajectory’s starting
point. Furthermore, we find that a non-Euclidean (neural) representation of
space (effectively an elliptic geometry) considerably reduces the number of
bifurcation points in many geometrical configurations (including from an
infinite number to only 3), preventing endless indecision and promoting
effective spatial decision-making. This suggests that a non-Euclidean neural
representation of space may be expected to have evolved across species in
order to facilitate spatial decision-making.

##  I Introduction

Selecting among spatially-discrete options (targets), such as food sources,
shelters, or mates, is a ubiquitous challenge for animals. Despite this, very
little research has been undertaken with respect to the mechanistic basis of
spatial decision-making. For example, only recently have researchers
explicitly considered the trajectories exhibited by animals when making such
decisions [1]. These experiments with both invertebrates (fruit flies and
locusts) and a vertebrate (zebrafish) provided evidence that the brain
repeatedly breaks multi-choice decisions into a series of binary decisions in
space-time. This is reflected in abrupt changes in the trajectory of animals
as they approach targets. We demonstrated, in a simple spin-based model of
this cognitive process, that the bifurcations within the brain—that correspond
to literal bifurcations in the trajectories (when summed over many repeated
decisions) consistent with a recursive feedback between the (vectorial) neural
representation of the different options and the animal’s movement. Spatial
decision-making therefore appears to be an ‘embodied’ process that depends on
the recurrent interplay between the time-varying egocentric neural
representation of the options as animals move through space and the neural
consensus dynamics that establish which direction to select at each moment in
time. At such bifurcation points the spin model predicts that the brain
spontaneously becomes extremely sensitive to very small differences between
the options [1], which is a highly valuable property for decision-making.

Consistent with this model, the brains of a wide range of species have been
shown to represent egocentric spatial relationships via explicit vectorial
representation [2, 3, 4, 5, 6, 7]. For example, neural ring-attractor models
were motivated by such neuronal representations of the instantaneous heading
direction of animals in the horizontal plane regardless their location and
ongoing behavior [8, 9]. When animals are exposed to a prominent target, an
activity bump that corresponds to this target appears on a specified sector of
the ring [2, 3, 4, 5, 6, 7], and as result it ends up pointing towards the
target as the animal turns towards it. After exposure to a new attractive
landmark, the choice to turn to the new one is expressed as a shift in the
activity bump towards the new target. The exact nature of the angular shift of
the activity bump was found to be dependent on the relative angle of the new
landmark from the older one [2]. The interaction between the neurons within
this network have been shown to exhibit local excitation (positive feedback
among neural ensembles that represent directions with a small relative angle)
and long range, or global, inhibition (negative feedback between neural
ensembles that represent directions with a large relative angle). This
transition between types of feedback is responsible for the abrupt transition
between two types of behavior - a movement in a compromise between the targets
and a decision phase where the organism makes its way towards one of the
targets. This behavior is captured in our spin-model - at a critical angle
there exists a transition between a positive interaction between the spins
(“ferromagnetic”) and a negative one (“antiferromagnetic”). By analogy, the
spins in the model describe neuronal groups that either exhibit a relatively
high, or low, firing rate, respectively. It was shown in [1] that the number
of spins that are active in a specific direction can be formally mapped to the
firing rate of the corresponding neuronal cluster in the ring attractor class
of models.

The bifurcated trajectories observed for the fly, locust and fish [10], when
moving towards two or three targets, indicated that the spin-spin interactions
in the model have an angular dependence that deviates from a simple vectorial
dot product [11]. We therefore considered in [1] a distortion of the angle in
the decision making process that represents neuronal encoding of space in a
manner which could be non-Euclidean. This is supported by evidence for such
distortion in the neuronal interactions [12, 13]. Despite the good agreement
between the model and the experiments, many open questions remain. We
introduced in [1] a new tool to study the mean field solution which we called
“MF trajectory”, where we solved at each point in space the direction (or
directions) of motion assuming that the system reached thermal equilibrium.
The solution at each point gave us a vector (or vectors) that pointed towards
the next point. This way we got a solution which is effectively at thermal
equilibrium at each point in space. Using the MF trajectory we discovered the
emergence of trajectories with an infinite series of bifurcations (for 3
targets), but it was not clear what determines this phenomena. In addition we
found that the non-Euclidean distortion was roughly the same across species.
These results naturally bring up the following questions: What (if anything)
is special about this regime of distortion? What controls the complexity,
overall spatial organization and structure of the trajectories and their
bifurcations? Why do we find in the simulations (and consistent with
experimental data) always two outgoing branches from each bifurcation?

These and other questions motivated us to study in greater detail the origin
of the different classes of trajectories predicted by the model and the
bifurcations along them. The analysis presented here exposes novel geometrical
principles that relate the mutual arrangements of the bifurcations to the
arrangement of the targets.

The model is also interesting from a basic statistical physics point of view,
as a new non-equilibrium system. Note that this is a complex physics problem,
where the spin state defines the direction of motion, while the motion along
the trajectory constantly changes the relative angles between the targets, as
perceived by the moving animal, thereby changing the spin interactions (the
Hamiltonian) along the trajectory. The present study of this problem also
makes an advance in our understanding of this novel non-equilibrium
statistical physics model, whereby the order parameter (“magnetization”) of
the spins translates into direction of motion through space. Therefore it
expands our understanding of a novel class of active complex systems, where
self-propelled particles undergo internal “decisions” regarding their
directions of motion.

##  II The spin model

Here we generalize the spin model that was introduced in [11] to $k$ targets
(see also in the SI of [1]). The degrees of freedom are modeled as $N$ spins
that are divided into $k$ equal subgroups. The direction of a target which is
associated with a subgroup is denoted by $\hat{p}_{i}$ ($i=1,..,k$). Each
individual spin in a subgroup has two states; “on”, representing the neuronal
firing ($\sigma_{i}=1$) or “off” ($\sigma_{i}=0$). The system can be described
by the following Hamiltonian:

$H=-\frac{k\,\bar{v}^{2}}{N}\sum_{i\neq
j}\hat{p}_{i}\cdot\hat{p}_{j}\sigma_{i}\sigma_{j},$ (1)

where $\bar{v}$ is a constant whose dimension is velocity. The connectivity
between the spins is all-to-all, for simplicity, which makes the mean-field
(MF) solutions exact in the large $N$ limit.

The instantaneous velocity of the organism (or the group [11]) is given by the
sum of all the “on” spins in the direction of the respective targets

$\vec{V}=\bar{v}\sum_{i=1}^{k}n_{i}\hat{p}_{i},$ (2)

where $n_{i}=\frac{N_{i}}{N}$, $N_{i}$ is the number of individuals that exert
a force in the group i (towards the target in the direction $\hat{p}_{i}$).
When the dot product between two spins is positive
($\hat{p}_{i}\cdot\hat{p}_{j}>0$) the interaction is ferromagnetic (as between
the spins in the same subgroup) and when it is negative, the interaction is
antiferromagnetic. Below, we modify this dot product, motivated by recent
models of neuronal perception [1].

The spin flip rates are constructed from the Hamiltonian (Eq.1), in terms of
Glauber dynamics [14]:

$r^{(i)}_{1\rightarrow
0}=\frac{1}{1+\exp\left(\frac{2\,k\,\bar{v}\,\vec{V}\cdot\hat{p}_{i}}{T}\right)}\quad\quad
r^{(i)}_{0\rightarrow
1}=\frac{1}{1+\exp\left(-\frac{2\,k\,\bar{v}\,\vec{V}\cdot\hat{p}_{i}}{T}\right)},$
(3)

where $r^{(i)}_{1\rightarrow 0}$ is the rate in which a spin in group $i$ is
switched off and $r^{(i)}_{0\rightarrow 1}$ is the rate in which the spin is
switched on. The temperature in our model describes the noise that drives
random spin-flipping dynamics [11]. Within the context of neuronal dynamics,
the temperature $T$ represents the stochastic noise of neuronal firing. The
equations of motion for the number of active spins in each subgroup (master
equation), in the limit of $N\gg 1$, are:

$\frac{d\,n_{i}}{dt}=\frac{\frac{1}{k}-n_{i}}{1+\exp\left(-\frac{2\,k\,\bar{v}\,\vec{V}\cdot\hat{p}_{i}}{T}\right)}-\frac{n_{i}}{1+\exp\left(\frac{2\,k\,\bar{v}\,\vec{V}\cdot\hat{p}_{i}}{T}\right)}.$
(4)

It is convenient to rearrange Eq. (4) to get

$\frac{d\,n_{i}}{dt}=\frac{1}{k\left(1+\exp\left(-\frac{2\,k\,\bar{v}\,\vec{V}\cdot\hat{p}_{i}}{T}\right)\right)}-n_{i}.$
(5)

The steady-state solution of Eq. (5) can be written as the solution of the
following system of algebraic equations:

$n_{i}=\frac{1}{k\left(1+\exp\left(-\frac{2\,k\,\bar{v}\,\vec{V}\cdot\hat{p}_{i}}{T}\right)\right)}\quad\quad\quad
i=1,...,k.$ (6)

The system of MF equations include the $k+2$ equations (2) and (6), whose
solutions are the steady-state velocity and the fraction of active spins in
each group: ($\vec{V}_{ss},n_{i,ss}$) ($i=1,..,k$). We will refer to this
system as the MF steady-state (MFSS) solutions.

##  III Mean Field trajectories and bifurcation points

Here we introduce “MF trajectories” as a new tool to study the dynamics, while
in [11, 1] the trajectories were found by simulations. The nature of these
trajectories, and the types of bifurcations along them, are explored below for
systems with two or three targets.

###  III.1 Two targets

At each point in space we can calculate the stable steady-state solutions
($\vec{V},n_{i}$), which give the MF direction vectors that are possible at
that point. This defines a global flow field (Fig. 1D) along which the animal
moves, in the limit of slow speed, such that the spins have time at each
position to equilibrate to the MFSS solutions, and the trajectory follows the
flow field defined by these stable solutions. For targets that are at
infinity, the angles between them are constant, and the Hamiltonian (Eq.1) is
time-independent. However, for targets at finite distances, the relative
angles change along the trajectory. Furthermore, the animal can move from a
region with a single solution to a region where there are several stable
solutions, and there is a spontaneous symmetry breaking. The location along
the trajectory where such a transition occurs is defined as a bifurcation
point, as the trajectory splits into several possible trajectories that emerge
from that point.

We can define a bifurcation point where the MFSS solution along which the
animal was moving, becomes unstable, and write the criterion for instability
of a general MFSS solution. The dynamical equation for the velocity can be
obtained using equations (2) and (5):

$\frac{d\vec{V}}{dt}=\bar{v}\sum^{k}_{i=1}\frac{dn_{i}}{dt}\hat{p}_{i}=\sum^{k}_{i=1}\frac{\bar{v}}{k\left(1+\exp\left(-\frac{2\,k\,\bar{v}\,\vec{V}\cdot\hat{p}_{i}}{T}\right)\right)}\hat{p}_{i}-\vec{V}$
(7)

Let $\vec{V}_{ss}$ be a solution of the model equations and consider a small
perturbation to the velocity in the perpendicular direction to the velocity
$\vec{V}$:

$\vec{V}=\vec{V}_{ss}+\epsilon\hat{n}$ (8)

where $\hat{n}$ is the normal to $\vec{V}$. Substituting into Eq. (7),
expanding to first order in $\epsilon$ and taking the normal component we get
the following equation for the perturbation $\epsilon$

$\frac{d\epsilon}{dt}=-A\epsilon+\mathcal{O}\left(\epsilon^{2}\right)$ (9)

where

$A\equiv
1-\frac{\bar{v}^{2}}{2\,T}\sum^{k}_{i=1}\operatorname{sech}^{2}\left(\frac{k\,\bar{v}\,\vec{V}\cdot\hat{p}_{i}}{T}\right)(\hat{n}\cdot\hat{p}_{i})^{2}.$
(10)

Then the solution $\vec{V}$ is stable if $A>0$ and unstable if $A<0$.
Therefore the bifurcation occurs where $A=0$.

This definition means that we choose to construct the MF trajectories such
that the bifurcation occurs at the spinodal curve, according to the MF phase
diagram, as shown for two targets in Fig. 1A. The transition could be chosen
to occur at any point in the hysteresis region of the phase diagram (grey
region), between the binodal (where two new stable solutions first appear) and
spinodal (where the original “compromise” direction becomes unstable) lines.
We show in the SI that at the point where a MF solution becomes unstable,
there are at least two alternative stable solutions. Then we repeat the same
procedure along the new stable solutions and this way form a directed graph
whose nodes are the bifurcation points. For more details on how the MF
trajectories were calculated in practice, see the SI.

The MF trajectory for two targets is given in Fig. 1B for $T=0.2$ (the
geometrical arrangement of the targets as in the experimental setup, see Fig.
1 in [1]). The critical bifurcation angle between the targets, where the
bifurcation point occurs, is the one that corresponds to the intersection of
the spinodal curve and the horizontal line $T=0.2$ in the phase diagram (Fig.
1A). At higher temperatures, above the tri-critical point where the binodal
and spinodal curves coincide, the transition is second order and there is no
hysteresis region.

Figure 1: The phase transition for two and three targets. (A) A phase diagram
describing the phase transition exhibited in a bifurcation in space while
moving from compromise to decision between two targets. The shaded area (also
in E) represents the region in parameter space where both the compromise and
the decision solutions exist. The dashed black line is the coexistence curve
(binodal) where the additional phase (the decision) appears as an additional
stable solution. The solid black line is the spinodal curve where the
compromise solution becomes unstable and the system has to move into a stable
decision phase (towards one of the two targets). The black dot is the
tricritical point that separates the second order phase transition (above)
from the first order (below). The critical angle at $T=0.2$ (between the two
targets) corresponds to the MF trajectory in B (B) The trajectory in space
with the bifurcation point that corresponds to a phase transition on the
spinodal curve at $T=0.2$ as shown in the phase diagram in A. The bifurcation
point is marked by a red dot. The targets are at $(4.33,2.5)$ and
$(4.33,-2.5)$ (as in [1]) (C) The effective free energy landscape at the
bifurcation point of B as a function of the velocity $\vec{V}=(V_{x},V_{y})$.
At the phase transition point the velocity in the original direction becomes
an unstable saddle point (red arrow) and the two new stable solutions (white
arrows) correspond the two new minima (spontaneous symmetry breaking). (D)
Vector fields that represent the stable solutions for the velocity at each
point for two targets. The curve of first bifurcation is given in dashed
brown, where the velocity in the original direction of motion becomes
unstable. It separates between the regime where compromise stable solutions
exist (whose vector fields are given in orange), and the regime of decision
(stable solutions in purple arrows). Examples of two possible trajectories are
given in blue. (E) A phase diagram describing the first bifurcation in the
case of three targets. The angle is measured between the external targets (the
left and the right targets). The critical angle at $T=0.2$ corresponds to the
mean field trajectory in F. (F) The spatial trajectory in the MF approximation
that corresponds to a phase transition on the spinodal curve at $T=0.2$ as
shown in the phase diagram in E. The targets (black dots) are at $(4.33,2.5)$,
$(4.33,-2.5)$ and $(5,0)$ (as in [1]). The bifurcation points are marked by
red dots. The emerging pattern is explained later in Fig. 2. Only the first 4
bifurcation points are shown in every path (“bifurcation depth” of 4) (G) The
effective free energy landscape at the first bifurcation point in F as a
function of the velocity $\vec{V}=(V_{x},V_{y})$. (similar to C).

Another way to examine the bifurcation points is using the effective free
energy (whose derivation appears in the SI, and in [11]), which is given by

$F(\vec{V},T)=k\,\vec{V}^{2}-\frac{T}{k}\sum_{i=1}^{k}\ln\left(1+\exp\left(\frac{2\,k\,\bar{v}}{T}\,\vec{V}\cdot\widehat{p}_{i}\right)\right).$
(11)

The effective free energy at a specific point in space is a function of the
velocity and the angles towards the targets, and it shows the energetic cost
of different spin configurations that correspond to different velocities (the
“free energy landscape”). The stable MFSS solutions correspond to minima of
this free energy. In Fig. 1C we see the free energy function at the
bifurcation point of Fig. 1B, where the original direction of movement becomes
a saddle point, and the two new minima correspond to the two new stable
solutions and directions of motion.

In Fig. 1D we plot the flow field, of the MFSS solutions. The bifurcation
points for two different trajectories are denoted, lying along a curve that
connects the two targets. We find this curve by requiring that the compromise
between the two targets $n_{1}=n_{2}\equiv n$ is a stable solution (Eqs. 2,6),
while requiring that $A=0$ at the bifurcation points (Eq. 10). We then obtain
the following two equations:

$\displaystyle\frac{2\,T}{\bar{v}^{2}}$ $\displaystyle=$
$\displaystyle\operatorname{sech}^{2}\left(\frac{2\,\bar{v}\,V_{p}}{T}\right)(\sin^{2}\theta_{1}+\sin^{2}\theta_{2})$
(12) $\displaystyle n$ $\displaystyle=$
$\displaystyle\frac{1}{2\left(1+\exp\left(-\frac{4\,\bar{v}\,V_{p}}{T}\right)\right)}$
(13)

where

$V_{p}=\bar{v}\,n\left(1+\cos(\theta_{1}+\theta_{2})\right)$ (14)

and we denote by $\theta_{1,2}$ the angles to the respective targets as
measured relative to the $x$ axis. We have three variables
($\theta_{1},\theta_{2},n$) for two equations and therefore a one parameter
family of solutions which defines the bifurcation curve that connects the two
targets (the dashed brown line in Fig. 1D). Using the effective free energy we
can also prove that the description of a bifurcation point as a point of
instability of one solution is equivalent to the existence of at least two
stable solutions at this point. The proof appears in the appendix.

###  III.2 Three targets

In the case of three targets there is more than one bifurcation point along
the trajectory. Let’s consider a symmetric starting point, as shown in Fig.
1F. The first bifurcation is between a compromise of all the three targets
(for $\theta<\theta_{c}$) and a compromise of only two targets (while the
remaining target is suppressed). The phase diagram for this first bifurcation
point, along a symmetric trajectory, is given in Fig. 1E, with the
corresponding MF trajectory in Fig. 1F. The effective energy landscape for
this first bifurcation is shown in Fig. 1G, and has the same binary structure
as for the bifurcation of two targets (Fig. 1C).

At the second bifurcation we find that the trajectories become much more
complex (Fig. 1F), with one solution pointing towards an edge target, while
the second solution is a compromise of the remaining two targets. Subsequently
there are more bifurcations of the same type, alternating between the
outermost targets and compromise solutions (between the left and central
targets, or between the right and central targets). This pattern introduces an
infinite number of bifurcations that become infinitely dense towards the
central target. In the SI we show numerically that this sequence converges
into an infinite geometric series towards the central target, where the
pattern becomes self-similar. For this particular arrangement of targets, the
MF trajectories are found to reach the central target after an infinite series
of bifurcations. The presence of noise during the motion of a real animal, or
during dynamic simulations, enables trajectories to reach the central target
[1].

The number and positions of the bifurcation points strongly depends on the
geometrical arrangement of the targets. In Fig. 2A-D we demonstrate this by
calculating the trajectories for a geometry where the central target is
shifted to be further behind the two edge targets, compared to the arrangement
of Fig. 1F. In this configuration, the trajectories are not self-similar, and
there are trajectories that reach the central target, as shown in Fig. 2B,C by
following the trajectories up to the fourth bifurcations. In the case of three
targets, the curve on which the first bifurcation points lie does not
correspond to a compromise between targets, and unlike the case of two targets
we do not have an analytic condition for this curve. It is found numerically,
denoted by the green dashed line in Fig. 2 for the trajectories that start to
the left of the edge targets.

Figure 2:  Bifurcation Curves. (A) A trajectory that starts from $(-15,0)$
towards three targets at $(-3.4,12)$, $(-3.4,-12)$ and $(20,0)$ (shown only
starting from $x=-10$). The depth is 4 bifurcation points. Bifurcation points
are in red and bifurcation curves are the dashed brown curves. A curve of
first bifurcation is in dashed green. The first three bifurcation points are
numbered by their order. The inset shows the definition of the angles that are
used in the parametrization of the bifurcation curves for three targets that
correspond to compromise of two of the three targets (the dashed brown
curves). (B) The energy diagram at the third bifurcation point of the diagram
in A. The original direction becomes unstable (dahsed green) and there are
four minima that correspond to the four possible directions (solid white). (C)
The same like A (four first bifurcation points) but with asymmetric initial
conditions (starting from $(-15,8)$). The trajectory still converges towards
the same bifurcation curves. (D)-(G) The formation of a limiting self-similar
structure as a result of the absence of one of the bifurcation curves at
$T=0.2$. The bifurcation points are in red and the bifurcation curves are in
dashed brown. The depth is 12 bifurcation points. The starting point of all
the trajectories is at (-10,0). Two of the targets are at (-3.4,12) and
(-3.4,-12). The only difference between the four plots is in the position of
the central target. (D) The central target is at (20,0). Note how the
bifurcation points are dense (in a segment of the bifurcation curve). (E) The
central target is at (15,0) (F) The central target is at (7,0) (G) The central
target is at (1,0). Here the target is before the bifurcation curve that
connects the left and right targets, and thus a self-similar pattern emerges
(in the limit). The inset shows a magnification of the pattern.

The second bifurcation along the trajectories is also binary, leading to one
of the edge targets or to a compromise of the remaining targets. However, the
third bifurcation is sometimes split into more than two outgoing trajectories
(Fig. 2B,C). In general, the trajectory arriving at the third bifurcation was
a compromise between two targets. This compromise becomes unstable at the
“bifurcation curves” (BC) denoted by the dashed brown lines in Fig. 2.
Therefore, from each bifurcation point on these BC, there can be up to four
outgoing trajectories (Figs. 2B,C): two “decision” trajectories towards the
two targets that were in compromise when arriving at the BC, and two
“compromise” solutions that involve the third target.

The BC, and their organization with respect to the targets, are key to
determining the shape of the trajectories, as all the bifurcation points of
second and higher order reside on them. Let us start by specifying the
analytic conditions that these BC obey: We require an instability $A=0$ (Eq.
10), in which there is a compromise of two group of spins (in the case of
three targets, in analogy to Eq. (12) for two targets). By requiring a
compromise of two of the three targets, we obtain three pairs that give us the
three BC in Fig 2B,C. Let us consider for example the trajectories where we
have compromise between two targets ($n_{1}=n_{2}$). It’s convenient to
parameterize the points according to three angles that are given in the inset
of Fig. 2A. For a given point $\theta_{1},\theta_{2},\theta_{3}$ are angles to
the corresponding target directions $1,2,3$ and in addition we define the
following angles:

$\displaystyle\theta_{12}$ $\displaystyle=$
$\displaystyle\theta_{1}+\theta_{2},$ $\displaystyle\theta_{23}$
$\displaystyle=$ $\displaystyle\pi-\theta_{2}-\theta_{3},$
$\displaystyle\theta_{13}$ $\displaystyle=$
$\displaystyle\pi-\theta_{1}+\theta_{3},$ (15)

that we substitute into the velocity components, that are given for the case
of three targets in Eqs. (A.16, A.17, A.18), to give us

$\displaystyle V_{p1}$ $\displaystyle=$
$\displaystyle\bar{v}\left(n_{1}+n_{2}\cos(\theta_{1}+\theta_{2})-n_{3}\cos(\theta_{1}-\theta_{3})\right),$
(16) $\displaystyle V_{p2}$ $\displaystyle=$
$\displaystyle\bar{v}\left(n_{1}\cos(\theta_{1}+\theta_{2})+n_{2}-n_{3}\cos(\theta_{2}+\theta_{3})\right),$
(17) $\displaystyle V_{p3}$ $\displaystyle=$
$\displaystyle\bar{v}\left(n_{3}-n_{1}\cos(\theta_{1}-\theta_{3})-n_{2}\cos(\theta_{2}+\theta_{3})\right).$
(18)

Substituting into the steady state equations A.15 and A.21, where we take
$A=0$ and compromise between two targets at the bifurcation points, we get the
following system of five equations:

$\displaystyle n_{1}$ $\displaystyle=$ $\displaystyle n_{2},$ (19)
$\displaystyle\frac{2\,T}{\bar{v}^{2}}$ $\displaystyle=$
$\displaystyle\operatorname{sech}^{2}\left(\frac{3\,\bar{v}\,V_{p_{1}}}{T}\right)\sin^{2}\theta_{1}+\operatorname{sech}^{2}\left(\frac{3\,\bar{v}\,V_{p_{2}}}{T}\right)\sin^{2}\theta_{2}+\operatorname{sech}^{2}\left(\frac{3\,\bar{v}\,V_{p_{3}}}{T}\right)\sin^{2}\theta_{3},$
(20) $\displaystyle n_{1}$ $\displaystyle=$
$\displaystyle\frac{1}{3\left(1+\exp\left(-\frac{6\,\bar{v}\,V_{p_{1}}}{T}\right)\right)},$
(21) $\displaystyle n_{2}$ $\displaystyle=$
$\displaystyle\frac{1}{3\left(1+\exp\left(-\frac{6\,\bar{v}\,V_{p_{2}}}{T}\right)\right)},$
(22) $\displaystyle n_{3}$ $\displaystyle=$
$\displaystyle\frac{1}{3\left(1+\exp\left(-\frac{6\,\bar{v}\,V_{p_{3}}}{T}\right)\right)},$
(23)

for six variables: $n_{1},n_{2},n_{3},\theta_{1},\theta_{2},\theta_{3}$. Then
the solution can be parameterized by one parameter that gives us a curve that
connects pairs of targets (Fig. 2B,C dashed brown curves). In Fig. 2B,C we
show the first four bifurcation points, which lie on the BC. In Fig 2D we
follow the trajectory up to high order (12) of bifurcations, and we find that
the trajectory has a space-filling property, with the bifurcation points
accumulating along the central part of the BC.

Furthermore, the BC are determined by the relative positions of the targets
and not by the starting point of the trajectory (Fig. 2B,C). In this sense the
BC act as attractors of the MF trajectories. We demonstrate this by plotting
the trajectories and the BC for configurations where the central target is
shifted closer to the edge targets, as shown in Fig. 2E-G by following the
trajectories up to 12th bifurcation order. Since the edge targets remain in
the same positions as in Figs. 2B-D, the BC that connects these two targets
remains the same. By shifting the central target towards the edge targets we
reach a configuration (Fig. 2G) where this BC is on the other side of the
central target, and thus cannot be reached by trajectories that bifurcate
along the other two BC. As a result, we obtain only two reachable BC (dashed
brown lines in Fig. 2G), and an infinite interplay between them which
converges to a self similar pattern (Fig.1F, and see SI for more details).

The dependence of the bifurcation structure on the temperature is given in
appendix (Figs. 7, 8, 9). In particular, we find that the BC simplify
significantly and become straight lines between the targets in the limit of
$T\rightarrow 0$.

##  IV Comparison between simulated and MF trajectories

Since real animals and flocks move at a finite speed, and are exposed to
sources of noise (e.g. sensory noise), we next explore the relation between
the deterministic MF trajectories, and noisy simulations of the spatial
decision-making process. In [1] we showed that these sources of noise can
smear out the fractal-like trajectories predicted by the MF (Fig. 2G), in the
numerical simulations.

In the numerical simulations (Fig. 3) each target is represented by a small
number of spins (15 per target), and therefore has intrinsic finite-size
noise. In addition, the position of the moving animal (or flock) is updated
with a time step that allows for about 10 spin updates, using Glauber dynamics
(Eq.3). This procedure of finite time per movement step is different from the
MF behavior, which is the limit of infinitely slow movements. Unlike MF where
the spins are at their equilibrium at each point along the trajectory, the
spins are not at equilibrium along the simulated trajectory.

Examples of simulation trajectories are given in Fig. 3A, which are compared
to the corresponding MF trajectory (Fig. 3B). Let us focus on the third
bifurcation, denoted by the blue frame in Fig. 3A,B. In this bifurcation in
the simulation there are only two outgoing trajectories, while in the MF
trajectory we find three outgoing trajectories and in different directions. We
can explain these differences by looking at the energy lanscape for this
bifurcation, in Fig. 3C. The red arrow indicates the original unstable
direction. The green arrows show the time evolution of the spins, as the
system flows towards the newly available minima. The MF directions correspond
to the three new minima at this bifurcation point, while the directions in
which the system leaves the bifurcation in the simulations correspond to the
minimum (“min-1”) and saddle point (“meta”) that are closest to the original
direction. Due to the short time available for the spins to evolve at each
point along the simulated trajectory, the system moves along the two
directions where the spin evolution slows down, corresponding to the the
minima or saddle point closest to the original direction before the
bifurcation point. Trajectories pointing towards the compromise of the edge
targets (“min-2” in Fig. 3C) is therefore not observed in the simulations.
When the system continues along the saddle-point direction (“meta”), it
sometimes becomes a true minimum after a short time, allowing the system to
continue towards the central target. This way, in this example, the system can
reach the central target from the third bifurcation point, even though we do
not see it in the MF trajectory. In other cases, we see that the spins evolve
away from the saddle to the local minimum (“min-3”), and there is a sharp turn
in the trajectories (denoted by red circles in Fig. 3C).

This example explains why we never see bifurcations that are non-binary in the
simulations and in the experimental data [1], despite the existence of such
complex bifurcations in the MF trajectories.

Figure 3:  The simulation. (A) Some trajectories from the simulation, each
trajectory is in a different color. Starting point is $(0,0)$. The targets are
at $(4,12)$,$(4,-12)$ and $(20,0)$ (in black). We want here to examine the the
trajectories at the third bifurcation point (marked by the blue square). (B)
The MF trajectory until the third bifurcation point, given here for
comparison. The three outgoing lines correspond to the three minima at this
point. (C) The energy diagram at the third bifurcation point. The original
direction before the bifurcation (yellow arrow) becomes a saddle point, and
thus unstable. The diffusion to the new possible solutions is denoted by the
green arrows. There is one meta-stable solution and three minima that
correspond to the three outgoing directions in B (the MF). Highest probability
is to end up in one of the two solutions that are closest to the original
unstable one. It explains why the bifurcations in the simulation are always
binary without trajectories directed backwards.  Figure 4:  The phase
transition at $\nu=0.5$, which is the value of the angular distortion
according to the experimental results in [1]. (A) A phase diagram describing
the phase transition exhibited in a bifurcation in space while moving from
compromise to decision between two targets at $\nu=0.5$. (B) The MF trajectory
(in blue) for two targets with the bifurcation point that corresponds to a
phase transition on the spinodal curve at $T=0.2$ as shown in the phase
diagram in A. The bifurcation point is marked by a red dot. The targets are at
$(4.33,2.5)$ and $(4.33,-2.5)$ (as in [1]). Note that the bifurcation here
happens at a smaller critical angle compared to $\nu=1$ (Given here in light
gray for comparison, see Fig. 1) (C) A phase diagram describing the first
bifurcation in the case of three targets at $\nu=0.5$. (D) The MF trajectory
(in blue) for three targets with the bifurcation point that corresponds to a
phase transition on the spinodal curve at $T=0.2$ as shown in the phase
diagram in C. The targets (black dots) are at $(4.33,2.5)$, $(4.33,-2.5)$ and
$(5,0)$ like in Fig. 1F. Since the bifurcations (the red dots) appear in
smaller critical angles the self similar pattern, which is explained in Fig.
2), is shown more explicitly compared to $\nu=1$ in Fig. 1F (which is given
here for comparison in light gray). Note that in principle it should continue
until the central target at $(5,0)$ and only the first 12 bifurcations are
shown here (the “bifurcation depth” is 12).  Figure 5:  An example for the
reduction of structure complexity of trajectories when the angular distortion
is increased (smaller $\nu$). The targets are at $(4,12)$ \- left,$(4,-12)$ \-
right and $(20,0)$ \- central. A depth of five bifurcation points is given
here. $T=0.2$. (A) $\nu=1$ (B) $\nu=0.85$ (C) $\nu=0.7$ (D) $\nu=0.5$.
Bifurcation curves are in dashed brown. In the insets we see the same
trajectories with depth of 12 bifurcation points that show how the space
filling area shrinks as $\nu$ is reduced. In the case of $\nu=0.5$, the total
number of bifurcations is three (and therefore no inset). In the case of four
targets loops might be formed and smaller values of $\nu$ (stronger angular
distortion) help to escape the loops. The targets (in black) are at
$(0,5)$,$(3,3)$,$(3,-3)$ and $(0,-5)$. The temperature is always $T=0.2$, and
the trajectory starts from $(-2,0)$. The bifurcation points are in red. (E)
$\bm{\nu=1}$ \- no angular distortion. Depth of 12 bifurcation points. The
loops do not overlap each other but remain tight. (F) $\bm{\nu=1}$ \- no
angular distortion. Depth of 9 bifurcation points. Here only the first few
loops are shown. Note how the loops are formed out of a series of
bifurcations. (G)$\bm{\nu=0.9}$. Depth of 9 bifurcation points. Due to the
angular distortion the bifurcations appear earlier along the trajectories. (H)
$\bm{\nu=0.75}$. Depth of 8 bifurcation points. In addition to earlier
bifurcations, the angular distortion is so strong that direct trajectories are
formed towards the targets on the right - a way out of the loop.The aspect
ratio in figures E-H is not equal to 1 in order to show the loop structure
clearly.

##  V The non-Euclidean Encoding of Space

Another aspect of the trajectories that we found when comparing our model to
the experiments [1], is that the interactions between the spins are modified
from the simple cosine function of the relative angles (dot product in Eq.1).
We now explore how this modified interaction affects the MF trajectories,
which can shed light on the features that this modification provides.

The angle between targets at $\hat{p}_{i}$ and $\hat{p}_{j}$, $\theta_{ij}$,
denote the angle between targets at $\hat{p}_{i}$ and $\hat{p}_{j}$, so that

$\cos\theta_{ij}=\widehat{p}_{i}\cdot\widehat{p}_{j}$ (24)

The modified interaction between the spins that represent targets $i,j$ is
simply the cosine of the distorted angle $\tilde{\theta}_{ij}$, parameterized
by $\nu$

$\theta_{ij}\rightarrow\tilde{\theta}_{ij}=\pi\,\left(\frac{\theta_{ij}}{\pi}\right)^{\nu}.$
(25)

For $\nu<1$ in Eq. (25) we get a distortion of the Euclidean angle between the
directions of the targets corresponding to the interaction becoming negative
at a smaller relative angle, and as a result a non-Euclidean encoding of space
(effectively an elliptic geometry). From comparison to a series of experiments
in fruit flies, locusts and zebrafish a common value of $\nu\sim 0.5$ was
obtained, and for this value we plot the phase diagrams for a symmetric
trajectory towards two and three targets (Fig. 4A,C), which shows that the
transition lines are shifted to lower angles compared to Fig. 1A,E. The
corresponding MF trajectories for the two and three target systems are shown
in Fig. 4B,D, compared to the trajectories for simple cosine interactions
($\nu=1$, Fig. 1B,F). The stability test in Eq. (10), which we used before to
identify the bifurcations along the MF trajectories, cannot be generalized to
$\nu<1$ directly. For this purpose we had to rewrite it into an equivalent
form which is given in the appendix (Eq. (A.4)). Using this equivalent form,
we can also obtain equations for the BC, for the modified interactions for
$\nu<1$, by replacing Eq. (20) with Eq. (A.4).

Next we want to examine how the trajectories change when the angular
distortion is introduced, namely as $\nu$ is decreased below $1$. For the case
of three targets, we find that for decreasing $\nu$ there is a reduction in
the complexity of the trajectories, as shown for example in Fig. 5A-D. Due to
the reduction in $\nu$ the bifurcations happen earlier along the trajectory at
a smaller relative angle (as in Fig. 4), and this way many complexities of the
bifurcation pattern shrink and sometimes vanish. The number of bifurcations is
reduced from infinity for $\nu=1$ up to three bifurcations for $\nu\lesssim
0.55$.

In the case of four targets we find that the effects of the angular distortion
can be even more dramatic. For the regular cosine ($\nu=1$) interactions, we
find loops in the trajectories (Fig. 5E), which form due to an endless series
of bifurcations, and do not allow any trajectory to reach the middle targets
(the two targets that are on the right side). We show in detail how loops are
formed in this case in the appendix. Applying angular distortion (Fig. 5F-H)
we find that the whole bifurcation tree becomes more spatially spread, and
trajectories that lead to the middle targets appear.

Overall, the MF trajectories in Figs. 4\- 5 demonstrate that by employing
interactions based on the distorted relative angle, with $\nu$ significantly
lower than $1$, the animals and flocks achieve trajectories that have
bifurcations that are spread over a much larger spatial domain. This spreading
of the bifurcation network simplifies the trajectories, and resolves
pathological paths such as loops that never reach certain targets. This leads
in reality to a more uniform probability of reaching the different targets,
thereby making foraging more efficient and less prone to biases based on the
geometry of the targets’ relative locations.

##  VI Discussion

We presented here a detailed theoretical exploration of the mean field (MF)
trajectories that arise from our spin-based decision-making model, which
describes how single animals (and perhaps also animal groups [1]) navigate
towards an array of identical targets. This model was recently shown to
predict tree-like trajectories with bifurcations, that were found in
experiments and simulations of single animal and flock movement [1]. Here we
showed that the bifurcations along these trajectories lie along “bifurcation
curves” (BC), and the organization of these BC determine the global nature of
the trajectories. These BC are dependent on the spatial organization of the
targets, and thus do not depend on specific initial conditions of the
trajectory. The BC serve as attractors of the bifurcation points, such that
any trajectory tends to converge to the same pattern of transitional movement
between the BC. We show that the mutual arrangement of BC determine the
qualitative nature of the trajectories. For example, for 3 targets if all the
three BC intersect each other we get a space filling trajectory and if they do
not intersect each other we get a self-similar trajectory.

The MF analysis of the trajectories also allows us to map the energy landscape
in the spin/velocity space at the bifurcation points, thereby exposing when
the outgoing paths will reach directly one of the targets, or continue along
other compromise directions between targets. We can explain why we see in
simulations only two branches (two outgoing trajectories) at every bifurcation
point - at the bifurcation point the direction of motion shifts towards the
new stable directions of motion, ending up at the first minima or saddle point
(“exit point”) that are closest to the original direction of movement (as
explained in Fig. 3).

In [1] it was shown that the sensitivity of the animal to external cues is
maximal when it is moving through a bifurcation, thereby enhancing its ability
to pick up small biases and more accurately navigate towards the most
beneficial target. This property that our model predicts makes the
organization of the bifurcations along the trajectories crucially important -
beyond determining the overall shape of the trajectories, these also define
points in space-time near which we expect the brain can amplify discrimination
among options based on even very small differences in their perceived quality.

When comparing the theoretical trajectories to the experiments [1], it was
found that the spins have modified interactions that can be mapped to a
distortion of the relative angles between targets. Using our MF analysis of
the trajectories, we show how increasing the angular distortion leads to
bifurcations at smaller relative angles between the targets. By spatially
spreading the bifurcations more uniformly the distortion simplifies greatly
the resulting trajectories. In many spatial configurations of three targets,
distortion reduces the number of bifurcations from an infinite number to
three, and in the case of four targets it prevents endless indecision that
appears in the formation of loops. We therefore conclude that the value of the
angular distortion that was found to apply across taxa [1, 10] can be
motivated by allowing animals to move along less complex trajectories,
resolving convoluted paths that appear when there are more numerous targets.
Our results suggest that nature seems to have chosen this form of
interactions, as they allow animals to perform more efficient foraging,
uniformly exploring arrays of identical targets.

These results highlight the richness of this spin model, where movement
through space is determined by spin-spin interactions, which are in turn
dependent on the position (of the animal or flock) with respect to the
targets. It forms the first step towards further theoretical analysis of this
model under more realistic conditions, such as in the presence of bias between
the targets.

##  VII Acknowledgments

N.S.G. is the incumbent of the Lee and William Abramowitz Professorial Chair
of Biophysics. This research is made possible in part by the historic
generosity of the Harold Perlman Family. D.G. and I.D.C. acknowledge support
from the Office of Naval Research Grant N0001419-1-2556, Germany’s Excellence
Strategy-EXC 2117-422037984 (to I.D.C.) and the Max Planck Society, as well as
the European Union’s Horizon 2020 research and innovation programme under the
Marie Skłodowska-Curie Grant agreement (to I.D.C.; #860949).

*

##  Appendix A Appendix

##  Appendix B The association of an instability (bifurcation) with the
existence of at least two stable solutions

Proposition 1 There is an unstable solution to the model equations at a point
$\vec{r}_{b}$, if and only if there are at least two stable solutions at this
point.

This proposition gives us an alternative definition for the bifurcation point
as a point where there exist at least two stable solutions. It is easy to see
why it is true if we look at the expression for the effective free energy of
the spins (Eq. 11), as a function of $\pm\mid\vec{V}\mid$ (one dimensional
projection). For large values of $\mid\vec{V}\mid$ the free energy diverges

$\lim_{\pm\mid\vec{V}\mid\rightarrow\infty}F(\vec{V},T)=\infty.$ (A.1)

An unstable point at $\vec{r}_{b}$ corresponds to a local maximum of
$F(\vec{V},T)$ at $\vec{V}(\vec{r}_{b})$. Together with Eq. (A.1) (and Rolle’s
lemma) we conclude that there should exist at least two minima for the
function $F(\vec{V},T)$, that correspond to stable solutions of the model
equations. If we start from two stable solutions (minima of $F(\vec{V},T)$)
according to Rolle’s lemma there should be at least one unstable point between
them. $\Box$

Figure 6:  A numerical demonstration of the convergence of the self similar
pattern towards the central target. (A) A magnification of the inset from
Figure 2G. We look at the ratios of consecutive distances of the bifurcation
points from the symmetry axis $y^{bif}_{i+1}/y^{bif}_{i}$ and show in (B) that
the ratio converges to an infinite geometric series with a common ratio of
0.5.

##  Appendix C Alternative way to check stability

We can write the system of equations (7) through its projections on the
directions of the targets $\hat{p}_{i}$ ($i=1,..,k$):

$\frac{dV_{p_{i}}}{dt}=\sum_{j=1}^{k}\frac{\bar{v}\hat{p}_{j}\cdot\hat{p}_{i}}{k\left(1+\exp\left(-\frac{2\,k\,\bar{v}\,V_{p_{j}}}{T}\right)\right)}-V_{p_{i}},$
(A.2)

where $V_{p_{i}}\equiv\vec{V}\cdot\widehat{p}_{i}$.

Let $V^{(0)}_{p_{i}}$ be a solution of equations (A.2) and consider a small
perturbation

$V_{p_{i}}=V^{(0)}_{p_{i}}+\epsilon_{i}.$ (A.3)

Then the equations for the linear perturbations (first order in
$\epsilon_{i}$) are

$\frac{d\epsilon_{i}}{dt}=\sum_{j=1}^{k}T_{ij}\epsilon_{j}$ (A.4)

where

$T_{ij}\equiv\frac{\bar{v}^{2}\hat{p}_{j}\cdot\hat{p}_{i}}{2\,T}\operatorname{sech}^{2}\left(\frac{k\,\bar{v}\,V_{p_{j}}}{T}\right)-\delta_{ij}.$
(A.5)

Then the solution $V^{(0)}_{p_{i}}$ is stable if and only if $T_{ij}$ is
negative-definite. The advantage of this formulation is that it can be
extended to the distorted angle $\tilde{\theta}_{ij}$ with $\nu<1$ (Eqs.
24-25).

###  C.1 Derivation of the effective free energy of the spins

From the two-dimensional Hamiltonian (Eq. 1) we can obtain the effective free
energy in the MF approximation, following the procedure that was used for the
one dimensional Curie-Weiss model (see for example [15], chapter 13), and was
applied to the current Hamiltonian in [11] for the case of two targets. Here
we extend the derivation to $k$ targets. The starting point is the partition
function for the Hamiltonian from Eq. (1), which is

$Z=tr_{\\{\sigma_{i}\\}}Exp\left[\frac{k\,\bar{v}^{2}}{N\,T}\left(\sum_{i=1}^{N}\sigma_{i}\,\widehat{p}_{i}\right)^{2}\right],$
(A.6)

where here $\widehat{p}_{i}\in\\{\widehat{p}_{1},...,\widehat{p}_{k}\\}$ and
we have in the sum an equal number of spins for every target $N/k$ (assuming
$N\gg 1$), while $\bar{v}$ is a constant whose dimension is velocity. Since
the system is two-dimensional, let us introduce two auxiliary fields

$\vec{V}\equiv(V_{x},V_{y})$ (A.7)

and using the Gaussian identity

$e^{\frac{a^{2}+b^{2}}{4\,c}}=\frac{c}{\pi}\int_{-\infty}^{\infty}dV_{x}dV_{y}\,e^{-c\,(V_{x}^{2}+V_{y}^{2})+a\,V_{x}+b\,V_{y}}$
(A.8)

where we take

$\displaystyle a$ $\displaystyle=$
$\displaystyle\frac{2\,k\,\bar{v}}{T}\left(\sum_{i=1}^{N}\sigma_{i}\,\widehat{p}_{i}\right)_{x}$
$\displaystyle b$ $\displaystyle=$
$\displaystyle\frac{2\,k\,\bar{v}}{T}\left(\sum_{i=1}^{N}\sigma_{i}\,\widehat{p}_{i}\right)_{y}$
$\displaystyle c$ $\displaystyle=$ $\displaystyle\frac{N\,k}{T},$ (A.9)

we can write the partition function in a form which is linear in $\sigma_{i}$:

$Z=\frac{N\,k}{\pi\,T}\,tr_{\\{\sigma_{i}\\}}\int_{-\infty}^{\infty}dV_{x}\,dV_{y}\,\exp\left(-\frac{N\,k}{T}\,\vec{V}^{2}+\frac{2\,k\,\bar{v}}{T}\,\vec{V}\cdot\sum_{i=1}^{N}\sigma_{i}\,\widehat{p}_{i}\right).$
(A.10)

Then summing over the possible values of the spins we get

$tr_{\\{\sigma_{i}\\}}\exp\left(\frac{2\,k\,\bar{v}}{T}\,\vec{V}\cdot\sum_{i=1}^{N}\sigma_{i}\,\widehat{p}_{i}\right)=\prod_{i=1}^{N}\sum_{\sigma=0,1}\exp\left(\frac{2\,k\,\bar{v}}{T}\,\vec{V}\cdot\widehat{p}_{i}\,\sigma\right)=\prod_{i=1}^{N}\,e^{\ln\left(1+\exp\left(\frac{2\,k\,\bar{v}}{T}\,\vec{V}\cdot\widehat{p}_{i}\right)\right)}=e^{\frac{N}{k}\sum_{i=1}^{k}\ln\left(1+\exp\left(\frac{2\,k\,\bar{v}}{T}\,\vec{V}\cdot\widehat{p}_{i}\right)\right)},$
(A.11)

when we sum over $N/k$ spins for each target and where the last summation is
not over individual spins but over the unit vectors towards the targets
$\widehat{p}_{i}$ ($i=1,..,k$).

Then we can read the free energy per spin $F(\vec{V},T)$ by comparison to the
general form

$Z\sim\int_{-\infty}^{\infty}dV_{x}\,dV_{y}\,\exp\left(-\frac{N}{T}\,F(\vec{V},T)\right)$
(A.12)

and obtain

$F(\vec{V},T)=k\,\vec{V}^{2}-\frac{T}{k}\sum_{i=1}^{k}\ln\left(1+\exp\left(\frac{2\,k\,\bar{v}}{T}\,\vec{V}\cdot\widehat{p}_{i}\right)\right).$
(A.13)

##  Appendix D Trajectory equations for three targets

For a system at a point $(x_{0},y_{0})$ and three targets at $(x_{i},y_{i})$
$i=1,..,3$, we define the following vectors

$\widehat{p}_{i}=\left(\frac{x_{i}-x_{0}}{\sqrt{(x_{i}-x_{0})^{2}}+(y_{i}-y_{0})^{2}},\frac{y_{i}-y_{0}}{\sqrt{(x_{i}-x_{0})^{2}}+(y_{i}-y_{0})^{2}}\right),$
(A.14)

and the proportion of “on” spins in each group

$n_{i}=\frac{1}{3\left(1+\exp\left(-\frac{6\,\bar{v}\,V_{p_{i}}}{T}\right)\right)},$
(A.15)

where $V_{p_{i}}\equiv\vec{V}\cdot\widehat{p}_{i}$.

Then we obtain the following set of equations for $V_{pi}$ (by taking
projections of Eq. (2) and the definitions in Eq.(25):

$\displaystyle V_{p1}$ $\displaystyle=$
$\displaystyle\bar{v}\left(n_{1}+n_{2}\cos\tilde{\theta}_{12}+n_{3}\cos\tilde{\theta}_{13}\right)$
(A.16) $\displaystyle V_{p2}$ $\displaystyle=$
$\displaystyle\bar{v}\left(n_{1}\cos\tilde{\theta}_{12}+n_{2}+n_{3}\cos\tilde{\theta}_{23}\right)$
(A.17) $\displaystyle V_{p3}$ $\displaystyle=$
$\displaystyle\bar{v}\left(n_{1}\cos\tilde{\theta}_{13}+n_{2}\cos\tilde{\theta}_{23}+n_{3}\right).$
(A.18)

Let $\hat{t}^{0}$ be the (tangent) velocity unit vector, where $\hat{n}^{0}$
is the perpendicular directiom. Then since

$(\hat{n}^{0}\cdot\hat{p}_{i})^{2}=1-(\hat{t}^{0}\cdot\hat{p}_{i})^{2}$ (A.19)

we get the relation

$(\hat{n}^{0}\cdot\hat{p}_{i})^{2}=1-\frac{V_{pi}^{2}}{\vec{V}^{2}.}$ (A.20)

Solving Eqs. (A.16)-(A.18) for $V_{pi}$ and substituting into Eq. (10) we get
the following criterion for stability:

$A=1-\frac{\bar{v}^{2}}{2\,T}\sum^{3}_{i=1}\operatorname{sech}^{2}\left(\frac{3\,\bar{v}\,V_{pi}}{T}\right)\left(1-\frac{V_{pi}^{2}}{\vec{V}^{2}}\right)>0.$
(A.21)

When this condition is violated along the trajectory, we identify a
bifurcation point.

##  Appendix E MF trajectories at high and low temperatures

We find that the simplest form of the BC appear in the limit $T\rightarrow 0$
(Fig. 7A). In this limit the bifurcation curves are (almost) straight lines
that connect two of the three targets. The reason for the BC approaching
straight lines becomes clear when looking at the phase diagram for movement
along the axis of symmetry for three targets (Fig. 7B). When the system moves
along the axis of symmetry, the bifurcation occurs at the critical angle
$\theta_{crit}\rightarrow\pi$, which corresponds to points along the straight
lines that connect the corresponding targets. When the temperature is
increased the BC acquires curvature and eventually the backwards outgoing
trajectories disappear (Fig. 8). At higher temperature, the “space filling”
pattern shrinks even more (Fig. 9).

Figure 7:  (A) The bifurcation pattern at $T\rightarrow 0$. Here $T=10^{-4}$.
The targets are at $(4,12)$,$(4,-12)$ and $(20,0)$. Bifurcation depth is 8.
The green point is the first bifurcation point and the only one with two
outgoing trajectories (binary). The brown points are bifurcation points with
three outgoing trajectories and the red points are with five. The bifurcation
points accumulate along bifurcation curves that in the limit $T\rightarrow 0$
are straight lines that connect the targets. (B) The full phase diagram for
three targets includes another phase transition at large angles that could
correspond to a movement backwards in an opposite direction to the original
one. It shows that the critical angle between the left and right targets is
$\Pi$ for $T=0$, which corresponds to the bifurcation curve that connects
those targets in A which is a straight line.  Figure 8:  The second
bifurcation at low values of the temperature $T$. The targets and the colors
of the bifurcation points are like in Fig. 7A. The dashed brown line is the
bifurcation curve that connects the left and right targets. In all the cases
we see the first bifurcation (with two outgoing trajectories) and the second
one (with three outgoing). (A)$T=3\cdot 10^{-3}$. (B)$T=3\cdot 10^{-2}$.
(C)$T=0.12$. As the temperature is increased, the bifurcation curve moves to
the right according to the phase diagram in 7B. As a result, the outgoing
trajectory backwards (from the second bifurcation point) becomes shorter and
at high enough temperature, the second bifurcation remains with only two
outgoing trajectories. This is the case in all the previous examples with
$T=0.2$.  Figure 9:  The pattern of the trajectories for higher values of the
temperature $T$. The targets are at $(4,12)$,$(4,-12)$ and $(20,0)$.
Bifurcation depth is 12. As the temperature is increased, the bifurcations
backwards move more to the right according to the phase diagram 7B, and the
area of the “space filling trajectory” shrinks. (A) $T=0.2$. (B) $T=0.3$. (C)
$T=0.4$. (D) $T=0.5$.

##  Appendix F Loops in trajectories for four targets

In order to understand how loops form in trajectories with four targets, let
us follow the bifurcation pattern starting from a particular bifurcation point
in Fig. 5E. In Fig. 10A the bifurcation point is denoted by red dot and the
targets by $a,b,c,d$ as seen in Fig. 10. The formation of loops in the case of
four targets is similar to the formation of the self similar structure for
three targets (Fig. 2G). The loop is created as a sequence of bifurcation
points that alternate between a compromise of the two upper targets (a and b)
and a compromise of the two lower targets (c and d). The bifurcation point in
the example of Fig. 10A corresponds to a compromise of a and b. There are two
outgoing trajectories from this point. One of them corresponds to a decision
solution, leading towards target a and terminates there, and one that ends
with a new bifurcation point which goes downward and corresponds to a
compromise between c and d (the short segment). We can see the new bifurcation
point in Fig. 10B. Then, from this point, there are two outgoing trajectories,
one which corresponds again to a compromise of a and b (the short segment
upwards) and a second one that corresponds to a compromise of c and d. This
way a loop is formed (up to a small shift) where in the next step (not shown)
we would have a decision towards d or a compromise of a and b.

Figure 10: The formation of a loop with four targets that are denoted by
(a,b,c,d) according to Fig. 5E. (A) Here we have two outgoing trajectories
from a bifurcation point (the red dot) Decision towards a or a compromise
between c and d (downwards). (B) Here we see the following three bifurcation
points that show a closure of a loop (up to a small shift).

## References

  * [1] Vivek H. Sridhar, Liang Li, Dan Gorbonos, Máté Nagy, Bianca R. Schell, Timothy Sorochkin, Nir S. Gov, and Iain D. Couzin.  The geometry of decision-making in individuals and collectives.  Proceedings of the National Academy of Sciences, 118(50):e2102157118, 2021.
  * [2] Sung Soo Kim, Hervé Rouault, Shaul Druckmann, and Vivek Jayaraman.  Ring attractor dynamics in the drosophila central brain.  Science, 356(6340):849–853, 2017.
  * [3] Johannes D. Seelig and Vivek Jayaraman.  Neural dynamics for landmark orientation and angular path integration.  Nature, 521:1476–4687, 2015.
  * [4] JS Taube, RU Muller, and Jr JB Ranck.  Head-direction cells recorded from the postsubiculum in freely moving rats. ii. effects of environmental manipulations.  Journal of Neuroscience, 10(2):436–447, 1990.
  * [5] Arseny Finkelstein, Dori Derdikman, Alon Rubin, Jakob N Foerster, Liora Las, and Nachum Ulanovsky.  Three-dimensional head-direction coding in the bat brain.  Nature, 517(7533):159–164, 2015.
  * [6] Ayelet Sarel, Arseny Finkelstein, Liora Las, and Nachum Ulanovsky.  Vectorial representation of spatial goals in the hippocampus of bats.  Science, 355(6321):176–180, 2017.
  * [7] Øyvind Arne Høydal, Emilie Ranheim Skytøen, Sebastian Ola Andersson, May-Britt Moser, and Edvard I Moser.  Object-vector coding in the medial entorhinal cortex.  Nature, 568(7752):400–404, 2019.
  * [8] K. Zhang.  Representation of spatial orientation by the intrinsic dynamics of the head-direction cell ensemble: a theory.  Journal of Neuroscience, 16(6):2112–2126, 1996.
  * [9] D. S. Touretzky.  Attractor network models of head direction cells.  In: Head direction cells and the neural mechanisms of spatial orientation. S. Wiener and J. MIT Press, 2005.
  * [10] Lital Oscar, Liang Li, Dan Gorbonos, Iain Couzin, and Nir S Gov.  A simple cognitive model explains movement decisions in zebrafish while following leaders.  Physical Biology, 2023.
  * [11] Itai Pinkoviezky, Iain D. Couzin, and Nir S. Gov.  Collective conflict resolution in groups on the move.  Phys. Rev. E, 97:032304, Mar 2018.
  * [12] Notger G. Müller, Maas Mollenhauer, Alexander Rösler, and Andreas Kleinschmidt.  The attentional field has a mexican hat distribution.  Vision Research, 45(9):1129–1137, 2005.
  * [13] Shapley R Sompolinsky H.  New perspectives on the mechanisms for orientation selectivity.  Curr Opin Neurobiol., 7(4):514–22, 1997.
  * [14] Roy J Glauber.  Time-dependent statistics of the ising model.  Journal of mathematical physics, 4(2):294–307, 1963.
  * [15] Silvio Salinas.  Introduction to Statistical Physics.  Graduate Texts in Contemporary Physics. Springer-Verlag, New York,, 2001\.