**1. Introduction**

Modern transportation and handling systems greatly benefit from information technology (IT) and automation, as demonstrated by the consolidated use of sensor-equipped transport networks, automated guided vehicles (AGVs), self-moving robots, as well as the growing adoption of drones, in many industrial, logistic and public transportation environments. Typical examples can be found in railway transportation systems, where optic or acoustic sensors on trains and tracks, integrated by collision detection and avoidance logic, support safe and efficient operations. IT also supports taxiways operations in airports airside [1], where aircraft, passenger buses as well as many ground service vehicles (like baggage dollies, passenger steps, tow-tractors, follow-me cars, etc.) run intersecting routes between the boarding gates and the runways, and the risk of collisions or deadlocks has to be constantly monitored. Another application in logistic networks involves the use of AGVs in port terminals [2] to transport containers from the berths on the quay along the shoreline to dockside stacks and land access points. In a similar way, automated warehouses or factories adopt vehicles (like AGVs or drones) to transfer goods or materials from the depot shelves to the delivery docks or between production lines [3], or to perform other inventory, inspection or surveillance operations [4,5]. In all of these cases, the traffic load may be relevant and appropriate vehicle routes must be designed and operated, in order to mitigate the risk of collision while preserving the system efficiency in terms of transportation time and cost. To this end, IT provides hardware and software devices to support safe and efficient transport network operations. A sensing network, including

sensors installed on the network infrastructure and/or the vehicles, collects information (position, direction, velocity, etc.), that is processed by software logic that schedules vehicle movements and detects possible conflicts or deadlocks. In this context, the availability of optimization algorithms can be determinant in reducing transportation time, cost and accident rates, with relevant economic as well as social benefits.

We focus on automated transportation systems where, for the sake of safety, potential collisions should be avoided in advance as much as possible. In particular, we envision a system where, given the initial and the goal positions of each vehicle, a set of collisionfree *nominal* routes are determined, and the sensing network and related logic manage, at real-time, possible conflicts or deadlocks that may arise due to unpredicted events causing any vehicle or network disruptions that prevent following the predefined schedule. Moreover, in many cases, like, container port terminals (see, e.g., [6]), logistic and industrial warehouses, etc., automated transportation systems rely on a grid network topology, where the vehicle moves on intersecting horizontal and vertical lanes. This motivates us to consider a simplified, although realistic, setting, where vehicles are initially positioned on one side of the grid network (e.g., the berths along the shoreline in a port terminal, or the gates of an airport apron) and have to reach a destination on the opposite side (e.g., the land or the runways access points), and the time needed to move between any two consecutive lanes is the same for all vehicles. Under these settings, the most efficient way for a single vehicle to reach its destination is to follow a smooth *nonstop* path that starts from the origin and only contains moves on horizontal and vertical lanes in the same direction, the one towards the destination. Such kinds of shortest paths on the grid do not contain horizontal (or vertical) moves in opposite directions and are called *Manhattan paths*. Clearly, there exists more than one Manhattan path for each vehicle. If a fleet of two or more vehicles has to be routed, choosing Manhattan paths may cause collisions, since two vehicles may require to cross the same intersection or the same road segmen<sup>t</sup> between two lines at the same time. Collisions can be avoided by choosing different Manhattan paths rather than stopping vehicles along the path, in order to preserve efficiency. To this end, let us consider, without loss of generality, the case where vehicles have to move from the bottom side of the grid to the top side and observe that it is always possible to route vehicles, without stops, on a set of collision-free Manhattan paths where each vehicle performs all the required horizontal moves on a different dedicated horizontal lane. The drawback of such a solution is the possibly large number of required horizontal lanes, which corresponds to long displacement times and large infrastructural and operational costs, including, e.g., land consumption, sensing network installation and operation and transportation costs. On the other hand, a small number of available horizontal lanes may not be sufficient to guarantee the possibility of finding collision-free routes without stopping or deviating from the Manhattan paths.

The question of determining the smallest number of required horizontal lanes is the object of the fleet quickest routing problem on grids (FQRP-G), which can be stated as follows. We are given a grid network made of intersecting horizontal and vertical lanes and a set of vehicles. The time to move between consecutive lanes is constant and the same for every vehicle. Each vehicle is initially positioned at its origin at one side of the grid and has to reach its destination at the opposite side: without loss of generality, let origins be located at the bottom and destinations at the top of the grid, that is, the route of each vehicle starts at the bottom of a vertical lane and ends at the top of a (possibly different) vertical lane. We want to determine the minimum number of horizontal lanes that allow routing the vehicles on a set of collision-free nonstop Manhattan paths.

