The parking problem for . . .

This paper is a step toward understanding the algorithmic concomitants of modeling robots as mobile nite-state machines (FSMs, for short) that travel within square two-dimensional meshes (which abstract the oors of laboratories or factories or warehouses). We study the ability of FSMs to scalably perform a simple path-planning task called parking, within xed square meshes of arbitrary sizes. This task: (1) has each FSM head for its nearest corner of the mesh and (2) has all FSMs within a corner organize into a maximally compact formation (one that minimizes a compactness-measuring potential function). The problem thus requires FSMs to know \where they are" within a mesh, specically which quadrant they reside in. Indeed, quadrant determination is the central technical issue in enabling FSMs to park. Many initial congurations of FSMs can park, including: (a) a single FSM situated initially along an edge of the mesh; (b) any assemblage of FSMs that begins with two designated adjacent FSMs. These congurations can park even without using (digital analogues of) pheromones, an algorithmic aid advocated by some who use FSMs to model ant-inspired robots. In contrast, a single FSM in the interior of (even a one-dimensional) mesh cannot park, even with the help of (volatile digital) pheromones.


Introduction
This paper studies the power of mobile finite-state machines (FSMs, for short) to scalably perform a simple path-planning task called parking, within square two-dimensional meshes of arbitrary sizes.FSMs are viewed as abstractions of simple mobile robots, and the meshes they navigate are viewed as abstractions of bounded regions such as the floors of factories or warehouses or laboratories.The task of parking: (1) has each FSM head for its nearest corner of the mesh and (2) has all FSMs within a corner organize into a maximally compact formation-one that minimizes the average distance of an FSM from its target corner.The Parking Problem thus requires FSMs to discover "where they are" within a mesh, specifically which quadrant they reside in.Indeed, quadrant determination is the central technical issue in enabling FSMs to park.Our results show that many-but not all-initial configurations of FSMs can park successfully within arbitrarily large meshes.Among the configurations that can park are: (i) a single FSM that resides initially along an edge of the mesh; (ii) any assemblage of FSMs that begins with two designated FSMs that are adjacent, i.e., that occupy neighboring tiles of the mesh.The preceding configurations can park even without using (digital analogues of) pheromones, an algorithmic aid advocated by some who study ant-inspired robots; cf.[12,18,30].In contrast, a single FSM that resides initially in the interior of (even a one-dimensional) mesh cannot park, even with the help of (volatile digital) pheromones.The road to these results builds on the basic problem of how/whether an FSM can determine which quadrant of the mesh it resides in.Other lessons from our study indicate that: (a) The limited exploratory/path-planning ability of a single FSM is sometimes much extended if the FSM can use the edges of a mesh for orientation.Indeed, the edges sometimes enable an FSM to appear to count (to n) without actually counting.(b) (Digital) pheromones cannot enhance the power of a single FSM, although they can enable a small FSM (in number of states) to perform a task that would otherwise require an exponentially larger one.Pheromones can enhance the power of a team of FSMs, but we do not need them to enable FSMs to park.

An Informal Summary of the Paper
FSMs on a mesh.We study mobile robotic computers, modeled as FSMs, that function within fixed geographically constrained environments, modeled as square meshes.To emphasize the robotic inspiration, we think of the mesh as a floor that is tesselated with identical square tiles.We expect FSMs to: • navigate the mesh, while avoiding collisions; • communicate with and sense one another, by "direct contact" (as when real ants meet) and by "time-stamped message passing" (as when real ants deposit pheromones); • assemble in desired locations, in desired configurations.
Our study does not require FSMs to avoid obstacles, discover "food" objects, or convey "food" from one location to another (as in, e.g., [12,16,25,26]).Planned sequels to this study will make such demands of FSMs.
The Parking Problem.We study a simple, yet algorithmically nontrivial, pathplanning task, parking, that: (1) has each FSM head to the nearest corner of the mesh and (2) has all FSMs within a corner organize into a maximally compact formation that minimizes the average distance of an FSM from its target corner; cf. the compactness-measuring potential function in Section 2.4.While we have not yet characterized which configurations of FSMs can park successfully, we report on progress toward this goal: • Even without using (digital analogues of) pheromones, many initial configurations of FSMs can park.Examples: (1) a single FSM that starts along an edge of the mesh (Theorem 1); (2) any collection of FSMs containing two distinguished ones that reside initially on adjacent tiles (Theorem 4).
• In contrast: A single FSM can generally not park, even on a 1-dimensional mesh and even with the help of (volatile digital) pheromones (Theorem 1).
Whence the Parking Problem?Our interest in the Parking Problem has two motivations, one automata theoretic and one robotic (cf.Section 2.3).From the automata-theoretic perspective, the Parking Problem is an instance of the question "What can FSMs discover about where they reside within a mesh?"Specifically, the Problem requires FSMs to discover which quadrant they reside in.Along complementary lines, we are currently preparing a companion paper [29] that studies an instance of the question "How well can FSMs discover designated target tiles within meshes?"From the robotic perspective, one finds commercial systems that employ mobile robots within warehouses [16]: the robots collect desired items and convey them to human dispatchers.A video describing this system left me wondering: where do they "store" idle robots?Having robots assemble in mesh corners came to mind as a viable way to keep idle robots "out of the way" until they are needed next.The Parking Problem combines the essence of these two motivations.
2 Technical Background and Related Work

