Flexible and Explainable Solutions for Multi-Agent Path Finding Problems

by   Aysu Bogatarkan, et al.
Sabancı University

The multi-agent path finding (MAPF) problem is a combinatorial search problem that aims at finding paths for multiple agents (e.g., robots) in an environment (e.g., an autonomous warehouse) such that no two agents collide with each other, and subject to some constraints on the lengths of paths. The real-world applications of MAPF require flexibility (e.g., solving variations of MAPF) as well as explainability. In this study, both of these challenges are addressed and some flexible and explainable solutions for MAPF and its variants are introduced.


page 2

page 3

page 6


Explanation Generation for Multi-Modal Multi-Agent Path Finding with Optimal Resource Utilization using Answer Set Programming

The multi-agent path finding (MAPF) problem is a combinatorial search pr...

Conflict-Based Search for Explainable Multi-Agent Path Finding

In the Multi-Agent Path Finding (MAPF) problem, the goal is to find non-...

Coordinated Multi-Agent Pathfinding for Drones and Trucks over Road Networks

We address the problem of routing a team of drones and trucks over large...

Graph-Based Multi-Robot Path Finding and Planning

Purpose of Review Planning collision-free paths for multiple robots is...

Symmetry Breaking for k-Robust Multi-Agent Path Finding

During Multi-Agent Path Finding (MAPF) problems, agents can be delayed b...

winPIBT: Extended Prioritized Algorithm for Iterative Multi-agent Path Finding

Providing agents with efficient paths so as not to collide with each oth...

Overview: Generalizations of Multi-Agent Path Finding to Real-World Scenarios

Multi-agent path finding (MAPF) is well-studied in artificial intelligen...

1 Introduction

Artificial Intelligence (AI) applications are being used widely among people with different background and interests. For these applications to be successful, two of the important features (and challenges) needed by AI methods are flexibility and explainability. A flexible AI method developed to solve a problem can accommodate variations of the problem, and thus can be used to investigate different options for a better understanding. An explainable AI method can provide answers to queries about the (in)feasibility and the optimality of solutions. One of the well-studied problems in AI that necessitates solutions for these two challenges is the multi-agent path finding (MAPF) problem.

MAPF problem aims to find plans for multiple agents in an environment without colliding with each other or obstacles, subject to some constraints on the maximum or the total plan length. Optimal solutions for MAPF can be found by optimizing the makespan of the whole plan or the total plan length of agents. These optimization functions can be extended according to the needs of an application. While single-agent shortest pathfinding can be solved in polynomial time [7], MAPF with constraints on plan lengths is intractable [18]. MAPF has been studied in various domains, such as robotics [12], traffic control [8], video games [20], autonomous aircraft towing vehicles [16], and autonomous warehouse systems [21].

This study focuses on finding flexible frameworks for MAPF and its variants and an explainable framework for one of these variants of MAPF. In all of these solutions, Answer Set Programming (ASP) [14, 17, 13, 5, 6]

—a logic programming paradigm based on answer sets 

[11, 10] is utilized.

For some real-world applications, being able to solve MAPF problem may not be enough to address all challenges or the realistic conditions of the application. For instance, in real-world automated warehouses, the robots’ battery levels change as they travel around and it may be necessary for them to be charged to complete their tasks. Furthermore, some parts of the warehouses (for instance with human occupants or tight passages) may require robots to move slowly to ensure safety. In a warehouse that is not completely autonomous, some changes may occur during the execution of a plan: existing agents may leave the environment, or new agents may be included in the team with new tasks, existing obstacles may be removed from the environment or moved to some other location in the environment. One aim of our study is to address these issues with with flexible frameworks in the spirit of elaboration tolerance [15].

We also investigate the challenge of explainability for one of these problems, in particular, considering queries about the (in)feasibility and the optimality of solutions, as well as queries about the observations about these solutions. Given a solution for a general variation of MAPF, our explainable framework is able to explain infeasibility or nonoptimality of this solution, confirm its feasibility and suggest alternatives for the solution, and provide explanations for some queries.

2 Flexible Solutions for MAPF: Current Status

Let us describe our contributions and current status of our research on flexible frameworks for MAPF.

2.1 Multi-Modal Multi-Agent Path Finding