The scope of the paper is presenting an exact solution approach to FQRP-G, based on mathematical programming, and alternative fast heuristics that exploit relevant theoretical results presented in the literature, with the aim of assessing their computational performance and their impact on the design of time-cost efficient and safe routing systems. After reviewing the literature related to FQRP-G in Section 2, the general methodology adopted in this paper, based on modelling the problem on an undirected grid graph, is presented in

Section 3, together with previous theoretical results that are relevant for our work, and an integer linear programming formulation of FQRP-G. Fast heuristic algorithms are reported in Section 4, one corresponding to a more efficient implementation than that proposed in [7], and further greedy procedures that prioritize vehicles based on measures computed on a conflict graph, defined in Section 3.2. Section 5 reports on computational experiments on a benchmark of more than 200 random and on-purpose designed instances of different sizes up to 300 columns and vehicles. Results show that the proposed exact approach is able to solve instances up to about 150 vehicles in a few seconds, whereas running times become longer than one minute, and exponentially increase for larger instances. In any case, we show that the optimal solution, on average, would enable large per cent savings in terms of required horizontal levels. The tested heuristics always run in a blink. Moreover, even if the gap from the optimal solution may be, in theory, very large, the worst-case performance is just observed on on-purpose designed instances, whereas the performance on random instances, in particular for the first heuristic, shows just a few additional required horizontal lanes with respect to the optimal solution. This means that, as discussed in Section 6, the proposed heuristic can be used in realistic settings with relevant savings in terms of transportation and sensing infrastructure while preserving vehicle route safety. The concluding Section 7 summarizes the findings of the paper and draws some lines for further research.

### **2. Literature Review**

Several works in literature are related to FQRP-G and, more generally, to designing a routing network and finding collision-free schedules for multiple vehicles.

In the collision-free route planning problem (also known as *multi-agent path finding* in artificial intelligence literature), a set of vehicles with a given origin and destination has to move in a given routing network, modelled as a directed graph. A first group of papers presents *static* approaches, where, for each vehicle, nominal routes are computed on the underlying routing network, taking load-balance factors into account, to prevent collisions as far as possible [8,9], or, if the application context allows, by dividing the routing area into non-intersecting zones, each occupied by one vehicle at a time, as in regional control models [9–12]. In general, such approaches cannot guarantee collision-free nominal routes, and additional methods are required during their execution to detect and resolve collisions and, in case, deadlocks, based on, e.g., Petri Net approaches [13,14], graph-theoretic models [15], queries on geospatial reference grid systems [16] and searching the space of possible deviations from nominal routes [17]. A specialized static approach for grid networks is presented in [18], where initial routes that minimize collisions are chosen from equivalent Manhattan paths, and selected collision avoidance rules, based on preliminary collisions classification, are applied during execution.

An improved static method is proposed in [19], where statically computed loadbalanced paths are post-processed by resource reservation and deadlock prevention techniques inspired by [20], leading to collision-free routes.

Notice that, in general, collision and deadlock avoidance introduce deviations from nominal shortest paths as well as delays in the vehicle schedule, since stops may be required during routes operation. By considering deviations and delays already at the planning stage, *dynamic* approaches are able to directly determine optimized collision-free paths and schedules, by taking into account that the impact of vehicle routes on network resources changes over time. For a general network topology, the authors of [21] developed a heuristic based on a mathematical programming formulation and column generation, whereas exact algorithms are devised in [22] for the special case where the routing network consists of two horizontal lanes and vertical bridges between them, and in [23] for the special case of two vehicles on a grid network. The dynamic approach proposed in [24] for the general case, iteratively computes shortest paths on a time-expanded network, and it is suitable for online settings, where transportation requests may appear during operations. In [25], a time-expanded network allows dynamically modelling the problem as a multi-commodity network flow [26]: the corresponding integer linear programming formulation, solved by state-of-the-art off-the-shelf solvers, provides either cost- or time-optimal schedules for up to 50 vehicles to be routed on a grid network.