Technical Background
Our formal model of FSM-robots (FSMs, for short) is obtained by augmenting the capabilities of standard finite-state machines (see, e.g., [27] for formal details) with the ability to travel around square meshes of tiles Meshes and their tiles.We index the n 2 tiles of the n × n mesh M n by the set M n 's four quadrants are determined by lines that cross at an anchor tile i, j and are perpendicular to M n 's edges; see Fig. 1(right).M n 's "standard" quadrants-which are anchored at M n 's "center" tile 1 2 (n − 1) , 1 2 (n − 1) , hence are as close to equal in size (i.e., numbers of tiles) as the parity of n allows-comprise the following sets of tiles.
Rounding ensures that each tile of M n resides in a unique quadrant.
A single FSM on M n .At any moment, an FSM F occupies a single tile of M n , sharing that tile with no other FSM.At each step, F can move to any of the (up-to) eight King's-move2 neighbors of its current tile, in any of the eight compass directions: N , N E, E, SE, S, SW , W , N W . (Clerical extensions extend F's move repertoire to include any fixed finite set of atomic moves, each taking F from a tile i, j to a tile of the form i ± a, j ± b .Note that, as F plans its next move, it must consider the label of its current tile-hence must be aware of residing on an edge tile or corner tile (to avoid "falling off").But, being an FSM, F cannot exploit any knowledge of the size-parameter n of the mesh it resides in-except for "finite-state" knowledge such as the parity of n.
Multiple FSMs on M n .A team of FSMs on M n can be activated (from the outside world) simultaneously.Distinct FSMs on M n operate synchronously, i.e., can follow trajectories in lockstep.FSMs that reside on neighboring tiles are aware of each other and can pass messages-such as "i am here."Such simple messages often enable one FSM to act as an "usher" or a "shepherd" for other FSMs.Each FSM's moves on M n are tightly orchestrated.Specifically, an FSM attempts to move in direction: (A repertoire of k atomic moves would require a modulus of k.)This orchestration means that FSMs need never collide!If several FSMs want to enter a tile v from (perforce distinct) neighboring tiles, then one of the FSMs will have permission to enter v before the others-so all FSMs will learn about the conflict before a collision occurs.

Algorithmic Standards and Simplifications
Algorithms are finite-state.Each is specified by a single finite-state program which all robots execute in SPMD3 mode.Such programs, as described in [27] and employed in "finite-state" programming systems such as CARPET [32], have the form with statement labels playing the role of states.Note in particular that all FSMs are identical; none has a "name" that renders it unique.Algorithms are scalable: They work on meshes of arbitrary sizes.In particular, an FSM F cannot exploit information about the size of a mesh M n , treating its side-length n as an unknown.F can, however, learn "finite-state" properties of n, such as its parity.
Algorithms are decentralized but synchronous.Once started, FSMs operate autonomously, but their independent clocks tick at the same rate-so that distinct FSMs can follow trajectories in lockstep.This assumption is no less realistic than the analogous assumption with synchronous-start human endeavors such as military maneuvers.
We specify algorithms in English, trying to tailor the amount of detail to the complexity of the specification.Our goal is to make it clear how to craft a realizing finite-state program.Perhaps the feature of finite-state programs that we exploit the most is their sequential composability.

Related Work
Our study combines concepts and tools from a number of complementary bodies of literature that span several decades.The literature on automata theory and its applications contains studies exemplified by [3,5,7,10,23] that focus on the (in)ability of FSMs to explore graphs with goals such as finding "entrance"to-"exit" paths or exhaustively visiting all nodes or all edges.Other studies, exemplified by [14,17,20,22,31], focus on algorithms that enable FSMs that populate the cells of (possibly multidimensional) meshes to tightly synchronize; such arrays of FSMs are, of course, cellular automata, a model dating back a half century [33], yet still of interest today [13,32,34,35].The robotics literature contains numerous studies-see, e.g., [1,2,12,18,30]-that explore the use of ants as a metaphor for simple robots that collaborate to accomplish complex tasks; the use of "virtual pheromones" within this metaphor is particularly interesting; we briefly studied this topic in [28].(The ant metaphor is discussed in an entertaining way in [15].)Cellular automata appear also within robotic applications of automata-theoretic concepts [19,25,26].Notably, the robotic branch of this literature does not consist just of theoretical studies of the model, containing also application-and implementation-oriented studies [6,12,16,30,32].The current study melds the goals of the automata-theoretic and robotic studies by studying FSMs that traverse two-dimensional meshes, with goals more closely motivated by robotics than automata theory.The closest relative to our study is [29], which studies the (in)ability of FSMs to find, for arbitrary fixed rationals 0 < ϕ, ψ < 1, the tile ϕ(n − 1) , ψ(n − 1) in arbitrary meshes M n .This simple, yet significant, problem for mobile robots complements the question underlying the Parking Problem-"What can FSMs discover about where they reside within a mesh?"-with the question "Can FSMs discover designated target tiles within meshes?"The results in [29] parallel those here: a single FSM has quite limited path-planning/exploration ability, while teams of two or more FSMs have such ability to a significantly greater extent.