In real-world automated warehouses, the robots’ battery levels change as they move around, and, in some parts of these warehouses, due to presence of humans or tight passages, the robots may need to move slowly to ensure safety. Hence, to be able to handle more realistic autonomous warehouse scenarios, a mathematical model general enough to handle multi-modal transportation conditions and multi-objective optimizations is needed. Furthermore, the computational framework is required to be flexible such that a large set of variations of MAPF problems can be addressed. Motivated by these challenges, we mathematically modelled a general version of MAPF (called mMAPF– multi-modal MAPF with resources) as a rich graph problem and introduced a flexible method to solve mMAPF declaratively, using ASP [3]. We have implemented our framework using the ASP solver Clingo [9]. Our method can handle the following variations of MAPF: multi-objective optimization, waypoints, resource constraints and multi-modal transportation.

Figure 1 shows an example mMAPF scenario introduced in our earlier studies [3]. In this example, the warehouse consists of three shelf units denoted as obstacles (black cells). The charging stations are located at cells 24 and 27 highlighted by yellow, and the corridor where the agents should go slowly, covers cells 3–8 highlighted by red. In this area, it takes 2 timesteps to move from one cell to its neighbor. The maximum battery level is set to 10. Robot A1 starts with an initial battery level of 10, while robot A2 has an initial battery level of 8. Each robot wants to collect some items on its way (denoted by stars that match the color of the relevant robot) and to deliver these items to the opposite corner of the warehouse. Therefore, eventually, they want to swap their places.

Figure 1: An mMAPF instance. Initially, robot A1 is located at cell 1 and robot A2 is located at cell 30. The goal of A1 is to deliver some items to cell 30, while the goal of A2 is to deliver some items to cell 1. Each robot’s waypoints are shown by stars with the same color as that robot.

A solution for this mMAPF instance is shown by the colored paths in Figure 2. Note that each robot visits its waypoints on the way to the goal. The traversals of these paths (i.e. location of each robot in each timestep) are shown in Table 2.1. The traversal of each slow edge (e.g., A2 moving from cell 6 to 5) takes two timesteps. The battery levels of the robots are also shown in this table. The battery level decreases at each time step, unless a robot is at a charging station. The battery level gets to its maximum when robots decide to charge while at a charging station. For instance, A2’s battery level increases to 10 when the charging station at cell 27 is visited.

Figure 2: A solution for the mMAPF instance shown in Figure 1. A1 follows the blue path while A2 follows the green path to reach their goals, ensuring they collect items at their waypoints.
Time 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
Location 1 2 3 transit 4 14 24 25 26 27 17 7 transit 8 9 10 20 30
Battery 10 9 8 7 6 5 4 3 2 1 10 9 8 7 6 5 4 3
Location 30 29 28 27 17 7 transit 6 transit 5 transit 4 14 24 23 22 21 11 1
Battery 8 7 6 5 10 9 8 7 6 5 4 3 2 1 10 9 8 7 6

Details of the mathematical model and the ASP formulation can be found in our paper, Multi-Modal Multi-Agent Path Finding with Optimal Resource Utilization [3].

2.2 Dynamic Multi-Agent Path Finding