The literature also integrates collision avoidance methods and dynamic algorithms with general heuristic searching techniques (A\*-based search, evolutionary algorithms, particle swarm optimization, neighbourhood search, etc. [27]) that efficiently explore different vehicle priorities and conflict-resolution policies, as well as alternative routes towards the destinations. For example, in [28], an improved A\* algorithm searches the paths between vehicles origin and destination in a grid network related to a warehouse environment, also taking congestion measures into account, and grid specific priority rules are used to solve residual conflicts. In [29], the D\* Lite search algorithm is run on a reachability graph obtained from a suitable coloured Petri net that models feasible multi-AGV trajectories. A Time Enhanced A\* search is proposed in [30] to find collision-free route plans in a time-expanded network, and integrated with tabu search techniques to further improve the efficiency by changing the assignment of transport tasks between robots. The Conflict Based Search proposed in [31], and further enhanced in [32], explores a constraint tree whose nodes are evaluated through nominal shortest routes and, in case of collisions, branches are generated corresponding to alternative vehicle priorities. For the solution of a real ship traffic optimization problem, the authors of [33] integrate the dynamic collisionfree routing algorithm proposed in [24] into a local search scheme that explores the space of possible alternative scheduling decisions related to precedence conflicts between ships that compete for traversing a waterway with limited capacity and equipped with sidings to allow ships stopping and passing each other, according to the chosen precedence strategy.

We remark that the collision-free routing methodologies described above allow for vehicle stops and deviations from the nominal shortest paths (Manhattan paths, in the case of grids), whereas our research focuses on smooth nonstop routes. With this respect, FQRP-G has relations to the design of at-grade traffic networks without conflicts, aiming at configuring and operating a routing network where all roads run at the same level (atgrade) and all vehicles can seamlessly move from their origin to their destination without stopping. A grid-shaped network is proposed in [34], where conventional four-leg lane intersections are replaced by a combination of suitable intersections with restrictions on the permitted lane exchanges, giving rise to paths where vehicles can safely move without stops between any two points of the grid, at the cost of an additional detour with respect to the Manhattan path, which may represent a good trade-off, especially for automated routing networks [35]. An alternative design is obtained in [36], by tiling together hexagon blocks with one-way or bidirectional links, able to avoid intersection conflicts between any nonstop paths.

In this context, a conflict-free routing system based on grid networks with alternating one-way lanes and no detour from nominal shortest paths is presented in [37]: platoons, each representing a virtual sequence of non-conflicting vehicles running on the same lane, are scheduled on a regular basis (rhythm), in such a way that, in each moment in time, just one virtual platoon crosses an intersection; each (real) vehicle is scheduled to join a synchronized nonstop sequence of virtual platoons to cover a Manhattan path from its origin to its destination. Notice that, due to the limited length of virtual platoons, a vehicle may need to wait at the border of the grid before joining the first platoon and proceeding to its destination, so that the problem is to optimize the vehicle entry times, which is modelled and solved in [37] with an integer linear programming formulation.

Even if the literature presented above shares common features with FQRP-G, it presents significant limitations in the scope of our research. In fact, as already observed, the reviewed routing algorithms may entail delays during the execution of the routes, as well as deviations from Manhattan paths. Even conflict-free routing systems involve either detours from optimal paths (like, e.g., [34]) or delays at the beginning of the schedules (like, e.g., [37]). As a consequence, the routes provided by previous methods are, in general, worse than the ones expected from the solution of FQRP-G, since we are looking for

algorithms able to avoid collisions and deadlocks while preserving shortest paths with no initial nor intermediate delays. Moreover, under the hypothesis on the distribution of vehicles origins and destinations given in Section 1, the goal of FQRP-G is to minimize the grid size, which, instead, is given and fixed in previous literature, where different metrics are optimized.

Concerning works involving grid networks and nonstop collision-free routing on Manhattan paths and, hence, more strictly related to FQRP-G, a first heuristic approach is proposed in [38], where collision avoidance is guaranteed by one-way horizontal lanes and by prioritization of horizontal moves, based on the distance of a vehicle from its destination: the number of required horizontal lanes is equal to the number of vehicles, in the worst case, and smaller on average. Improved upper bounds and heuristic algorithms for FQRP-G are discussed in [7,39,40], based on the analysis of the potential conflicts arising between vehicles, and the related properties. In particular, thanks to theoretical results derived under the one-way lanes hypothesis and, as far as [7] is concerned, by restricting Manhattan paths to those containing only one horizontal leg, the number of required horizontal lanes is limited by roughly the number of vehicles divided by four, using the heuristic proposed in [7], whereas the bound claimed by the authors of [40] has to be amended, as observed in [39]. The results presented in [7,38] that are relevant for the analysis proposed in our work, will be reviewed in Section 3.