The Parking Problem for FSMs
To simplify exposition, we restrict attention to the Parking Problem for M n 's northwest quadrant Q N W ; clerical changes accommodate the other quadrants.To be formal, the kth diagonal of Q N W is the following set of tiles of M n : (1) We then have: A configuration of FSMs solves the Parking Problem for Q N W if and only if it minimizes the parking potential function This simple, yet algorithmically nontrivial, path-planning problem lends significant insights into what FSMs can determine about meshes without counting.
We present three results that enhance our understanding of FSMs as models for mobile robots.The first result exposes the fact that single FSMs cannot park successfully within large meshes (Section 3.1).The second two results shed light on the use of (digital) pheromones to the FSM model, as suggested in, e.g., [12,18,30] (Sections 3.2 and 3.3).

A Single FSM Cannot Park
Theorem 1 No FSM can successfully park when started on an arbitrary tile of (even the one-dimensional version of ) arbitrarily large meshes.
The proof of the theorem formalizes the insight that a single FSM "gets lost" in the interior of any sufficiently large mesh M n , hence cannot determine which quadrant of M n it resides in.This insight adds to the list of the limitations of FSMs as they strive to explore unbounded domains; cf.[23].We define the "interior" of M n as follows.For any rational α in the range 1/n < α < 1/2, the α-interior of M n is the submesh with corners at tiles α . We say that an α-interior of M n is landlocked for a q-state FSM F if q < α(n − 1).We define the term "get lost" implicitly, via the coming argument, because its exact definition depends on the path-planning problem that the FSM is trying to solve.The reader should understand the term from the argument.
Let F be a q-state FSM that is trying to navigate within M n from a designated Start Tile to a designated Halt Tile, where at least one of these tiles is landlocked for F. Say for definiteness that the Start Tile is landlocked, because this is the problematic situation for the parking problem;4 a symmetric argument will handle the case of a landlocked Halt Tile.Let us examine the tiles that F visits during the first q + 1 steps of its journey from the Start Tile to the Halt Tile, noting that it may visit some of these more than once.We label each of these q + 1 steps with the name of the state that F was in at that step.We thereby associate these steps with a sequence of q +1 state names: s 0 , s 1 , . . ., s q .By the Pigeonhole Principle, at least two of the names, say s a and s b , must be identical: say s a = s b = s, as in Fig. 2(middle).Because F is an FSM, being in a particular state at a given step of its journey embodies F's only memory of anything that happened before that step.Therefore, each time F arrives at some tile in state s, it cannot determine if this is the first time that it entered state s during the journey or the second time or . . . .In particular, if we move F's Start Tile closer to M n 's boundary (as in Fig. 2(left)) or farther from M n 's boundary (as in Fig. 2(right)), F cannot distinguish among the three situations in Fig. 2 as it embarks on the dashed portion of its journey.Note that we can force the extended trajectory of Fig. 2 integer 3 here reflects the three occurrences of state s in Fig. 2(right); a subsequent extension would require that F's Start Tile be at least distance 4q from M n 's border; and so on.)The claimed repetition must occur because the inputs to F's state-transitions are the same between successive encounters with state s: F is the only FSM, it does not employ pheromones, and it never goes near an edge of M n , so it receives identical stimuli after each occurrence of state s.Summing up informally, but in a way that is easily formalized, if we start F sufficiently far from any edge of M n , then it will not be able to determine its relative distances from M n 's edges or corners.This insight allows us finally to prove Theorem 1. Proof of Theorem 1 By the preceding argument: For any FSM F, for all sufficiently large meshes M n , repeated extensions of F's trajectory from its Start Tile can change which corner of M n is F's target parking corner, in a way that F cannot recognize.The reader can easily adapt this argument to a one-dimensional mesh M n in which F must find the closer end.