Another flexible framework introduced was an algorithm for MAPF in dynamic environments. When changes occur in a dynamic environment, such as obstacles being removed or moved, existing agents leaving the environment or new agents being added to the team, the aim is to find a new solution for the new team of agents in the modified environment. We call this problem Dynamic Multi-Agent Path Finding Problem (D-MAPF[4].

One of the possible solutions for D-MAPF is replanning: consider a new MAPF instance defined by the current locations and goal locations of both the existing and the new agents, and the updated environment, and compute a solution for this instance. Although replanning finds a solution, if one exists, it does not re-use the plans of the existing agents and may not be computationally efficient.

With this motivation, we proposed a novel method to solve D-MAPF, using Answer Set Programming (ASP) . The main idea (and novelty) of this method is, instead of replanning for all the agents right away, to revise and augment the existing MAPF solution: (revise) try to schedule the waiting times of existing agents as they traverse the rest of their paths, (augment) while computing paths for the new agents within a given makespan (i.e., the length of the plan). In this way, the paths for the existing agents can be re-used as part of the new plan. We have implemented our framework using Python and the ASP solver Clingo. In our experimental evaluations, we observed that the re-use of plans as proposed by our method improves the computational efficiency in timings significantly compared to replanning.

Figures 36 present an example (from our earlier studies [4]) to illustrate the overall idea of our D-MAPF algorithm.

Figure 3: Initially, two agents are at and ; their goals are to reach and .
Figure 4: A solution to MAPF instance described in Fig. 3: starts at 1, moves to 2, 3, 6, and reaches 9; and starts at 3, moves to 6, 5, 4, reaches 7.
Figure 5: While executing the plan shown in Fig. 4, at time step , another agent joins the team with goal . A solution to this D-MAPF instance is computed, and a path for is found, as shown above: is at 2, moves to 3, 6, 9; is at 6, moves to 5, 4, 7; starts at 9, moves to 6, 5, 2.
Figure 6: While executing the plan shown in Fig. 5, at time step , another agent joins the team with goal . A solution to this D-MAPF instance is computed, no solution found makespan , so the makespan is increased by 1. The new solution with makespan is found by scheduling the waiting times of , and , and by computing a plan for , as shown above: is at 3, waits at 3, then moves to 6,9; is at 5, waits at 5, then moves to 4,7; is at 6, waits at 6, then moves to 5,2; starts at 7, moves to 4, 1, and waits at 1.

The problem definition, ASP formulation, algorithm and experimental evaluations are described in detail in our paper A Declarative Method for Dynamic Multi-Agent Path Finding [4].

3 Explainable Solutions for MAPF: Current Status

We also investigate the challenge of explainability for mMAPF problems, considering queries about the (in)feasibility and the optimality of solutions, along with queries about observations about these solutions. For instance, suppose that an mMAPF solution is being executed in a warehouse and an engineer in this warehouse would like to check whether some modifications of this mMAPF solution would still be feasible or not.

  • Explaining infeasibility or nonoptimality. Suppose that the modified solution is found infeasible, then, an explanation regarding infeasibility of this modified solution could be “due to collisions with obstacles or other robots” or “due to low battery-level”. An explanation regarding nonoptimality of the modified solution could be “because some more time is needed to complete tasks” or “because some more charging is required”.

  • Confirming feasibility and suggesting alternatives. Suppose that the modified solution is found feasible. Furthermore, a better solution is computed (e.g., where the tasks are completed earlier). Then, in addition to confirming that the plan is feasible, alternative solutions could be provided to the engineer.

In an alternative scenario, suppose that the engineer would like to better understand the mMAPF solution being executed in the warehouse, and asks various queries about it. For such queries, it is useful to generate explanations using counterfactuals.

  • Explaining why an agent is waiting too long at a location. Suppose that the engineer observes that the agent is waiting for a while at some location, and she wants to know why. An explanation could be that “if the agent does not wait at that location for a while, it will collide with another robot.” Alternatively, an explanation could be “actually, there is no need for the agent to wait there so long, but it needs to follow a different itinerary such as … to complete tasks on time” or “actually, there is no need for the agent to wait there so long, but it needs to follow a different itinerary such as … and will be late a bit.”

Such queries and explanations would help the engineer to better understand the strengths and weaknesses of the solution being executed, as well as the limitations of the infrastructure.

With these motivating real life scenarios, we introduced a method to generate explanations for a variety of queries about mMAPF solutions, using the expressive formalism and efficient solvers of ASP [2]. Our explainable framework is implemented using Python and the ASP solver Clingo.

An Example Scenario for a Query About Waiting

Time A1 Location A2 Location
0 11 8
1 7 8
2 6 7
3 5 6
4 - 2
Time A1 Location A2 Location
0 11 8
1 11 7
2 7 6
3 6 2
4 5 -
(a) (b) (c)
Figure 7: (a) A1 and A2 denote the initial positions of Robots 1 and 2; A1 and A2 denote goal locations. Cell 7 is a waypoint for both robots, (b) and (c) are two optimal plans for this instance.

Consider the mMAPF instance (Scenario 1 of [2]) shown in Figure 7(a) in a small warehouse, where Robot 1 is initially located at Cell 11 and aims to reach Cell 5, and Robot 2 is initially located at Cell 8 and aims to reach Cell 2. Cell 7 is a waypoint for both robots, and the upper bound on makespan of a plan is 4. For simplicity, suppose that the batteries of the robots are fully charged initially, and sufficient for execution of any given plan, and that all edges have the normal mode of transportation.

About Plan 1 described in Figure 7(b), suppose that an engineer asks the following query:

“Why does Robot 2 wait at Cell 8 (at any time)?”

Our algorithm checks whether there is an optimal plan where Robot 2 does not have to wait initially.

Once an alternative solution, Plan 2 described in Figure 7(c), is found, our algorithm presents the following explanation:

“Actually, Robot 2 does not have to wait at Cell 8 from time step 0 to 2. Here is an alternative optimal plan: Plan 2…”

An Example Scenario for Nonexistence of Solutions Query

Figure 8: Robots 1 and 2 are initially located at the given positions on the grid; the goal of each robot is the initial location of the other. Black cells are obstacles.

Consider the instance (Scenario 6 of [2]) in Figure 8(b). Robots 1–2 are initially located at and ; their goals are at and , respectively. Black cells denote obstacles. For simplicity, we assume that their batteries are initially fully charged and enough to traverse all of their paths, all edges have normal mode of transportation, and the only waypoint of each robot is located at its initial position.

There is no solution for this mMAPF instance. Suppose that an engineer wants to find out the reason and asks the following query:

“Why does not the instance have a solution?”

The algorithm generates the following explanation:

“There is no solution because Robot 1 and Robot 2 collide at Cell 8 at time step 3.”

The algorithm further generates the following explanation:

“There is no solution because Robot 2 collides with the obstacle at Cell 2 at time step 1; this suggests removing this obstacle.”

Details of the algorithm and the ASP formulations, together with more examples and experimental evaluations are presented in our paper, Explanation Generation for Multi-Modal Multi-Agent Path Finding with Optimal Resource Utilization using Answer Set Programming [2].

4 Discussions and Future Work

We have introduced flexible and explainable frameworks for MAPF problem, addressing different challenges. While mMAPF focuses on a flexible framework considering resource optimization and multi-modality, D-MAPF considers dynamic changes in the environment. In addition to these frameworks, an explainable framework for mMAPF is also introduced, generating explanations about feasibility and optimality about given mMAPF solutions along with some observations or suggestions, via queries and counterfactual reasoning. For all these frameworks, we contributed the literature with publications. We have also developed an educational multi-robot system to apply MAPF with robots [19].

Currently, we are working on applying these frameworks on some real-world applications in collaboration with a logistics company. We are also working on improving our methods introduced for D-MAPF [4] and mMAPF [3], extend their experimental evaluations and we aim to publish journal articles for our improved methods.


I would like to thank Prof. Esra Erdem (Sabanci Universitys, Computer Science and Engineering) and Prof. Volkan Patoglu (Sabanci University, Mechatronics Engineering) for their supervision in this research, Dr. Orkunt Sabuncu (TED University, Computer Engineering) and Dr. Alexander Kleiner (Robert Bosch GmbH, Corporate Research) for useful discussions, and the anonymous reviewers for their comments and suggestions. This work is supported by Tubitak Grant 118E931.


  • [1]
  • [2] Aysu Bogatarkan & Esra Erdem (2020): Explanation Generation for Multi-Modal Multi-Agent Path Finding with Optimal Resource Utilization using Answer Set Programming. Theory Pract. Log. Program. 20(6), pp. 974–989, doi:10.1017/S1471068420000320. Available at https://arxiv.org/abs/2008.03573.
  • [3] Aysu Bogatarkan, Esra Erdem, Alexander Kleiner & Volkan Patoglu (2020): Multi-modal Multi-agent Path Finding with Optimal Resource Utilization. In: Proceedings of 5th International Conference on the Industry 4.0 Model for Advanced Manufacturing, pp. 313–324, doi:10.1007/978-3-030-46212-3_24.
  • [4] Aysu Bogatarkan, Volkan Patoglu & Esra Erdem (2019): A Declarative Method for Dynamic Multi-Agent Path Finding. In: Proceedings of the 5th Global Conference on Artificial Intelligence, pp. 54–67, doi:10.29007/cnzw.
  • [5] Gerhard Brewka, Thomas Eiter & Miroslaw Truszczynski (2011): Answer set programming at a glance. ACM Commununications 54(12), pp. 92–103, doi:10.1145/2043174.2043195.
  • [6] Gerhard Brewka, Thomas Eiter & Miroslaw Truszczynski (2016): Answer Set Programming: An Introduction to the Special Issue. AI Magazine 37(3), pp. 5–6, doi:10.1609/aimag.v37i3.2669.
  • [7] Edsger W. Dijkstra (1959): A Note on Two Problems in Connexion with Graphs. Numer. Math. 1(1), pp. 269–271, doi:10.1007/BF01386390.
  • [8] Kurt M. Dresner & Peter Stone (2008): A Multiagent Approach to Autonomous Intersection Management. J. Artif. Intell. Res. (JAIR) 31, pp. 591–695, doi:10.1613/jair.2502.
  • [9] Martin Gebser, Benjamin Kaufmann, Roland Kaminski, Max Ostrowski, Torsten Schaub & Marius Schneider (2011): Potassco: The Potsdam Answer Set Solving Collection. AI Commun. 24(2), p. 107–124, doi:10.5555/1971622.1971623.
  • [10] Michael Gelfond & Vladimir Lifschitz (1988): The stable model semantics for logic programming. In: Proceedings of International Logic Programming Conference and Symposium, pp. 1070–1080.
  • [11] Michael Gelfond & Vladimir Lifschitz (1991): Classical negation in logic programs and disjunctive databases. New Generation Computing 9, pp. 365–385, doi:10.1007/BF03037169.
  • [12] Jae-Yeong Lee & Wonpil Yu (2009): A coarse-to-fine approach for fast path finding for mobile robots. In: Proc. of IROS, pp. 5414–5419, doi:10.1109/IROS.2009.5354686.
  • [13] Vladimir Lifschitz (2002): Answer set programming and plan generation. Artificial Intelligence 138, pp. 39–54, doi:10.1016/S0004-3702(02)00186-8.
  • [14] Victor Marek & Mirosław Truszczyński (1999): Stable models and an alternative logic programming paradigm. In: The Logic Programming Paradigm: a 25-Year Perspective, Springer Verlag, pp. 375–398, doi:10.1007/978-3-642-60085-2_17.
  • [15] John McCarthy (1998): Elaboration Tolerance. In: Proc. of CommonSense.
  • [16] Robert Morris, Corina S. Pasareanu, Kasper Søe Luckow, Waqar Malik, Hang Ma, T. K. Satish Kumar & Sven Koenig (2016): Planning, Scheduling and Monitoring for Airport Surface Operations. In: Planning for Hybrid Systems, Papers from AAAI Workshop.
  • [17] Ilkka Niemelä (1999): Logic programs with stable model semantics as a constraint programming paradigm. Annals of Mathematics and Artificial Intelligence 25, pp. 241–273, doi:10.1023/A:1018930122475.
  • [18] Daniel Ratner & Manfred K. Warmuth (1986): Finding a Shortest Solution for the N N Extension of the 15-PUZZLE Is Intractable. In: Proc. of AAAI, pp. 168–172.
  • [19] Emre Hilmi Songur, Aysu Bogatarkan, Farukhzhon Barotov, Batuhan Yildirim, Gokay Coruhlu, Esra Erdem & Volkan Patoglu (2019): Cok-etmenli yorunge bulma probleminin lego robotlarinda uygulanmasi: bir egitsel robotik calismasi. In: 5. Türkiye Robotbilim Konferansı (TORK 2019), Ozyegin Universitesi Yayinlari, pp. 172–177. Available at https://tork2019.ozyegin.edu.tr/sites/default/files/tork2019_r1.pdf.
  • [20] Trevor Scott Standley & Richard E. Korf (2011): Complete Algorithms for Cooperative Pathfinding Problems. In: Proc. of IJCAI, pp. 668–673, doi:10.5591/978-1-57735-516-8/IJCAI11-118.
  • [21] Peter R. Wurman, Raffaello D’Andrea & Mick Mountz (2008): Coordinating Hundreds of Cooperative, Autonomous Vehicles in Warehouses. AI Magazine 29(1), pp. 9–20, doi:10.1609/aimag.v29i1.2082.