### **3. Methodology: A Mathematical Formulation**

In this section, we describe a mathematical model for FQRP-G, based on a graph representation. It will be used to introduce notation and to review some relevant properties presented in the literature. By exploiting such properties, we then propose a mathematical programming formulation of FQRP-G, which will be the base for the exact approach proposed in this work.

### *3.1. Graph Model and Notation*

The analysis and the development of solution methods for FQRP-G starts from modelling the grid network as an undirected grid graph *G* = ( *N*, *<sup>E</sup>*): the set *N* contains the vertices, each corresponding to the intersection of one horizontal and one vertical lane, and the set *E* contains the lane segments, each connecting two consecutive nodes on the same horizontal or vertical lane (see Figure 1a).

**Figure 1.** A sample grid graph with two conflicting vehicles routed on: (**a**) paths colliding in the red node; (**b**) collision-free paths.

We denote with *n* the number of vertical lanes (or *columns*) and with *m* the number of horizontal lanes (or *rows* or *levels*) in the grid. Columns are numbered from left to right from 1 to *n*, rows from bottom to top from 1 to *m*, so that each node representing the intersection between column *i* and row *j* is identified by the pair (*i*, *j*). Without loss of generality, we consider vehicle origins located at the bottom of the grid, in row 1, and, thus, vehicle destinations at the top of it, in row *m*. Moreover, the dummy level *m* + 1 in

Figure 1 at the top of the grid, simply represents the vehicle exit points from the grid. Let *α*(*k*) denote the starting column of vehicle *k* and *ω*(*k*) its destination column.

All vehicles start at the same time and, according to the FQRP-G definition, they never stop until they reach their destination. We recall that the time to cross an edge is constant and the same, for every edge and vehicle, and we can take it as the unit time. We can thus assume that the time is discrete and that, at each moment in time, each vehicle has to make a move, either vertically or horizontally.

We recall that, for the sake of efficiency, each vehicle has to reach its final destination using a *Manhattan path* on the grid, that is a (shortest) path that does not contain moves in opposite directions. Moreover, in order to avoid collisions, two different vehicles cannot use the same edge, or be in the same node, at the same time. In particular, no two vehicles can start from the same position, nor can share the same final position.

We also say that two vehicles *i* and *j* are in (or have) an *edge* (resp. a *node*) *conflict* between each other, if there exists a Manhattan path *πi* of *i* and a Manhattan path *πj* of *j* that use one same edge (resp. node) at the same time. If *πi* and *πj* are chosen, then a *collision* between *i* and *j* occurs. For example, vehicles *p* and *q* in Figure 1 have a node conflict, as shown, e.g., by the two Manhattan paths depicted in Figure 1a, that use the same node at time 4. Clearly, since we search for a set of pairwise collision-free paths, a solution to FQRP-G is feasible if and only if it does not contain any such a pair of paths. With reference to the example of Figure 1, notice that the node conflict between *p* and *q* can be avoided by, e.g., choosing the two Manhattan paths of Figure 1b.

We can divide the vehicles into three sets, *S*, *R* and *L*, in the following way:

*S* = {*k* : *ω*(*k*) = *<sup>α</sup>*(*k*)},

$$\mathcal{R} = \{k : \omega(k) > a(k)\},$$

$$L = \{ k : \omega(k) < \mathfrak{a}(k) \}.$$

Vehicles belonging to *S* have to proceed *straight* to their final destination, and they have no conflict with other vehicles.

Vehicle *k*1 belonging to *R* will have to make *<sup>ω</sup>*(*k*1) − *<sup>α</sup>*(*k*1) horizontal moves to the *right* and may have conflicts with vehicles belonging to *L*.

Vehicle *k*2 belonging to *L* will have to make *<sup>α</sup>*(*k*2) − *<sup>ω</sup>*(*k*2) horizontal moves to the *left* and may have conflicts with vehicles belonging to *R*.

Since, for each vehicle belonging to *S*, there is only one Manhattan path, we have to choose a path only for vehicles in *R* or *L*.

In the proposed modelling framework, the FQRP-G objective can be stated as follows: we want to find the minimum number of levels necessary for all the vehicles to complete all horizontal moves before reaching their final destination column without collisions. A conflict between two vehicles can exist only if one of them belongs to *R* and the other to *L*. Moreover, since we consider nonstop Manhattan paths, further necessary conditions can be established. To this end, given vehicles *k*1and *k*2, let *<sup>c</sup>*(*k*1, *k*2) = *α*(*k*1) + *<sup>α</sup>*(*k*2)/2.

 An edge conflict between vehicles *k*1 and *k*2 exists if and only if the pair (*k*1, *k*2) belongs to the set