Augmenting the Model with Virtual Pheromones
Several sources in the robotics literature-see, e.g., [12,18,30]-advocate emdowing robots with virtual pheromones, a digital realization of real ants' volatile organic compounds.We can accomplish this by endowing each tile of M n with a fixed number c of counters, where each counter can hold an integer in the range [0, I ]; each such integer is an intensity level of pheromone .The number c and the ranges [0, I j ] c j=1 are characteristics of a specific instance of the model.The volatility of real pheromones is modeled by a schedule of decrements of every pheromone counter, say one unit per step; see Fig. 3. Every computation begins with all tiles having level 0 of every pheromone.
None of our positive results ("Such and such a configurations of FSMs can park.")needs virtual pheromones, and none of our negative results ("Such and such a configurations of FSMs cannot park.") is helped by virtual pheromones.That said, for completeness, we now hint at the impact of virtual pheromones on our model.In short, pheromones-as modeled above-do not enhance the capabilities of single FSMs, but they sometimes enable small FSMs to function as much (in fact exponentially) larger pheromone-less ones.We establish the first claim here and the second in Section 3.3.
Theorem 2 Given any FSM F that employs (virtual) pheromones while navigating M n , there exists an FSM F that follows the same trajectory as F while not using pheromones.
Proof: We can focus on an FSM F that uses just one type of pheromone because we eliminate a single type at a time.Say that F's single pheromone has intensity levels in the set [0, I].We design a pheromone-less FSM F with exponentially (in I) more states than F that emulates F step by step.F "carries around" (in finite-state memory) a map that specifies all relevant information about the tiles of M n that contain nonzero intensities of F's pheromone-the tiles' relative locations and the intensities of the pheromone.For F to exist, the pheromone map must be: (a) "small"-with size independent of n-and (b) easily updated as F emulates successive steps by F. Map size.The portion of M n that could contain nonzero levels of the pheromone is no larger than the "radius"-I submesh of M n that F has visited during the most recent I steps.No trace of pheromone can persist outside this region because of volatility.Thus, the map needs only be a (2I − 1) × (2I − 1) mesh centered at F's current tile.Because F is the only FSM on M n , at most one tile of the map contains the integer I (a current maximum level of the pheromone), at most one contains the integer I − 1 (a maximum level one step ago), . . ., at most one contains the integer 1 (a maximum level I − 1 steps ago).Fig. 3 displays a sample map, with four sample one-step updates.
Updating the map.Because of a map's restricted size and contents, there are fewer than 1 + I−1 j=0 ((2I − 1) 2 − j) distinct maps (even ignoring the necessary adjacency of tiles that contain the integers k and k − 1).F can, therefore, carry the set of all possible maps in its finite-state memory, with the thencurrent map clearly "tagged."Thus, F has finitely many states as long as F does.F 's state-transition function augments F's by updating each state's map-component while emulating F's state change.
Theorem 2 strengthens Theorem 1 to include FSMs that employ pheromones.

