A note on a mixed routing and scheduling problem on a grid graph

Abstract We consider a particular case of the Fleet Quickest Routing Problem (FQRP) on a grid graph of m × n nodes that are placed in m levels and n columns. Starting nodes are placed at the first (bottom) level, and nodes of arrival are placed at the mth level. A feasible solution of FQRP consists in n Manhattan paths, one for each vehicle, such that capacity constraints are respected. We establish m*, i.e. the number of levels that ensures the existence of a solution to FQRP in any possible permutation of n destinations. In particular, m* is the minimum number of levels sufficient to solve any instance of FQRP involving n vehicles, when they move in the ways that the literature has until now assumed. Existing algorithms give solutions that require, for some values of n, more levels than m*. For this reason, we provide algorithm CaR, which gives a solution in a graph m* × n, as a minor contribution.


Introduction
In this paper, we study conditions under which the FQRP on a grid graph has a solution. A grid graph is a Manhattan graph of m 9 n nodes: nodes are placed in m levels and n columns. FQRP on a grid graph is a particular multi-commodity flow problem in which we must find the routes n vehicles have to perform from an initial position, at the lowest level, to a final position, at the highest level. Vehicles must respect capacity constraints on the arcs and on the nodes of the grid, i.e. at most one vehicle at a time is allowed to cross an arc or a node. The original FQRP consists in the minimization of the sum of the times necessary to route each vehicle.
In a generic graph, FQRP is an NP-complete problem. It has many applications such as the planning of land transhipment of aircraft in aprons and the building of paths for automated guided vehicles (AGV). It is evident that FQRP is a routing as well as a scheduling problem. Obviously, the specific application field determines both the formulation of the problem and the constraints on the characteristics of the paths. In Ravizza et al (2014) the problem focuses on the land movements of aircraft. It is formulated for a directed graph in which arcs represent taxiways. The aim is to minimize the overall route time, avoiding conflicts and satisfying planned take-off times on various runways.
Many authors, even though slightly modifying the hypothesis, have found solutions to the problem, using mixed integer linear programming (Roling and Visser, 2008;Gupta et al, 2009;Clare and Richards, 2011), integer programming (Smeltink and Soomer, 2005) or a linear multi-commodity flow model with side constraints and binary variables. Then, they solved the problem with Branch and Bound or Fix and Relax (Marín and Marin, 2006) techniques. Other authors (Pesic, 2001;Garcia et al, 2005;Balakrishnan and Jung, 2007;Andreatta et al, 2010) suggested various algorithms in order to solve the problem. The particular case of FQRP we are concerned with in this paper was first studied in Andreatta et al (2010) where authors state that an optimal solution to FQRP on grid graphs can be obtained routing each vehicle on a Manhattan path without stopping and avoiding conflicts between vehicles.
Furthermore, they provide a dispatching algorithm (DA) to find such a solution in polynomial time. DA finds optimal solutions in which vehicles perform all their horizontal moves on one and only one level and each level allows horizontal movements in one direction only.
It is important to stress that authors implicitly assume to deal with a graph having a number of levels high enough to allow DA find a solution, rather than define explicitly the number of levels in the instance they consider. Finally, they provide an instance dependent upper bound to number of levels needed by DA to solve an instance of FQRP.
Such a value is K 0 , namely the maximum horizontal distance of a discordant vehicle at time t = 0, i.e. when all vehicles lie on their starting nodes on the first level. A vehicle is discordant either if it has to move horizontally in a direction opposite to the one allowed by the level where the vehicle is or if it has only vertical steps remaining to perform. Thus, K 0 n À 1.
We will consider m Ã DA ¼ n as the instance independent upper bound to the number of levels needed by DA to solve any possible instance of FQRP involving n vehicles. Considering such a value allows including also the case n ¼ 2 which, strictly speaking, needs two levels. In this way, without affecting that much neither the overall results of Andreatta et al (2010) nor this work, more general results are achieved.
The main aim of this paper is to find the number of levels (m*) that ensures the existence of a solution to FQRP in each permutation of n vehicles destination. In this perspective, with respect to a specific permutation of vehicles destination, a number of levels lower than m* could be (necessary and) sufficient.
In particular, as we shall see, m* is the minimum number of levels necessary and sufficient in order to solve any instance FQRP when vehicles perform all their horizontal steps on one and only one level and each level allows horizontal movements in one direction only.
The value of m* is not instance dependent but depends on the length of what we shall call C-type conflict paths that can be found in an instance of the problem composed by n vehicles. Furthermore, we will show that m Ã m Ã DA for values of n [ 1 and that the higher the value of n the higher the number of levels that can be saved with respect to pre-existing solutions.
For this reason, as the second (and minor) aim of the paper, we provide an algorithm (CaR) to find Manhattan paths of each vehicle in a graph m* 9 n.
The paper is structured as follows: in the next section, we recall the main elements of FQRP, while in the second we study all possible conflicts configuration. In the third, we define what a C-type conflict path is, what is its length and some general features of conflict paths.
In the fourth and in the fifth section, we deal with the main aim of the paper. The second aim of the paper is discussed in the sixth section.
In section seven we make a comparison between CaR solution and the solution obtained by executing DA, and finally we report conclusions.

The FQRP problem
The specific FQRP we are concerned with in this paper is related to the movements of n vehicles on an undirected grid graph or Manhattan graph, G ¼ V; E ð Þ. In G, we recognize m levels and n columns. V is the vertex set, while E is the set of the edges. Therefore, we have V j j ¼ mn. In the following, we assume to have a number of vehicles equal to the number of columns.
If the number of vehicles is higher than the number of columns, the problem is not feasible, while if the number of vehicles is lower than the number of columns, there are fewer conflicts between vehicles. In the last case, it is possible to find an optimal solution using CaR and considering just existing vehicles.
The n vehicles start all at time t ¼ 0 from the level 1 and must reach their destination, which is known in advance, in level m. Each edge (both horizontal and vertical) requires one unit of time to be traversed. The objective of FQRP is to minimize the overall time, i.e. the sum of the time n vehicles need to perform the movement.
For the sake of simplicity, we follow the same notations used in Andreatta et al (2010). Thus, vehicles will be numbered from 1 to n and start from level 1. Their destinations correspond to a given permutation r ¼ r 1 ; r 2 ; . . .; r n of the integers from 1 to n. For practical purposes, it may also be useful to take account of the corresponding function i ! r i ð Þ, where r i ð Þ denotes the destination column of vehicle i. Furthermore, we will call node p; q ð Þ the node belonging to level p and column q.
As already stated, all vehicles start at the same time and do not stop until they reach the final destination.
In order to be feasible, the solution must not allow two vehicles to come into conflict, i.e. each arc as well as each node must be crossed by just one vehicle at a time.
The minimum length property of the Manhattan path of vehicle i is equivalent to the statement that, in each step, a vehicle can perform only one out of two movements: a vertical or a horizontal step. The horizontal step is towards the right if r i ð Þ [ i and conversely if r i ð Þ\i: Paths cannot contain steps in opposite directions.
Without loss of generality, we will consider not decomposable problems in what follows. We call 'decomposable in two (or more) disjoint subproblems' problems in which there exists a number k\n such that r 1 ð Þ; r 2 ð Þ; . . .; r k ð Þ is a permutation of the integers 1; 2; . . .; k.
It is quite evident that, in such a case, the vehicles that occupy the positions from 1 to k in the first level must reach a destination in one of the first k columns and may be treated separately from the other vehicles.

Conflicts between vehicles
As we already said, the n vehicles, which have to move on paths in the Manhattan graph (m Â n), start from their initial position, respectively, 1; 2; . . .; n in the first level and go to their respective ending positions, defined by r 1 ð Þ; r 2 ð Þ; . . .; r n ð Þ.
Vehicles start simultaneously and never stop until they reach the final position. Each vehicle must move horizontally or vertically fulfilling capacity constraints on nodes and on arcs.
The number of horizontal steps for vehicle i is r i ð Þ À i j j : As said before, if r i ð Þ [ i, then steps are to the right while if r i ð Þ\i then steps are to the left. A vehicle must perform only vertical steps iff r i ð Þ ¼ i. It is quite natural to partition the set of vehicles in three subsets: Of course, the units of time needed in order to be sure that each vehicle reaches its destination is equal to T, where T is: The last expression allows us to explain why, in some real applications, the value of m is important: such a number affects both T and the existence of a solution. As a consequence, the value of m should be minimum but high enough to guarantee the existence of a solution.
Considering a graph m Ã Â n allows reducing the effort, in terms of time, to route all vehicles to their destinations. For each couple of vehicles i and j, with i\j, starting at time 0 from nodes at the first level, we can have exactly one of the following: 1. i 2 H; j 2 H 2. i 2 H and j must perform at least a horizontal step: 3. j 2 H and i must perform at least a horizontal step: In the first case, both vehicles have only vertical moves: they cannot collide.
In cases 2.a. and 3.a., column i ¼ r i ð Þ is not between columns j and r j ð Þ. It follows that shortest paths of vehicles will never share any node at any time. In cases 2.b., i.e. when i ¼ r i ð Þ is between columns j and r j ð Þ, and 4.a, when i 2 L 1 ; j 2 L 1 , vehicle i reaches its destination before vehicle j and stays in it in the following units of time. Then, a conflict arises only if the path of vehicle j contains the node m; r i ð Þ ð Þ. A very similar conflict arises in cases 3.b. and 4.a., when i 2 R 1 , j 2 R 1 , in which vehicle j reaches its destination before vehicle i and stays in it in the following time units: a conflict occurs only if the path of vehicle i contains the node m; r j ð Þ ð Þ . We will call cases 2.b., 3.b. and 4.a 'type A conflicts' and give the following definition: Definition 1 Node conflicts: type A Two vehicles i and j are subject to an A-type conflict if the following relations hold: Observation 1 The only node where a conflict between i and j may occur is the node m; r j ð Þ ð Þin the first case and the node m; r i ð Þ ð Þ in the second one. Indeed, in both cases there is not a node belonging to a level lower than m that can be reached at the same time by the two vehicles. As a consequence, to avoid the conflict due to the occurrence of an A-type conflict, it is necessary that the destination node of j (or, in the second case, i) does not belong to path of vehicle i (or j).
Observation 2 A-type conflict is the only type of conflict that vehicles of the set H can be involved in.
In cases 4.b., 5.a. and 6, there is no conflict. Indeed, both shortest paths of the two vehicles do not share the same node or arc at the same time. In particular, in case 6, the two vehicles, i and j, never cross the same arc or node, since the Marisa Cenci et al-A note on a mixed routing and scheduling problem on a grid graph left one (i.e. i) goes to the left while the right one (i.e. j) goes to the right. In the remaining cases, i.e. the three 5.b. subcases, i and j have to perform horizontal movements in opposite directions and they can meet halfway. In these cases, they can collide on a node (or an arc) when that node (or that arc) is reachable from the departure nodes i and j after the same number of steps and when both vehicles have to pass through it. Therefore, we define three other types of conflicts, as follows.

Definition 2 Arc conflicts
Two vehicles, i and j, where i\j, i 2 R 1 , j 2 L 1 , are 'subject to an arc conflict' if we contemporarily have: That is to say, if vehicles i and j move horizontally one towards the other on the same level, then they enter in conflict on one of the arcs joining a node of column iþj 2 À 1 with a node of column iþj 2 þ 1. Definition 3 Node conflicts: type B.
We have B-type conflicts when two vehicles, i and j, i\j, must move in opposite direction and the following conditions hold: i\rðiÞ j\rðjÞ i.e. when the horizontal distance between i and j starting nodes is an even number and the destinations of i and j are located, respectively, to the right and to the left of the median node i þ j ð Þ=2.
Observation 3 Any routing rule that allows movements only in one direction at a fixed level makes both arc conflicts and B-type conflicts impossible (and, for this reason, their determination is superfluous).
Definition 4 Node conflicts: type C We have C-type conflicts if two vehicles i and j, with i\j, move in opposite direction at the same level and one of the following relations holds: In such a framework, we define 'vehicle subject to C-type conflict' the vehicle whose destination is a node of the column i þ j ð Þ=2. In order to express this relation between vehicles i and j, we use the notation i j The following proposition holds.
Proposition 1 In order to avoid the collision which could arise from the occurrence of i j ð Þ, when i\j, the first node of column r i ð Þ belonging to the path of vehicle i must be q; r i ð Þ ð Þand the last node of the same column belonging to the path of vehicle j must be p; Proof If we have i and j, with i\j and i j ð Þ; it follows that: and r j ð Þ\r i ð Þ Therefore, column r i ð Þ, which is the one containing the destination node of vehicle i, is equidistant from the columns from which i and j start: We distinguish two cases: • If q p then both vehicles reach the node p; r i ð Þ ð Þat time t ¼ jÀi 2 þ p À 1. In fact, remembering that they are equidistant from column r i ð Þ, if q ¼ p then both vehicles are on the node p; r i ð Þ ð Þat the same time. On the other side, if q\p, then vehicle i reaches column r i ð Þ at time t ¼ jÀi 2 þ q À 1 and it has only vertical steps left. Moving vertically in the following time units, it occupies the nodes from q þ 1; Þand so j cannot avoid to use a node in which vehicle i is still.
• If q [ p, then vehicle j leaves the column r i ð Þ before than the arrival of vehicle i, i.e. at time t ¼ jÀi 2 þ p À 1. In this way, the occurrence of a conflict is avoided ( Figure 2). h Observation 4 In order to discover C-type conflicts, we need O n ð Þ calculations. Indeed, it is sufficient to scan all vehicles and verify what follows: Observation 5 The conflict relation u v ð Þ is asymmetric because when vehicle u is subject to C-type conflict with vehicle v, v cannot be subject to C-type conflict with u. Furthermore, it is univocal because it is impossible to simultaneously have two relations u v ð Þ and u w ð Þ with v 6 ¼ w.
Consequently, we can represent C-type conflicts in an instance FQRP by a directed graph G 0 ¼ N 0 ; A 0 ð Þ in which nodes represent vehicles and the generic arc u; v ð Þ represents the relation u v ð Þ. Conflict graph G 0 is a family of arborescences. Arcs are oriented towards the root: for each node, the outer degree is at most 1 (the inner degree can be higher than 1).

Paths of C-type conflicts
We call C-type conflict path (more simply, conflict path), any sequence of vehicles z 1 ; z 2 ; . . .; z k f gthat generates a number k of C-type conflicts z 1 z 2 ð Þ; z 2 z 3 ð Þ; . . .; z k z kþ1 ð Þ: in short these vehicles constitute the path z 1 ; z 2 ; . . .; z k ð Þ . As a particular case, a conflict path can consist of a single C-type conflict: z 1 z 2 ð Þ: In graph G 0 , the conflict path z 1 ; z 2 ; . . .; z k ð Þcorresponds to a (directed) path from node z 1 to node z k . Based on the previous definitions, it is evident that in a path of conflicts, vehicles z i ; i odd must move in opposite direction with respect to vehicles z j ; jeven.

Definition 5 Length of a path
We define Length of a path the number of vehicles subject to the C-type conflict in a path. In other words, the length of the generic conflict path z 1 z 2 ð Þ; z 2 z 3 ð Þ; . . .; z k z kþ1 ð Þ is k.
Observation 6 Conflict paths allow building a list of priorities that must be respected. Consider a C-conflict path such that relations z 1 z 2 ð Þ; z 2 z 3 ð Þ hold. Proposition 1 allows us to state that both paths of vehicles z 1 and z 2 contain at least a node of column r z 1 ð Þ and that both paths of vehicles z 2 and z 3 contain at least a node of column r z 2 ð Þ. Proposition 1 follows that the first node of column r z 1 ð Þ belonging to the path of z 1 must be located on h z1 [ h 0 z 2 , where h 0 z 2 is the level of the last node of column r z 1 ð Þ belonging to the path of z 2 .
Similarly, the first node of column r z 2 ð Þ belonging to the path of z 2 must be located on a level h z 2 [ h 0 z 3 , where h 0 z 3 is the level of last node of column r z 2 ð Þ belonging to the path of z 3 . Obviously, it is h z2 ! h 0 z 2 . Indeed, column r z 1 ð Þ must be located between z 2 and r z 2 ð Þ. As a consequence, when z 2 reaches the node h 0 z 2 ; r z 1 ð Þ , two are the cases: if z 2 does not perform any vertical steps in the section of its paths from column r z 1 ð Þ to column r z 2 ð Þ, then it must be h z 2 ¼ h 0 z2 . Otherwise, i.e. if z 2 performs one or more vertical steps in such a section, it must be h z 2 ¼ h 0 z2 . Thus, referring to a conflict path whose length is k, called h z i the level of first node of column r z i ð Þ belonging to the path of z i and h 0 z i the level of the last node of column r z iÀ1 ð Þbelonging to the path of z i the following relations hold: These relations represent a list of priorities that must be respected (in order to find a feasible solution to FQRP).
Observation 7 k þ 1 levels are sufficient to route the vehicles belonging to a conflict path whose length is k.
Indeed, these k þ 1 vehicles could be routed using a very simple rule: each vehicle performs all its horizontal steps on one and only one level (opportunely chosen respecting the previously shown list of priorities) and each level allows performing its horizontal steps to one and only one of these vehicles. The result is an 1-1 assignment of vehicles to levels, so that k þ 1 levels are required and sufficient. Note that the spirit of the previous rule is quite similar to the one of the DAs: in both vehicles performs all their horizontal steps on one and only one level and each level allows movement in one direction only. These rules imply that h z i ¼ h 0 zi for each i. Then, we could write the second relation shown in Observation 6 as follows: i.e. if each vehicle performs all its horizontal steps on one and only one level and each level allows movements in one direction only, z kþ1 levels are necessary and sufficient to route all vehicles belonging to a conflict path whose length is k.
Finally, Proposition 2 states a general property of conflict paths.
any other couple of vehicles belonging to the conflict path.
Proof Assume that z i À r z i ð Þ\0 if i is odd and z i À r z i ð Þ [ 0 otherwise. Then it must be: Remembering that in the considered path r z i ð Þ ¼ ziþziþ1 2 , substituting such values in the previous inequalities we obtain: if k is even, and z kþ1 \ Á Á Á \z 5 \z 3 \z 1 and z 2 \z 4 \z 6 \ Á Á Á \z k otherwise.
Since z 1 z 2 ð Þ and z 1 2 R 1 , it must necessarily be z 1 \z 2 . As a consequence, it will be: if k is even, and z kþ1 \ Á Á Á \z 5 \z 3 \z 1 \z 2 \z 4 \z 6 \ Á Á Á \z k if k is odd. Note that z k and z kþ1 are, respectively, the leftmost and rightmost elements in the first case and the rightmost and leftmost elements in the second case. This proves the thesis. To prove the other case, i.e. when z i À r z i ð Þ [ 0 if i is odd and z i À r z i ð Þ\0 otherwise, it is sufficient to repeat the above-mentioned procedure considering that all the inequalities that holds in the previous case are reversed. h Corollary 1 A conflict path whose length is k needs at least z kþ1 À z k j jþ 1 columns to exist.

The relation between the length of the C-conflict path and number of vehicles in the graph
In this section, we establish the relation between the length k of a conflict path and the minimum number of columns (and, consequently, vehicles) needed to guarantee the existence of such a path, i.e. z 1 ðz 2 Þ; z 2 ðz 3 Þ; . . .; z k z kþ1 ð Þ. In other words, with regard to all possible permutations which contain a conflict path whose length is k, we find the number of columns of the permutation composed by the minimum number of vehicles.
Then, to find such a number, which we shall call n min , we solve the following problem: where z kþ1 À z k j jþ 1 is the number of column needed to a conflict path whose length is k to exist (see Corollary 1) and R k ð Þ is the set of all permutations which contain a k length conflict path. Consequently, n min is the value of the objective function in correspondence of an optimal solution.
Proposition 3 allows decomposing objective function of the previous problem in a very useful way.
Proposition 3 Consider a conflict path whose length is k.
Then, the following holds: In the following, without loss of generality, we assume that z i À r z i ð Þ\0 if i is an odd number, while it will be z i À r z i ð Þ[ 0 otherwise. First, we prove the proposition assuming k an odd number.
In this case, z k À z kþ1 j j¼ z kþ1 À z k , and keeping in mind: we can write: Since k is odd, and given that z i 2 R 1 if i is an odd number while it belongs to L 1 otherwise, it must be: As a consequence, all the terms inside round brackets are positive and this proves the thesis.
When k is even, the proof is quite similar. The other case, i.e. when we have z i À r z i ð Þ[ 0 if i is an odd number and z i À r z i ð Þ\0 otherwise, can be proved with analogous considerations. h Observation 8 Proposition 3 shows that z k À z kþ1 j j is a strictly increasing function of both the sum of the distances between destinations of two consecutive vehicles in the conflict path, i.e. P kÀ1 i¼1 r z i ð Þ À r z iþ1 ð Þ j j , and the number of horizontal steps of vehicle z 1 . This leads to two considerations. First, rather than minimizing jz k À z kþ1 j, we can minimize the right-hand side of equation in Proposition 3. Second, to minimize z 1 À r z 1 ð Þ j jis trivial, since the minimum number of horizontal steps of a vehicle is 1 and it is equivalent to state that z 1 À z 2 j j¼ 2. Such a value represents the minimum distance between vehicles that can be involved in a conflict path whose length is 1, i.e. n min ¼ 3; when k ¼ 1. It follows that if z 1 moves towards the right, then z 2 ¼ z 1 þ 2. Otherwise it will be z 1 ¼ z 2 À 2. Note that minimizing such a distance does not affect the minimization of P kÀ1 i¼1 r z i ð Þ À r z iþ1 ð Þ j j .
Once proved that finding n min when k ¼ 1 it is quite trivial, in the following we focus on k ! 2 assuming that z 1 À r z 1 ð Þ j j¼ 1. Then we will proceed as follows: first, we define a new problem which is equivalent to min z kþ1 À z k j jþ1. Second, in Propositions 4 and 5 we describe properties that allow identifying whether a solution of such a new problem is optimal. Proposition 6 shows the existence, for each k, of a solution that has such properties.
In order to get n min , we solve the problem consisting in the determination of k different destinations of vehicles, i.e. r z i ð Þ; i ¼ 1; . . .; k, which do not overlap and minimize the following: For the sake of simplicity, we will use the notation j . In this way, the problem of finding the minimum number of columns that allows a k length conflict path is equivalent to find an 1-1 assignment of k vehicles to k destinations for which is a minimum the quantity: Note that, when k ¼ 2 the problem is trivial, since we must find the min value of D 1 , subject to the constraint of D 1 ! 1, in order to avoid that r z 1 ð Þ ¼ r z 2 ð Þ: consequently, the optimal solution, when k ¼ 2, is D 1 ¼ 1.
Observation 9 In the following propositions, when we make a statement regarding the destinations of the vehicles in a conflict path, we assume given an assignment (obviously without overlapping) of the destinations of vehicles not belonging to the conflict path to the remaining columns.
Proposition 4 In the solution that minimizes (2), the destinations r z i ð Þ; i ¼ 1; . . .; k, of the vehicles involved in a conflict path of length k, must be located in a subset of adjacent columns of the graph.
Proof Assume that in a feasible solution exist two vehicles destinations r z i ð Þ and r z j À Á situated in two non-adjacent columns, i.e. r z i ð Þ ¼ p and r z j À Á ¼ p þ q, with q ! 2 and assume also that columns p þ 1; p þ 2; . . .; p þ q À 1 are not destinations of any one of the vehicles involved in the conflict path.
For the sake of simplicity, we call U ¼ p þ 1; pþ f 2; . . .p þ q À 1g the set of these adjacent columns.
From the assumptions, it follows that it must exist at least an integer h, 1 h k À 1, such that the columns of the set U are located between destinations of two consecutive vehicles r z h ð Þ and r z hþ1 ð Þ: if not, the hypothesis is denied, since all destinations of vehicles would be necessarily on the same side of U. Thus, we can move towards left, of q À 1 steps, all the destinations situated on columns whose index is at least p þ q. Such movement reduces of q À 1 units the distance between two consecutive vehicles that are separated by U and does not affect the other distances between consecutive vehicles belonging to the conflict path. It follows that any solution in which destinations of vehicles belonging to conflict path are not located in a subset of adjacent columns of the graph is not optimal. h Now let us denote with w k ¼ P kÀ1 i¼1 D i and w Ã k ¼ min P kÀ1 i¼1 D i , respectively, the value of (2) in correspondence of a generic feasible solution-not necessarily the optimal one-and its optimal value when the path length is k. Proposition 5 holds.
Proposition 5 For any value of k, the following relation holds: Proof Consider a k-length C-conflict path, i.e. z 1 z 2 ð Þ; z 2 z 3 ð Þ; . . .; z k z kþ1 ð Þ. From Proposition 4, it follows that the destinations of such vehicles will identify a subset of k adjacent columns of the graph. Assuming that z i À r z i ð Þ\ 0 if i is odd, while it will be z i À r z i ð Þ[ 0, a feasible solution of (1) must respect the following inequalities: where the last inequality is r z kÀ1 ð Þ[ r z k ð Þ if k is even and it is r z kÀ1 ð Þ\r z k ð Þ otherwise. Given an optimal solution, i.e. the permutation of k destinations of vehicles belonging to the conflict path that minimizes the (1) considers in it the position of r z k ð Þ: We have two cases: either r z k ð Þ is inner in the permutation, i.e. relation r z i ð Þ\r z k ð Þ\r z j À Á holds, or r z k ð Þ is the extremity of the permutation, i.e. either r z i ð Þ\r z k ð Þ or r z i ð Þ [ r z k ð Þ, i ¼ 1; . . .; k À 1 holds. In every case, if we delete r z k ð Þ from the solution (and we delete also kÀ1 from the objective function) the remaining destinations of the vehicles z 1 ; z 2 ; . . .; z kÀ1 give a feasible solution of the problem related to a path of k À 1 conflicts. Let us consider separately the two cases.
In the first case, r z k ð Þ is inner in the permutation, i.e. relation r z i ð Þ\r z k ð Þ\r z j À Á holds for some z i and z j belonging to the conflict path. Then, the elimination of r z k ð Þ has two effects. The first one is the reduction in the value of (2) in the case the path length is k À 1 of at least one unit. Such a reduction is due to the elimination from the objective function of the addend D kÀ1 .
The second effect is the creation of an empty space between destinations of the remaining k À 1 vehicles. As a consequence, it is possible to fill such a space (see Proposition 4) in order to get adjacent destinations of vehicles belonging to the conflict path with a reduction in the objective function of at least one unit and relation (3) holds.
In the second case, when r z k ð Þ is the extremity of the permutation, as said before, either r z i ð Þ\r z k ð Þ or r z i ð Þ[ r z k ð Þ, i ¼ 1; . . .; k À 1 holds. The first situation is possible only when k is even, while the second one is possible only when k is odd. Assume that r z k ð Þ is the leftmost destination of the permutation, i.e. that k is even. Then, it must be: In order to satisfy the set of inequalities that describe a feasible solution, it must be D kÀ1 ¼ r z k ð Þ À r z kÀ1 ð Þ j j ! 2. Indeed, if D kÀ1 ¼ 1, it would be r z k ð Þ adjacent to r z kÀ1 ð Þ, and the only possible destination r z kÀ2 ð Þ available for vehicle z kÀ2 would be on the left of r z k ð Þ. This would contradict the hypothesis r z i ð Þ[ r z k ð Þ; i ¼ 1; . . .; k À 1. In this way, analogously to the procedure in Case a), we get a feasible solution for (1) when the length of the conflict path is k À 1, through the elimination of r z k ð Þ (and of the correspondent variable D kÀ1 ) from the optimal solution of the conflict path whose length is k. It follows that the value of (2) for the k À 1 case in correspondence of the feasible solution obtained in this way is reduced of at least two units: A fortiori it will be: When k is odd and r z k ð Þ is at the right extremity of the permutation, it must be: The proof is quite similar when z i À r z i ð Þ[ 0 if i is odd and z i À r z i ð Þ\0 otherwise. h Observation 10 Consider w k ; i.e. the value of (2) in correspondence of a feasible solution-not necessarily the optimal one-when the conflict path length is k.
As a consequence of Proposition 5, if w k À w Ã kÀ1 ¼ 2; then w k ¼ w Ã k . In other words, if w k À w Ã kÀ1 ¼ 2, then w k is an optimal solution of min P kÀ1 i¼1 D i . Since, as said, w Ã 2 ¼ 1, for values of k ! 2 it must be w Ã k ¼ 2k À 3. Substituting this value in (1) we obtain: that gives the (minimum) highest distance between vehicles belonging to the conflict path as a function of its length.
Proof Consider a conflict path whose length is k, i.e. z 1 z 2 ð Þ; z 2 z 3 ð Þ; . . .; z k z kþ1 ð Þ. In what follows we assume that z i À r z i ð Þ\0 if i is odd, while it will be z i À r z i ð Þ[ 0 otherwise. We distinguish the case in which k is even and the case in which k is odd. Note that in both cases, the exact destination of the vehicle z kþ1 , which do not belong to the conflict path, is irrelevant, provided that either r z kþ1 ð Þ[ r z k ð Þ if k is even or r z kþ1 ð Þ\r z k ð Þ if k is odd. When k is even, then, as a consequence of the existence of a conflict path, it must be: Then, consider the following permutation of destinations: r z 2 ð Þ; r z 1 ð Þ; r z 4 ð Þ; r z 3 ð Þ; . . .; r z k ð Þ; r z kÀ1 ð Þ: The corresponding values of D i are D i ¼ 1; i ¼ 1; 3; 5; . . .; k À 1, and D i ¼ 3; i ¼ 2; 4; 6; . . .; k À 2. Their sum is equal to 2k À 3. When k is odd, then it must be: Then consider the following permutation of destinations: r z 2 ð Þ; r z 1 ð Þ; r z 4 ð Þ; r z 3 ð Þ; . . .; r z kÀ1 ð Þ; r z kÀ2 ð Þ; r z k ð Þ The corresponding values of D i are D i ¼ 1; i ¼ 1; 3; 5; . . .; k À 2, D i ¼ 3; i ¼ 2; 4; 6; . . .; k À 3 and D kÀ1 ¼ 2. The sum of these values is equal to 2k À 3. h Observation 11 Proposition 6 states the existence of an optimal solution but not necessarily it is unique. Indeed, in the other case, i.e. when z i À r z i ð Þ[ 0 if i is odd, and z i À r z i ð Þ\0 otherwise, there may be other feasible solutions but, as Proposition 5 states, they cannot be better than the one presented in the proof of Proposition 6. So, it is possible now to establish the relation between the minimum number of columns needed to the existence of a conflict and its length: recalling that n min ¼ min and with min z 2 À z 1 j j¼2; we can conclude that: The computation of the number of levels that ensure the existence of a solution to any instance of FQRP involving n vehicles In this paragraph, we determine the number of levels that ensure the existence of a solution to any possible permutation of vehicles destinations when the value of n is fixed. In order to do so, we firstly prove that, given n, the length of the longest C-type conflict path can be computed in advance. The following proposition provides the relation between n and such a length.
Proposition 7 The length of the longest C-type conflict path in a graph m Â n, which we shall call k max , is: where int x ð Þ is the integer part of x.
Proof The result is immediately deducible considering that: If the maximum possible length of a conflict path having n vehicles is known, we can also determine the number of levels that ensure the existence of a solution to any instance of FQRP involving n vehicles. We call such a number m Ã , as the following proposition states.
Proposition 8 A solution to FQRP for any possible permutation of n destinations r ¼ r 1 ð Þ; r 2 ð Þ; . . .; r n ð Þ can be found in a graph composed of at most m Ã levels, where: Proof We can distinguish two cases: 1 n 2 and n ! 3.
In the first case, all the permutations of destinations do not allow the existence of A-type conflicts and C-type conflicts, i.e. k max ¼ 0. In particular, when n ¼ 1 we have only one vehicle that belongs to set H. When n ¼ 2, if both vehicles do not belong to set H, the leftmost vehicle belongs to set R 1 while the other belongs to L 1 .
In such a case, we can route all vehicles using two levels. Indeed, if the two vehicles perform all their horizontal steps on different levels, they will never enter into conflict. Note that in such a case permutations of destinations exclude the occurrence of an A-type conflict. This proves the thesis in the first case.
When n ! 3, we can have no C-type conflicts as well as one or more than one conflict path, whose length is at most k max .
In the absence of C-type conflicts, it is possible once more to route all vehicles using two levels: we could force vehicles belonging to a set (equivalently, R 1 or L 1 ) to perform all their horizontal steps on the first level while other vehicles perform all their horizontal moves on the second level. The use of such a routing rule always ensures to avoid the occurrence of any kind of conflict. Arc and B-type conflict occurrences are avoided due to the assignment to different levels of vehicles that must move in opposite directions (see Observation 3). Any possible A-type conflict is avoided (remember: when n ! 3), because m Ã ! 3 and there is not a vehicle which must perform its horizontal steps on level m Ã . This proves the thesis when n ! 3 and k max ¼ 0.
Alternatively, as said, we can find one or more than one conflict paths whose length is k max .
In order to take advantage of Observation 7, in the following part of the proof we will assume that each vehicle performs all its horizontal steps on one and only one level. This implies that it must be h zi [ h ziþ1 for each vehicle belonging to a given conflict path. Then, as a consequence, k max þ 1 levels should be used to route these vehicles. The relaxation of such hypothesis implies that it could be used a number of levels lower than m Ã : a fortiori the thesis is proved. Now, consider an instance in which we have two conflict paths both of maximum length, i.e. z 0 . . .; z 0 kmax z 0 kmaxþ1 and z 00 1 z 00 2 À Á ; z 00 2 z 00 3 À Á ; . . .; z 00 kmax z 00 kmaxþ1 .
We must distinguish, once more, two cases. The first one arises when z 0 1 and z 00 1 must move horizontally on the same direction. In this situation, the vehicles of the two conflict paths can be grouped in the following way: vehicles z 0 k max þ1 and z 00 k max þ1 perform all their horizontal steps on the first level (possibly, together with other vehicles that do not belong to any conflict path), vehicles z 0 k max and z 00 k max do all their horizontal steps on the second level and so on. The last group is composed by vehicles z 0 1 and z 00 1 that are forced to make all their horizontal steps on level k max þ 1, while all the other vehicles make all their horizontal moves on a level lower than k max þ 1. It follows that, since m Ã ¼ k max þ 1, vehicles z 0 1 and z 00 1 are the only vehicles forced to move horizontally on the last level and an A-type conflict may occur. On the contrary, vehicles z 0 1 and z 00 1 cannot be involved in an A-type conflict, since they belong to a conflict path whose length is k max and, as a consequence, it must be: It follows that we cannot have a vehicle j such that: because relations (4) and (5) cannot hold at the same time.
The second case arises when z 0 1 and z 00 1 must move horizontally on opposite directions: grouping vehicles as in the previous case will make the occurrence of arc conflicts and B-type conflicts possible.
Then, one solution is to force vehicle z 00 k max þ1 and vehicle z 0 k max þ1 (grouped with z 00 k max ) to perform all their horizontal steps, respectively, on the first and on the second level.
The other solution is allowing vehicle z 0 k max þ1 to make all its horizontal steps on the first level and vehicle z 00 k max þ1 (and z 0 k max ) on the second level. As a consequence, either vehicle z 0 1 or z 00 1 will perform all its horizontal steps on level k max þ 2. As said, they cannot be involved in A-type conflicts, since (4) and (5) should hold at the same time and this is not possible. This proves the thesis when n ! 3 and k max [ 0.
So, in general, in order to guarantee the existence of a solution to FQRP in any possible permutation of n destinations, at least k max þ 2 levels are needed. h Corollary 2 m Ã levels are necessary and sufficient to find a solution to any possible instance of FQRP involving n vehicles when they perform all their horizontal steps on one and only one level (i.e. when h zi ¼ h 0 z i i ¼ 2; . . .; k þ 1) and each level allows movements in one direction only.
Observation 12 Note that m Ã m Ã DA , for n [ 1. Indeed, consider that m Ã DA ¼ n and that the following holds: In particular, note that the difference m Ã DA À m Ã , namely the number of levels that can be saved with respect to previously provided solutions, is an increasing function of the number of vehicles n. 7. Solving FQRP in a graph m* 3 n In the previous section, we provided m*. As shown in Observation 12, the higher is the number of vehicles involved in the instance, the higher is the number of levels that could be saved with respect to solution provided by DA (for example, see the next section). In this section, in order to find a FQRP solution, we provide an algorithm (CaR) to classify vehicles in subsets and route them in a graph m* 9 n, assuming as input the destinations of n vehicles, i.e. r ¼ r 1 ; r 2 ; . . .; r n .
Routes we will find have some features in common with other algorithms that have been proposed (i.e. DA): we will force vehicle to perform all their horizontal steps on the same level and each level allows movements in one direction only.
These features, rather than being hypotheses, are a choice due to several reasons: first, they represent a link to previous works allowing a direct comparison with existing solutions; second, they allow taking advantage of Observation 3, i.e. they permit to ignore research of arc type and B-type conflicts in the instance we face; third, solution is made of very simple path: a feature that could be useful for large vehicles, as aircraft are. Algorithm CaR is composed of two procedures: P 1 and P 2 . P 1 starts from sets R 1 ; L 1 ,R 2 and L 2 and determines a finite sequence of subsets that are used as input in the second procedure, P 2 , which aim is the assignment of one or more vehicles to a suitable level. After the level assignment, the routing rule is very simple: if vehicle i is assigned to level h i , then i starts moving vertically from the first level. Once level h i , is reached, i performs all its horizontal steps on level h i . Then, when i reaches column r i ð Þ moving along level h i , it moves again vertically, until it reaches its destination on level m Ã . Obviously, if h i ¼ 1, vehicle i starts moving horizontally on the first level and it performs all its vertical steps on arcs of column r i ð Þ. Furthermore, if i 2 H, it has only vertical steps to perform and such assignment is irrelevant. Procedure P 1 follows.
Procedure P 1 to assign vehicles to subsets Begin: Step 1 if both R 2 and L 2 are empty then STOP. Otherwise put s ¼ 2 and go to step 2.
Step 2 Put in set R sþ1 each vehicle i 2 R s such that i j ð Þ, j 2 L s . Go to step 3.
Step 3 Put in set L sþ1 each vehicle i 2 L s such that i j ð Þ, j 2 R sþ1 . Go to step 4.
Step 4 if both R sþ1 and L sþ1 are non-empty, then s ¼ s þ 1 and return to step 2. Otherwise STOP.
Note that such a procedure starts from sets R 1 , L 1 , R 2 and L 2 . These last two subsets are composed of all vehicles that are subjected to a C-type conflict and must move, respectively, towards right and towards left. Then, later, the procedure iteratively finds sets, obtained starting from R 2 and L 2 , that share the following features 8s ! 2 : • R sþ1 contains vehicles belonging to R s that must perform their horizontal steps on a level higher than the level used by at least one vehicle belonging to L s .
• L sþ1 is composed of vehicles belonging to L s that must perform their horizontal steps on a level higher than the level used by at least one vehicle belonging to R sþ1 .
Note that if R sþ1 ¼ ;, then necessarily it must be L sþ1 ¼ ;. Then, when the procedure stops, two are the possibilities: R sþ1 6 ¼ ; and L sþ1 ¼ ; or R sþ1 ¼ ; and L sþ1 ¼ ;. In the following, we will call k the highest index such that R k 6 ¼ ;.
Proposition 9 The following relations hold: for each s.
Proof To prove the relations when s ¼ 1, remember that we explicitly consider not decomposable problems (see section first): it follows that vehicles 1 and n cannot belong to H. As a consequence, it must necessarily exist vehicles i 2 R 1 and j 2 L 1 such that r i ð Þ ¼ 1 and r j ð Þ ¼ n. Vehicle i cannot be subjected to C-type conflicts, since there is not a vehicle u\r i ð Þ, and vehicle j cannot be subjected to C-type conflicts, since there is not a vehicle v [ r j ð Þ. Then, at least one vehicle belonging to the set R 1 does not belong to R 2 and at least a vehicle belonging to the set L 1 does not belong to L 2 . This way, the relations are verified for s ¼ 1.
To prove these relations when s ! 2 consider that, by definition, vehicles belonging to, respectively, R sþ1 and L sþ1 , are also elements of R s and L s . Then R sþ1 R s and L sþ1 L s . To prove that R sþ1 is a proper subset of R s , assume that R sþ1 ¼ R s . This implies that if we arbitrarily chose a vehicle i 2 R sþ1 it must exist a vehicle j 2 L s with i j ð Þ. If j 2 L s , and R sþ1 ¼ R s , then it must exist a vehicle g 2 R sþ1 such that j g ð Þ. In turn, it must exist a vehicle p 2 L s such that g p ð Þ, and so on, until, due to the finite number of vehicles, we will find a vehicle q 2 L s such that q i ð Þ. The resulting conflict graph will contain a circuit, but this is not possible since conflict graph is always a family of arborescences. Similar considerations prove that L sþ1 & L s . h Observation 13 From Proposition 9, it follows that the following relation holds: Proposition 10 The following relation holds: k n À 3 2 Proof Consider relation (6), assume w.l.o.g. that set H is empty and that the quantity R s j j þ L s j j À R sþ1 j jÀ L sþ1 j jis as smaller as possible for each value of s, i.e. R s j j þ L s j j ¼ R sþ1 j jþ L sþ1 j jþ2. As a consequence, it will be R 1 j j þ L 1 j j ¼ n, R 2 j j þ L 2 j j ¼ n À 2, R 3 j j þ L 3 j j ¼ n À 4 and, in general, R s j j þ L s j j ¼ n À 2 s À 1 ð Þ. Since by definition R k 6 ¼ ;, it must be R k j j þ L k j j! 1, then n À 2 k À 1 ð Þ!1, i.e. k nÀ3 2 . h The main feature of procedure P 1 is that it allows to order sets according to the list of priorities (see Observation 6 and Observation 7). In order to show this feature, consider the general case in which the procedure finds 2 k, k ! 2 non-empty sets: R 1 ; L 1 ; R 2 ; L 2 ; . . .; R k ; L k .
Consider now L k : By definition it is the set of vehicles that are subject to C-type conflict with at least one vehicle belonging to R k , i.e. vehicles of L k must move on a level higher than the level used by vehicles of set R k . As a consequence, vehicles of set R k must move horizontally on a level such that is both lower than the level used by vehicles of set L k and higher than the level used by at least one vehicle of set L kÀ1 .
Considering that L k & L kÀ1 , it follows that vehicles of set R k must move horizontally on a level higher than the level used by some vehicles of L kÀ1 and lower than the level used by the remaining vehicles of L kÀ1 .
As a consequence, if vehicles of set L k move horizontally on level m Ã À 1 (remember that, in order to avoid A-type conflict, there is not a vehicle moving horizontally on level m Ã ) vehicles of set R k must move horizontally on level m Ã À 2. Then, the set of vehicles that must move on level m Ã À 3 is L kÀ1 nL k , i.e. the set of vehicles belonging to L kÀ1 that must not move on a level higher than m Ã À 2. Similar considerations hold with respect to other levels: the set of vehicles that must move on level m Ã À 4 is R kÀ1 nR k , while vehicles of set L kÀ2 nL kÀ1 move horizontally on level m Ã À 5, and so on.
Note that such a hypothetical assignment would require 2 k levels and, in particular, we would assign the second and the first level to, respectively, vehicles of set L 1 nL 2 and R 1 nR 2 to move horizontally.
Note also that vehicles of sets R 1 nR 2 and R 2 nR 3 can move without conflicts on the same level and one level can be saved through the merging of these sets, i.e. forcing sets R 1 nR 2 and R 2 nR 3 to move horizontally on the same level. This implies that, in such a case, 2 k À 1 levels are required.
Observation 14 Note that, due to the relation R sþ1 & R s between the sets found by the procedure, we have R 1 nR 3 ¼ R 2 nR 3 [ R 1 nR 2 , where the set R 1 nR 2 is the set of vehicles that must move towards right and that are not subjected to C-type conflict and R 2 nR 3 is the set of vehicles that must move towards right and must perform their horizontal steps on a level that is higher than the level used by vehicles of L 1 (see the above-mentioned features of sets) and lower than the level used by vehicles of L 2 .
Finally, note that, since set R 1 nR 3 contains vehicles subjected to C-type conflicts, it must be assigned to a level higher than the level assigned to set L 1 nL 2 .
Procedure P 1 assigns vehicles to subsets. The following procedure P 2 assigns vehicles to levels on the basis of the sets defined by the procedure P 1 with respect to the list of priorities inherently present in sets found by procedure P 1 . Note that the use of P 2 can be avoided when k ¼ 1 (see proof of Proposition 8).
Then, in the following procedure that assumes as input subsets defined using the procedure P 1 , we assume that k ! 2.
Procedure P 2 to assign subsets to levels.
if p ¼ 1 STOP, otherwise go to step 2.
Step 2 if p 6 ¼ 3 assign to level p À 1 vehicles belonging to set Rpþ1 2 nRpþ3 2 . Otherwise assign to level 2 vehicles belonging to set R 1 nR 3 . Go to Step 3).
Step 3 p ¼ p À 2 and return to step 1.
The procedure P 2 starts defining the value of a parameter p. Such a parameter can be interpreted as the highest level in which a vehicle performs its horizontal steps and, as already said, the number of levels required is at most 2 k À 1 due to the merging of vehicles of sets R 1 nR 2 and R 2 nR 3 that move horizontally on the same level.
Finally, note that the number of iterations in the second procedure P 2 is always equal to k.

Complexity issues
Proposition 11 Algorithm CaR gives in polynomial time O n 3 ð Þ a solution of FQRP.
R 4 ¼ 15 f g; L 4 ¼ 19 f g: The assignment of the vehicles to levels, due to the application of P 2 , is given in Table 1. Note that levels 8, 9 and 10 are not traversed by vehicles moving horizontally.
9. Number of levels necessary to DA to solve FQRP: an empirical comparison In this section we show that the number of levels needed by DA can be higher than m Ã . Consider the following instance in which we have 13 vehicles, so m Ã ¼ 6: The starting permutation is the identical one. The permutation of destinations is: r ¼ 13; 9; 8; 6; 4; 3; ð 5; 2; 11; 1; 7; 10; 12Þ: In order to show DA results, we need to make some specifications. DA forces movements in a particular way: even (odd) levels allow horizontal movements to the right and odd (even) levels allow horizontal movements to the left. Once the direction allowed by even (odd) levels is chosen, a key role is played by a threshold parameter which is called K t and is defined as the maximum horizontal distance at time t of 'discordant' vehicles on the current maximum level. As said, a vehicle is discordant if one of the following conditions is verified: it has to move horizontally in a direction opposite to the one allowed by the level where the vehicle is, or it has only vertical steps to perform. DA works as follows: for each t and for each actual maximum level, both all discordant vehicles and vehicles not discordant having horizontal distance less than K t perform a vertical step. When executing DA, the solution obtained needs a grid graph 8 9 13. Table 2 compares the assignment of vehicles to levels in DA solution with the assignment obtained using our procedures. As said, if a vehicle is assigned to level, then it performs all its horizontal steps on that level.
Note that DA needs two levels more than m Ã , while, using our procedures, the number of levels effectively used by vehicles to perform their horizontal steps is lower than m Ã .

Concluding remarks
In this paper, we considered FQRP on a grid graph, i.e. the problem of find n manhattan paths, one for each vehicle, connecting starting nodes, placed at the first (bottom) level, to arrival nodes, placed at the highest level.
The existing literature provided solutions assuming that each level allows movements in one direction only and that each vehicle performs all its horizontal steps on the same level. In such solutions, the number of levels of the graph is supposed to be high enough.
The main result of this paper is the determination of m Ã , the minimum number of levels in a grid graph that guarantees the existence of a solution to any instance of FQRP involving n vehicles when they move in the ways that the literature has until now assumed.
We show that the higher the number of vehicles in the instance, the higher the number of levels that can be saved with respect to existing solutions. This is the reason why, as a minor aim, we provide, an algorithm, CaR, to find a FQRP solution in a graph m Ã Â n.
In our opinion, this is a significant contribution to the state of art because, fixed a value of n, it is possible identifying a grid whose number of levels is minimum but high enough to find a solution to any permutation of destinations. These results can be useful in some real applications, as in any context in which there are AGVs, because we can reduce the effort (in terms of time) to route all the fleet from departures to destinations.   2, 9, 10, 16, 17, 18, 20, 24 1 11, 12, 13, 28, 29