$$\mathcal{C}\_{odd} = \left\{ (k\_1, k\_2) \in \mathbb{R} \times L \, : \, a(k\_1) < a(k\_2), \, a(k\_1) + a(k\_2) \text{ is odd}, \\ \begin{aligned} \omega(k\_1) &< \omega(k\_1, k\_2) + a(k\_2) \text{ is odd}, \\ \omega(k\_1) &\ge \varepsilon(k\_1, k\_2) \le \varepsilon(k\_1, k\_2) \right\}. \end{aligned} \tag{1}$$

The conflict only occurs on a horizontal edge joining a node of column *<sup>c</sup>*(*k*1, *k*2) with a node of column *<sup>c</sup>*(*k*1, *k*2) + 1. To avoid collisions related to edge conflicts between vehicles *k*1 and *k*2 with (*k*1, *k*2) ∈ *Codd*, vehicles *k*1 and *k*2 have to cross the space between columns *<sup>c</sup>*(*k*1, *k*2) and *<sup>c</sup>*(*k*1, *k*2) + 1 at different levels.

A node conflict between vehicles *k*1 and *k*2 exists if and only if the pair (*k*1, *k*2) belongs to the set

$$\mathcal{C}\_{\text{even}} = \left\{ (k\_1, k\_2) \in \mathbb{R} \times L \, : \, a(k\_1) < a(k\_2), \, a(k\_1) + a(k\_2) \text{ is even}, \\ \begin{aligned} \omega(k\_1) &\ge \mathfrak{c}(k\_1, k\_2), \, \omega(k\_2) \le \mathfrak{c}(k\_1, k\_2) \right\}. \end{aligned} \tag{2}$$

The conflict only occurs on a node of column *<sup>c</sup>*(*k*1, *k*2). Node conflicts can be further classified as (see [7]):


To avoid collisions related to B-conflicts between vehicles *k*1 and *k*2 such that (*k*1, *k*2) ∈ *Ceven*, the set of nodes in column *<sup>c</sup>*(*k*1, *k*2) visited by vehicle *k*1 has to be disjoint from the set of nodes in the same column visited by vehicle *k*2.

Consider now vehicles *k*1 and *k*2 such that (*k*1, *k*2) ∈ *Ceven*, subject to a C-conflict, and assume that *<sup>ω</sup>*(*k*2) = *<sup>c</sup>*(*k*1, *k*2). In this case, any Manhattan path of vehicle *k*2 reaches column *<sup>c</sup>*(*k*1, *k*2) and then proceeds with vertical steps only, remaining in such column. Therefore, vehicle *k*1 needs to visit and leave column *<sup>c</sup>*(*k*1, *k*2) before *k*2 reaches this column. Hence, as observed by the authors of [7], to avoid collisions related to such C-conflict, it is necessary and sufficient that vehicle *k*1 leaves column *<sup>c</sup>*(*k*1, *k*2) on a lower level than that on which vehicle *k*2 reaches it.

Given two vehicles *k*1 and *k*2 subject to a C-conflict, we say that *k*2 *has a C-conflict with k*1 if *<sup>ω</sup>*(*k*2) = *<sup>c</sup>*(*k*1, *k*2) and, vice versa, *k*1 *has a C-conflict with k*2 if *<sup>ω</sup>*(*k*1) = *<sup>c</sup>*(*k*1, *k*2). Such relation is not symmetric: if *k*2 has a C-conflict with *k*1, then *k*1 does not have a C-conflict with *k*2. Furthermore, if *k*2 has a C-conflict with *k*1, then it cannot have any other C-conflict with any vehicle distinct from *k*1.

### *3.2. Review of Relevant Previous Results*

Andreatta et al. in [38] consider FQRP-G and propose a heuristic dispatching algorithm (DA) to solve it. The algorithm incrementally builds vehicle routes and its underlying idea is to give priority to the horizontal movement of the vehicles with higher numbers of remaining horizontal steps. DA provides collision-free Manhattan paths and its computational complexity is <sup>O</sup>(*n*<sup>2</sup>). As observed in [38], the route generated by DA for any vehicle is, by construction, a *simple* Manhattan path, i.e., a Manhattan path such that all its horizontal moves are performed on one level only. Moreover, no level contains horizontal moves in opposite directions, that is, grid rows corresponds to one-way horizontal lanes. Concerning the objective function value, the number of necessary levels, i.e., the number of levels at which at least one vehicle moves horizontally, is bounded by the number of vehicles, hence by *n*, in the worst case, even if it can be significantly smaller for specific FQRP-G instances.