Pheromones Can Enable Exponentially Smaller FSMs
The pheromone-less FSM F in our proof of Theorem 2 has a number of states q that is exponentially larger (in the number of intensity levels I) than the number of states q of the pheromone-using FSM F that F replaces; specifically, q is roughly I O(I) q.It is natural to wonder if this exponential blowup in FSM-size is necessary.We use the Not-So-Close Neighbor Problem to show that the exponential blowup is close to necessary in the worst case.This problem, specialized to the mesh M n and the integer k with 0 < k < log 2 n, is denoted NSCN n,k and is specified as follows (using "south" for definiteness only).
The NSCN n,k Problem: Have FSM F move 2 k tiles south of its starting tile i, j , to tile i + 2 k , j .
Theorem 3 Focus on a mesh M n and an integer k with 0 < k < log 2 n.
1.No pheromone-less FSM with fewer than 2 k states can solve the NSCN n,k Problem within arbitrary meshes M n .
2. The NSCN n,k problem is always solvable in 2 k steps by a pheromone-less single FSM that has 2 k + 1 states.
3. The NSCN n,k Problem is always solvable in O(k2 k ) steps by a single FSM that has O(k) states and that employs a single type of pheromone with 6k + 1 intensity levels.
Proof: 1.This follows directly from the argument in Section 3.1.If an FSM F having q < 2 k + 1 states is started at a tile i, j that is landlocked for F, then F will enter the same state (at least) twice during the first q + 1 steps of its journey from i, j to i + 2 k , j .Moving F's start tile via either a compression or extension (cf.Fig. 2) will cause F to end up at a tile other than i + 2 k , j .
3. We design an O(k)-state FSM F k that solves the NSCN n,k Problem.In broad outline, F k uses its phermomone to simulate a k-bit counter that it "carries along" as it makes its way from the interior tile i, j to i + 2 k , j .We assume for definiteness that n − i ≥ k (which creates "westward" room for the counter); clerical changes accommodate the case n − i < k by using "eastward" room.Designing the counter.F k employs a pheromone with 6k + 1 levels of intensity.It uses levels 1, . . ., 3k to represent bit 0 and levels 3k + 1, . . ., 6k to represent bit 1; as usual, level 0 indicates the absence of the pheromone.(The redundant representation compensates for pheromones' volatility.)For each integer h ∈ [0, 2 k − 1] and each tile i + h, j along the southward path in turn, F k forms an encoding (using pheromone intensity levels) of the length-k binary numeral for integer h, using the tiles i + h, j − (k − 1) . . ., i + h, j to store (encodings of) the numeral's successive bits: i + h, j will contain the hth counter's low-order bit and i + h, j − k + 1 of that counter's high-order bit.F k uses enough levels of pheromone intensity for encoding so that each bit of each counter will survive long enough for F k to progress to the next tile to the south and propagate and increment the hth counter to the (h + 1)th.When F k eventually generates the numeral 11 • • • 1 for the integer 2 k − 1 on its moving counter, it knows that the next tile to the south is the target tile i + 2 k , j .Because F k uses pheromone levels to represent bits and because it must explicitly traverse the k tiles that encode each numeral and because the pheromone is volatile, F k employs multiple levels of the pheromone to encode the bits 0 and 1, as mentioned earlier.
We now derive a viable encoding-and, thereby, a viable upper bound on the number of levels of intensity for the pheromone-by presenting an explicit algorithm for F k and analyzing how long the representation of a bit must persist in order for F k to count from 0 to 2 k − 1 using length-k numerals.We use the following notation.For β ∈ {0, 1}: • "(β)" ambiguously denotes any encoding of bit β using pheromone levels; under our scheme, (0) ∈ {1, . . ., 3k}, and (1) ∈ {3k + 1, . . ., 6k}; • "[β]" denotes the encoding of bit β via a maximum level of pheromone; thus, [0] represents level 3k of the pheromone, and [1] represents level 6k.
F k initializes the counter.F k begins its counter-constructing journey along the southward path (3) by initializing the counter to the numeral 00 • • • 0. This consists of traversing the following length-k westward path from i, j Initialize counter 0 to 00 depositing dose [0] of the pheromone at each tile.A potential finite-state subprogram for F k appears in Fig. 4; the right arrow identifies the initial states of each of the sub-FSMs that jointly comprise F k .Having initialized the counter, F k returns to tile i, j via the eastward path Return and check counter h for 11 The initial instantiation of this check-and-return path has h = 0; subsequent instantiations will have, in turn, h = 1, 2, . . ., k − 1.During these eastward paths, F k tests whether the current value of the counter encodes the integer  F k propagates and increments the counter.Assume inductively that F k is on tile i + h, j , where h ∈ [0, 2 k − 1], and that tiles i + h, j , . . ., i + h, j − k + 1 contain pheromone levels that encode integer h.F k initiates a sawtooth traversal of the following form, during which it deposits at row h + 1 pheromone levels that encode integer h + 1.
it-so that it can distinguish 1 from 0. Focusing on a specific but arbitrary tile r, s , in the worst case, F k : 1. first deposits the pheromone on tile r, s while copying the numeral from the preceding row, row r − 1; 2. takes 3 steps per bit to copy the k bits in tiles to the right of r, s into the current row, row r; 3. returns to row r in preparation for copying this row upward to row r + 1; 4. takes 3 steps per bit to copy the < k bits in tiles to the right of r, s to the next row, row r + 1.
This process thus takes 3k steps, after which we no longer care if the pheromone is still detectable on tile r, s .Thus, using a pheromone that has 6k nonzero intensity levels-3k to represent 0 and 3k to represent 1-ensures that F k can always solve the NSCN n,k Problem.

Home-Quadrant Determination
The Parking Problem can fruitfully be partitioned into two subproblems: Home-Quadrant determination.Each FSM determines its home quadrant (i.e., the one it starts in) and, thereby, its parking corner in M n .
Parking within the home quadrant.FSMs that share a home quadrant-hence, a parking corner-assemble in a configuration that minimizes the parking potential function (2).The Home-Quadrant Determination Problem is significant independent of its use in solving the Parking Problem, as an instance of the fundamental question "What can FSMs discover about where they reside within a mesh?"Therefore, we devote this section to studying initial configurations of FSMs that allow each FSM to determine its home quadrant.We show in Section 5 how such configurations of FSMs can always park in every mesh.We cannot yet characterize the configurations that allow home-quadrant determination, but we can identify two simply described ones.
1.The initial assemblage of FSMs includes one designated FSM that resides on an edge or at a corner of M n .
2. The initial assemblage of FSMs includes two designated FSMs that are adjacent, i.e., reside on tiles that share an edge or a corner.The proof of Theorem 4 occupies the following subsections.We focus first on how a single FSM on a mesh-edge can determine its home quadrant (Section 4.1), then on how two initially adjacent FSMs can determine their home quadrants (Section 4.2).We show finally how these knowledgeable FSMs can act as "shepherds" to help an arbitrary collection of FSMs determine their home quadrants (Section 4.3).

A Single FSM on a Mesh-Edge
Lemma 1 One can design an FSM that can determine its home quadrant from any edge-tile of any mesh M n within O(n) steps.
Proof: We design an FSM F that can determine its home quadrant when started on M n 's top edge.An easy modification of F, call it F, will be able to start on any edge of M n .Specifically, F begins by scanning the edge-labels on its start tile (cf.Section 2.1) to determine which edge of M n it is starting on.F uses that information to determine which "rotation" of the following algorithm to use in order to determine its home quadrant.
Say that FSM F starts on M n 's top edge, at an arbitrary tile 0, k , so that F's target parking tile is either 0, 0 or 0, n − 1 .To decide between these alternatives, F begins a 60 • southeasterly walk from 0, k , i.e., a walk consisting of the following "Knight's-move supersteps": two-step moves of the form SE-then-S. (It simplifies our analysis to consider the numerical form of these moves, (+1, +1)-then-(+1, 0).Consider a superstep that starts with F on tile i, j of M n .(Recall that we know the coordinates of the tile; F does not.)if i, j is an edge tile or a corner tile of the mesh then F's walk terminates else F moves SE to tile i + 1, j + 1 if i + 1, j + 1 is a bottom tile then F's walk terminates else F moves S to tile i + 2, j + 1 F's walk, which is depicted schematically in Fig. 7, terminates when F encoun-OR 00 11 00 11 00000000000000000 00000000000000000 00000000000000000 00000000000000000 00000000000000000 00000000000000000 00000000000000000 00000000000000000 00000000000000000 00000000000000000 00000000000000000 00000000000000000 00000000000000000 00000000000000000 00000000000000000 ters M n 's bottom edge or right edge or SE corner.We claim that the endpoint of the walk identifies F's target parking tile.To see this, note that F's walk terminates in a tile v = a, b .There are two possibilities: F is prevented (by an edge or corner of M n ) from: 1. taking the second (southward) step of its sth superstep.This means that F has completed one more SE move than S move, so we have [a = 2s − 1] and [b = k + s] , and we must also have [a = n − 1] and [b ≤ n − 1] (whence the interruption).Combining these inequalities, we have k < 1 2 (n − 1), which means that F's target parking tile is 0, 0 ; 2. taking the first (southeasterly) step of its (s + 1)th superstep.This means that F has completed the same number of SE and S moves, so we have [a = 2s] and [b = k + s] , and we must also have [a = n − 1] or [b = n − 1] (whence the interruption).Combining these inequalities, we have k ≥ 1 2 (n − 1), which means that F's target parking tile is 0, n − 1 .This analysis verifies that the program in Fig. 8   The algorithm of Section 4.1 can be adapted to allow two initially adjacent FSMs to determine their home quadrants.The adaptation leads to the following four-phase algorithm, which is illustrated in Fig. 9.
Phase 1. FSM #1 distinguishes east from west.Say, for definiteness, that the two FSMs are horizontally adjacent, with F 1 to the right of F 2 .This assumption loses no generality, because the FSMs can remember their actual initial configuration (in finite-state memory), then move into the left-right configuration, and finally compute the adjustments necessary to accommodate their actual configurations.(1,2) #1 discovers that it is a "westerner"; (3,4) FSM #1 discovers that it is a "northerner."F 2 stays immobile while F 1 proceeds to the top of M n .F 1 thence executes the top-edge algorithm of Section 4.1 to determine whether it is an "easterner" or a "westerner" (Fig. 9.1).F 1 then returns to its home tile by reversing its walk (Fig. 9.2).This reversal is possible because: (a) the first leg of the return walk just reverses the sequence of supersteps that accomplished the outward walk; (b) once F 1 regains the top edge of M n , it travels southward until it encounters F 2 .F 2 thus acts as a "sentry" or "place-holder" for F 1 .Phase 2. FSM #1 distinguishes north from south.F 2 stays immobile while F 1 proceeds to the right edge of M n , F 1 thence executes the right-edge algorithm of Section 4.1 to determine whether it is a "northerner" or a "southerner" (Fig. 9.3).F 1 then returns to its home tile by reversing its walk (Fig. 9.4).Here too, the return is possible by: (a) reversing the sequence of supersteps that accomplished the outward walk; (b) traveling westward from the right edge of M n until it encounters F 2 .Phase 3 (FSM #2 distinguishes east from west) and Phase 4 (FSM #2 distinguishes north from south) have F 1 act as a "sentry" for F 2 while the latter executes analogues of Phases 1 and 2. Note.Two FSMs that have a pheromone with I ≥ 2k levels of intensity can determine their home quadrants when started within k tiles of one another.

Knowledgeable FSMs Act as Shepherds
We have m ≥ 2 FSMs, F 1 , . . ., F m .As the FSMs execute the algorithms of this section, some may block the intended paths of others.We resolve such conflicts by having the involved FSMs switch roles-which is possible because all FSMs are identical.If FSM F is blocking FSM F , then F "becomes" F and continues the latter's blocked trajectory; simultaneously, F "becomes" F and continues its trajectory.

One knowledgeable shepherd
Say that FSM F 1 knows its home quadrant (possibly, but not necessarily from executing the algorithm of Section 4.1).F 1 helps other FSMs determine their home quadrants by performing a snaked row-by-row sweep of M n -say for definiteness from tile 0, 0 .

Finish
As F 1 encounters each F i where i ∈ [2, m], it acts as a sentry, in the spirit of the 2-FSM algorithm of Section 4.2, thereby allowing F i to determine its home quadrant.Once F i returns to its original tile, it starts toward its target parking corner-by joining the final parking process of Section 5-and F 1 resumes its shepherding sweep of M n .
The described process takes O(n 3 ) steps.F 1 's sweep of M n takes O(n 2 ) moves.Whenever F 1 encounters another F i , the FSMs collaborate in an O(n)-step algorithm that enables F i to determine its home quadrant.

Two knowledgeable shepherds
Say that FSMs F 1 and F 2 know their home quadrants (possibly, but not necessarily from executing the algorithm of Section 4.2).The following multi-phase O(n 2 )-step algorithm has F 1 and F 2 help all other FSMs determine their home quadrants.Note.The following algorithm is designed for a single pair of shepherds.It is not clear if enlisting a larger team of shepherds or enlisting multiple teams would lead to a faster algorithm.
Phase 1. F 1 and F 2 distinguish east from west.F 1 and F 2 head to M n 's NW corner (tile 0, 0 ).Then: 1. F 2 moves one tile eastward per time-step until it reaches M n 's right edge.It then reverses direction and begins to move one tile westward per time-step.2. F 1 starts one step later than F 2 and moves one tile eastward at every third time-step.3. F 1 and F 2 terminate their walks when they are in adjacent tiles.
Phase 2. F 1 and F 2 identify easterners and westerners.F 1 sweeps column-wise through the western half of M n , from column 1 2 (n − 1) − 1 through column 0, informing each encountered FSM that it is a westerner, i.e., resides in either Q N W or Q SW .Simultaneously, F 2 does the symmetric task in the eastern half of M n , from column 1 2 (n − 1) through column n − 1, informing each encountered FSM that it is an easterner, i.e., in either Q N E or Q SE .After completing their sweeps, F 1 and F 2 rendezvous at tile 0, 0 .Phase 3. F 1 and F 2 distinguish north from south, via a process analogous to that of Phase 1. Phase 4. F 1 and F 2 identify northerners and southerners, via a process analogous to that of Phase 2.
By the end of Phase 4, every FSM knows its home quadrant.
Phase 5. FSMs park.Every FSM except for F 1 and F 2 begins to park as soon as it determines its home quadrant.F 1 and F 2 wait to park until the end of Phase 4, when their shepherding duties are done.All FSMs join the algorithm of Section 5 as they park.

Completing the Parking Process
We describe finally how FSMs that know their home quadrants travel to their parking corner and arrange themselves within that corner into a configuration that minimizes the parking potential function (2).We focus just on corner SW of M n , hence on FSMs that resided initially in Q SW ; clerical changes adapt this procedure to the other corners.
Phase 1. FSMs travel to parking corners.Each FSM F follows a two-stage trajectory to its parking corner.For Q SW , the trajectory proceeds westward to the left edge of M n .Having achieved that edge, F proceeds southward toward its parking corner.An FSM that is proceeding horizontally: (a) moves only to an empty tile; if none exists, then it waits; (b) yields to an FSM that is already proceeding vertically.
Phase 2. FSMs organize within their corner.We depict this process schematically in Fig. 10.The first FSM that reaches its parking corner (it may have started there) becomes an usher.It directs vertically-arriving FSMs into the next adjacent diagonal (say that this is diagonal5 ∆ k ).Thus-directed FSMs proceed "down" this diagonal-i.e., in the northwest-to-southeast sense; if they encounter the bottom edge of M n , then they continue "up" the next higherindex diagonal (∆ k+1 in our example)-i.e., in the southeast-to-northwest sense.An FSM in a diagonal moves only when some other FSM "behind" it wants them to move.When an FSM that is moving "up" a diagonal regains the left edge of M n , it "defrocks" the current usher and becomes an usher itself (via a message relayed by its lower neighbor).Corner SW of M n thus gets filled in compactly, two diagonals at a time, i.e., into a configuration that minimizes the parking potential function (2).
This completes the parking algorithm and the proof of Theorem 4.

Conclusions
We have reported progress in understanding the algorithmic strengths and weaknesses of finite-state robots (FSMs) within square meshes of arbitrary sizes.Our vehicle has been the simple path-planning problem we call parking, that has FSMs configure themselves into maximally compact configurations within their nearest corners of the mesh.The Parking Problem is a reasonable subject of study in terms of both the algorithmic and robotic inspirations for our work.
From the former perspective, Parking is a tractable instance of the question "What can FSMs discover about where they reside within a mesh?"From the latter perspective, Parking might be a useful capability to achieve efficiently in some of the application domains for mobile robots, e.g., warehouses and factories; cf.[16].Our main results: (a) illustrate how to formalize the intuition that FSMs "get lost" in the interiors of large meshes (Section 3.1); (b) demonstrate that FSMs can sometimes exploit mesh edges to accomplish tasks that seem to require unbounded counting-which FSMs of course cannot do (Section 4.1); (c) demonstrate that teams of FSMs can sometimes collaborate to accomplish rather sophisticated path planning (Section 4.2); (d) provide perspective on the benefits of digital analogues of pheromones for FSMs, an algorithmic tool advocated in [12,18,30] (Sections 3.2, 3.3).The algorithms that establish our positive results adapt with only clerical changes to rectangular meshes with fixed non-unit aspect ratios.We mention "for the record" that if algorithmic efficiency is not a concern, then any collection of FSMs that contains at least four initially adjacent ones can perform a vast array of path-planning computations (and others as well) by simulating an autonomous (i.e., input-less) 2-counter Register Machine whose registers have capacity O(n 2 ); cf.[27].
Where do we go from here?Most obviously, we want to solve the Parking Problem definitively, by characterizing which initial configurations enable parking and which do not.Another major direction for future work is to build on the initial results of [29] to better understand FSMs within the context of the question "How well can FSMs discover designated target tiles within meshes?"-a question that complements the focus of the current study-"What can FSMs discover about where they reside within a mesh?"Within the context of both motivating questions, it would be valuable to understand how FSMs can cope with obstacles that impede their progress and to understand the possible benefits of randomizing the behavior of the FSMs.A valuable source of inspiration for understanding these questions are the robotic studies in sources such as [1,8,16,18].Perhaps the most important follow-ons to the current work would go beyond pure path planning and exploration by designing FSMs that can scalably (i.e, in arbitrarily large meshes) find and transport goal objects and avoid obstacles.Sources such as [2,12,16,25,26] consider such issues for related but distinct models.Questions concerning the robustness of collections of FSMs in the face of various kinds of failures and faults can lend further texture to all of the preceding algorithmic questions.

Figure 1 :
Figure 1: (left) The n × n mesh M n ; (right) M n partitioned into the four quadrants determined by anchor tile v.

Figure 3 :
Figure 3: Snapshots of a pheromone of intensity I = 3 changing as FSM F (the dot) moves.All snapshots have F on the center tile; unlabeled tiles have level 0. (a) F has deposited a maximum dose of pheromone on each tile that it has reached via a 2-step SE-SW path; note that the pheromone has begun to "evaporate" on the tiles that F has left.(b) F stands still for one time-step and deposits no pheromone.(c) F moves W and deposits a maximum dose of pheromone.(d) F moves S and deposits a maximum dose of pheromone.(e) F moves E and does not deposit any pheromone.

Figure 5 :
Figure 5: A check-and-return sub-FSM for F k

Theorem 4 (
a) Any collection of FSMs that (initially) contains a designated FSM on an edge of M n can determine their home quadrants in M n within O(n 3 ) synchronous steps.(b) Any collection of FSMs that (initially) contains two designated adjacent FSMs can determine their home quadrants in M n within O(n 2 ) synchronous steps.

Figure 7 :
Figure 7: The two possible forms of F's 60 • southeasterly walk.

Figure 8 :Lemma 2
Figure 8: A single FSM parks from the top edge of M n

Figure 10 :
Figure 10: Three stages in the snaked parking trajectory within Q SW ; X-ed cells contain "ushers."

(current tile) s State s State s State s State s
(right) only if F's Start Tile is "sufficiently far" into M n 's interior, meaning at least distance 3q from M n 's boundary.(The The "cut and splice" operation.The solid path-segments in the middle subfigure represent the actual first q + 1 steps as F leaves its Start Tile.The left and right subfigures indicate alternative path-segments that F cannot distinguish from the actual ones. Figure 4: A counter-initializing sub-FSM of F k 2 k − 1 (via the binary numeral 11 • • • 1).If it does, then F k knows that the next tile to the south of i + h, j is the target tile i + 2 k , j ; in this case, F k just moves to this tile and halts.If the counter does not encode 2 k − 1, then F k proceeds to propagate and increment the counter southward.A potential check-and-return finite-state subprogram for F k appears in Fig.5.Because F k enables F to park from tile 1, k .