The minimum number of levels that ensures the existence of collision-free routes in any instance of FQRP-G for a given *n*, has been deeply investigated by Cenci et al. in [7]. They tackle FQRP-G defining *C-conflict paths*, i.e., sequences of vehicles such that each vehicle in the sequence has a C-conflict with the following one (we recall that the definition of C-conflict is not symmetric). They prove that the length of the longest C-conflict path that can be observed in any instance of FQRP-G on a grid with *n* ≥ 3 columns is equal to

$$1 + \left\lfloor \frac{n-1}{4} \right\rfloor. \tag{3}$$

Then they assume that only simple Manhattan paths are feasible and that each grid level allows movements in one direction only (one-way horizontal lanes). These conditions exclude collisions related to edge and B-conflicts and restrict the attention to C-conflicts. Under such hypotheses, Ref. [7] proves that, for *n* ≥ 3,

$$m^\* = 3 + \left\lfloor \frac{n-1}{4} \right\rfloor \tag{4}$$

is the number of levels of the grid that guarantees the existence of a feasible solution to every instance of FQRP-G. As a minor result, they provide an algorithm (called *CaR*) to solve any instance of FQRP-G on a grid graph *n* × *m*<sup>∗</sup> with time complexity <sup>O</sup>(*n*<sup>3</sup>), thus showing that *m*<sup>∗</sup> horizontal lanes are also sufficient.

An important byproduct of the research in [7], which will be relevant for the analysis proposed in this paper, is the definition of the *C-conflict directed graph F* = (*<sup>V</sup>*, *<sup>A</sup>*), where *V* is the set of vehicles and *A* is the set of arcs, defined as follows: given two vehicles *k*1 and *k*2, (*k*1, *k*2) ∈ *A* if and only if *k*2 has a C-conflict with *k*1. In other words, arcs are associated with C-conflicts: arc (*k*1, *k*2) means that the route of *k*1 must be strictly below the route of *k*2 in column *<sup>ω</sup>*(*k*2) of graph *G*. Notice that the definition of C-conflict directed graph given above slightly differs from the one in [7], as the arc orientation is opposite. This allows us to restate one of the results in [7] as follows, and to provide a formal proof (recall that an arborescence is a directed rooted tree such that the path from the root to any other node is unique).

#### **Proposition 1** ([7])**.** *The C-conflict directed graph F is a forest of arborescences.*

**Proof.** Suppose that the directed graph *F* contains a cycle *k*1, *k*2, ... , *kc*, *kc*+<sup>1</sup> = *k*1. For any pair of consecutive vehicles in the cycle, *ki* and *ki*+1, vehicle *ki*+<sup>1</sup> has a C-conflict with vehicle *ki* by the definition of arc in *F*. It follows that the number of horizontal steps in the route of *ki* (equal to |*ω*(*ki*) − *α*(*ki*)|) is strictly greater than the number of horizontal steps in the route of *ki*+1, for any *i* = 1, ... , *c*. However, this contradicts the fact that *k*1 = *kc*+1. Therefore, the directed graph *F* does not contain cycles. Furthermore, as each vehicle can have a C-conflict with at most one other vehicle, each node of *F* has at most one entering arc, and thus the path from the root to any node is unique. It follows that *F* is a forest of arborescences.

### *3.3. A Mathematical Programming Formulation*

In this section, we propose a mathematical programming formulation of FQRP-G. Mathematical programming is a well-known operations research tool to model and solve optimization problems. A mathematical programming model defines numerical decision variables and, based on these variables, an objective function, and a system of equations and inequalities (constraints): the objective function is the quantity to be maximized or minimized, whereas the constraints define the set of feasible solutions. Solving a mathematical programming model means finding a solution that satisfies all the constraints and optimizes the value of the objective function. Integer linear programming formulations are mathematical programming models where the objective, as well as the constraints, are linear functions of the decision variables, and (some of) the variables are restricted to assume integer values only. There is no known polynomial-time algorithm to solve general integer linear programming models (indeed, this is an NP-hard problem [41]), but standard techniques are available, like, e.g., branch and bound or cutting planes algorithms and further improvements (see, e.g., [42,43]), whose running time is expected to grow exponentially with the size (number of variables and constraints) of the formulation. However, these techniques are implemented by state-of-the-art solvers, which provide effective off-the-shelf tools to solve optimization problems formulated as integer linear programming models in a wide range of applications, including collision-free network design and routing (e.g., [25,37]), at least for moderate-size instances.

The integer linear programming formulation we propose for FQRP-G is based on network flow models (see, e.g., [26]). For each vehicle *k* ∈ *R*, let us introduce the following binary variables *xvijk* and *<sup>x</sup>hijk*, representing decisions about vertical and, respectively, horizontal moves:


For each vehicle *k* ∈ *L*, let us introduce the following binary variables *yvijk* and *<sup>y</sup>hijk*, which are the homologous of *x* variables above:


We remind that the dummy level *m* + 1 represents the vehicle exit points from the grid. Therefore, variables *xvimk* or *<sup>y</sup>vimk*, just above defined, are equal to 1 if vehicle k from the top of column *i* moves out of the grid.

Finally, let us introduce a variable *z*, whose meaning is the highest level where a horizontal move takes place.

The proposed integer linear programming formulation of FQRP-G (ILP) is reported in Figure 2. As from the objective function (5), we are interested in minimizing *z*, i.e., we want to find the minimum number of levels necessary for all the vehicles to complete all horizontal moves before reaching their final destinations.

Overall, constraints (6)–(11) guarantee that, for each vehicle, the edges associated with variables that take value 1 provide a (shortest) Manhattan path: constraints (6)–(8) are devoted to vehicles in *R* whereas constraints (9)–(11) to vehicles in *L*. Constraints (6) and (9) require that the route of vehicle *k* starts at position (*α*(*k*), 1) with either a horizontal step or a vertical one. Then, equalities (7) and (10) state flow conservation, that is: if vehicle *k* reaches node (*i*, *j*) (either with a vertical or a horizontal move, see the left-hand side), then *k* must perform either a vertical or a horizontal move starting from the same node (see the right-hand side). For the sake of clarity, notice that constraints are stated regardless of the fact that, for some boundary values of indexes *i* and *j*, some of the variables involved in (7) and (10) are not defined and must be replaced by 0. In the definition of constraint (7) for *k* ∈ *R*, this happens for the following variables: (i) *<sup>x</sup>hi*−1,*j*,*k*, if *i* = *α*(*k*); (ii) *<sup>x</sup>hi*,*j*,*k*, if *i* = *ω*(*k*) and (iii) *<sup>x</sup>vi*,*j*−1,*k*, if *j* = 1. With similar arguments, in the definition of constraint (10) for *k* ∈ *L*, the following variables must be replaced by 0: (i) *<sup>y</sup>hi*+1,*j*,*k*, if *i* = *α*(*k*); (ii) *<sup>y</sup>hi*,*j*,*k*, if *i* = *ω*(*k*) and (iii) *<sup>y</sup>vi*,*j*−1,*k*, if *j* = 1. Equalities (8) and (11) require that the route of vehicle *k* reaches the top of the destination column with a vertical step.

After the observation that defines sufficient conditions to avoid collisions related to node conflicts (see Section 3.1), such collisions are avoided by constraints (12): they state that at most one of the two vehicles involved in a given conflict can reach, with either a vertical or a horizontal move, the potential collision position, i.e., the same row in the conflict column. Even for these constraints, boundary index values are solved by replacing *<sup>x</sup>vi*,*j*−1,*k*<sup>1</sup> = *<sup>y</sup>vi*,*j*−1,*k*<sup>2</sup> = 0 in case *j* = 1. Even according to the sufficient conditions stated in Section 3.1, constraints (13) prevent collisions related to edge conflicts, since they exclude routes where two vehicles in such a conflict move between the interested columns at the same level.

Variable *z* is linked to variables *x* and *y* through (14) and (15), stating that at least *j* levels are required if at least one horizontal move takes place at row *j*.

(ILP) min *z* (5) s.t. *<sup>x</sup>vα*(*k*),1,*<sup>k</sup>* + *<sup>x</sup>hα*(*k*),1,*<sup>k</sup>* = 1 *k* ∈ *R* (6) *<sup>x</sup>vi*,*j*−1,*<sup>k</sup>* + *<sup>x</sup>hi*−1,*j*,*<sup>k</sup>* = *<sup>x</sup>vi*,*j*,*<sup>k</sup>* + *<sup>x</sup>hi*,*j*,*<sup>k</sup> k* ∈ *R*, *α*(*k*) ≤ *i* ≤ *<sup>ω</sup>*(*k*), 1 ≤ *j* ≤ *m* (7) *<sup>x</sup>vω*(*k*),*m*,*<sup>k</sup>* = 1 *k* ∈ *R* (8) *<sup>y</sup><sup>v</sup>α*(*k*),1,*<sup>k</sup>* + *<sup>y</sup>hα*(*k*),1,*<sup>k</sup>* = 1 *k* ∈ *L* (9) *<sup>y</sup>vi*,*j*−1,*<sup>k</sup>* + *<sup>y</sup>hi*+1,*j*,*<sup>k</sup>* = *<sup>y</sup>vi*,*j*,*<sup>k</sup>* + *<sup>y</sup>hi*,*j*,*<sup>k</sup> k* ∈ *L*, *ω*(*k*) ≤ *i* ≤ *<sup>α</sup>*(*k*), 1 ≤ *j* ≤ *m* (10) *<sup>y</sup><sup>v</sup>ω*(*k*),*m*,*<sup>k</sup>* = 1 *k* ∈ *L* (11) *<sup>x</sup>vi*,*j*−1,*k*<sup>1</sup> + *<sup>x</sup>hi*−1,*j*,*k*<sup>1</sup> + *<sup>y</sup>vi*,*j*−1,*k*<sup>2</sup> + *<sup>y</sup>hi*+1,*j*,*k*<sup>2</sup> ≤ 1 (*k*1, *k*2) ∈ *Ceven*, *i* = *<sup>c</sup>*(*k*1, *k*2), 1 ≤ *j* ≤ *m* (12) *<sup>x</sup>hi*,*j*,*k*<sup>1</sup> + *<sup>y</sup>hi*+1,*j*,*k*<sup>2</sup> ≤ 1 (*k*1, *k*2) ∈ *Codd*, *i* = *<sup>c</sup>*(*k*1, *k*2), 1 ≤ *j* ≤ *m* (13) *z* ≥ *j* · *<sup>x</sup>hi*,*j*,*<sup>k</sup> k* ∈ *R*, *α*(*k*) ≤ *i* ≤ *ω*(*k*) − 1, 1 ≤ *j* ≤ *m* (14) *z* ≥ *j* · *<sup>y</sup>hi*,*j*,*<sup>k</sup> k* ∈ *L*, *ω*(*k*) + 1 ≤ *i* ≤ *<sup>α</sup>*(*k*), 1 ≤ *j* ≤ *m* (15) *xvijk* ∈ {0, 1} *k* ∈ *R*, *α*(*k*) ≤ *i* ≤ *<sup>ω</sup>*(*k*), 1 ≤ *j* ≤ *m xhijk* ∈ {0, 1} *k* ∈ *R*, *α*(*k*) ≤ *i* ≤ *ω*(*k*) − 1, 1 ≤ *j* ≤ *m yvijk* ∈ {0, 1} *k* ∈ *L*, *ω*(*k*) ≤ *i* ≤ *<sup>α</sup>*(*k*), 1 ≤ *j* ≤ *m yhijk* ∈ {0, 1} *k* ∈ *L*, *ω*(*k*) + 1 ≤ *i* ≤ *<sup>α</sup>*(*k*), 1 ≤ *j* ≤ *m z* ∈ R (16)

**Figure 2.** The integer linear programming formulation of FQRP-G (ILP).

The objective is to find the minimum of *z*. Finally, constraints (16) set variables *x* and *y* as binary and variable *z* real. Notice that *z* integrality follows, by (14), (15) and the objective function (5), from integrality of *xh* and *yh*. Moreover, even *x<sup>v</sup>* and *yv* could be defined as continuous, since their integrality follows from the one of *xh* and *yh* by (6), (7), (9) and (10).

We remark that the proposed ILP model describes, for each vehicle, a static flow on the grid network, since no time component is required to define both the decision variables and the constraints, in view of the conditions devised in Section 3.1 to bound the set of possible collision points. This is different from the mathematical programming formulations presented in, e.g., [25], where flows are defined on a time-expanded network, or [37], where the impact of the flow on different rhythmic routing intervals has to be considered. As a consequence, the size of ILP, in terms of the number of both variables and constraints, is considerably smaller than the corresponding formulations presented in previous literature, with benefits for the required solution time.
