
Proceedings of the Twelfth International Symposium on Combinatorial Search (SoCS 2019) Finding Optimal Longest Paths by Dynamic Programming in Parallel Kai Fieger,1 Toma´sˇ Balyo,1 Christian Schulz,2 Dominik Schreiber1 1Karlsruhe Institute of Technology Karlsruhe, Germany 2University of Vienna, Faculty of Computer Science Vienna, Austria fi[email protected], [email protected], [email protected], [email protected] Abstract A subset of a graph’s vertices is called a clique if the graph contains an edge between every two distinct vertices of the We propose an exact algorithm for solving the longest sim- subset. A matching is a subset of the edges of a graph where ple path problem between two given vertices in undirected no two edges have any vertex in common. A sequence of weighted graphs. By using graph partitioning and dynamic s →···→t programming, we obtain an algorithm that is significantly vertices such that each pair of consecutive ver- faster than other state-of-the-art methods. This enables us to tices is connected by an edge, is called an s-t path. We say solve instances that were previously unsolved and solve hard that s is the source and t is the target. A path is called simple instances significantly faster. Lastly, we present a scalable if it does not contain a vertex more than once. The length of parallelization which yields the first efficient parallel algo- a path is defined by the sum of its edge weights. If the graph rithm for the problem. is unweighted, then edge weights are assumed to be one. Given a graph G =(V,E,ω) as well as two vertices s, t ∈ V 1 Introduction , the longest path (LP) problem is to find the longest simple path from s to t. Another version of the LP problem The longest path problem (LP) is to find a simple path (each is to find the overall longest simple path in the graph. How- vertex visited at most once) of maximum length between ever, the problem can be solved by introducing two vertices two given vertices of a graph, where length is defined as s, t, connecting them to all other vertices in the graph by the number of edges or the total weight of the edges in the edges of weight zero and then running algorithms tackling path. The problem is known to be NP-complete (Garey and the LP problem on the modified instance. Johnson 1979) and has several applications such as design- A k-way partition of a graph is a division of V into ing circuit boards (Ozdal and Wong 2006a; 2006b), project blocks of vertices B1,...,Bk, i.e. B1 ∪···∪Bk = V planning (Brucker 1995), information retrieval (Wong, Lau, and Bi ∩ Bj = ∅ for i = j.Abalancing constraint de- and King 2005) or patrolling algorithms for multiple robots |V | mands that ∀i ∈{1..k} : |B |≤Lmax := (1 + ) in graphs (Portugal and Rocha 2010). i k for some imbalance parameter . The objective is typi- In this paper we present the algorithm LPDP (Longest cally to minimize the total cut ω(E ) where E := Path by Dynamic Programming) and its parallel version. i<j ij ij {{u, v}∈E : u ∈ B ,v ∈ B } LPDP makes use of graph partitioning and dynamic pro- i j . gramming. Unlike many other approaches for NP-complete problems, LPDP is not an approximation algorithm – it finds 2.1 Related Work an optimal longest path. Through experiments we compare Previous work by Stern et al. (2014) mainly focuses on the LPDP to previous LP algorithms and evaluate the speedups possibility of applying algorithms that are usually used to achieved by the parallel algorithm. solve the shortest path problem (SP) to the longest path prob- lem. Stern et al. (2014) make clear why LP is so difficult 2 Preliminaries compared to SP. Several algorithms are presented that are frequently used to solve SP or other minimization search In the following we consider an undirected graph G = problems. They are modified in order to be able to solve LP. (V,E,ω) with (symmetric) edge weights ω : E → R≥0, The search algorithms are put into three categories: heuris- n = |V |, and m = |E|. We extend ω to sets, i.e., tic, uninformed and suboptimal. Each of the algorithms in ω(E ):= ω(e). N(v):={u : {v, u}∈E} denotes e∈E the first two categories yields optimal solutions to the prob- the neighbors of v.Asubgraph is a graph whose vertex and lem. The most relevant category for this paper is heuristic edge sets are subsets of another graph. We call a subgraph in- searches. Here, a heuristic can provide extra information duced if every edge among the included vertices is included. about the graph or the type of graph. Heuristic searches re- Copyright c 2019, Association for the Advancement of Artificial quire a heuristic function that estimates the remaining length Intelligence (www.aaai.org). All rights reserved. of a solution from a given vertex of the graph. This can 61 give important information helping to prune the search space 3 Longest Path by Dynamic Programming and to speed up the search. Stern et al. (2014) show that We now introduce the main contribution of our paper which heuristic searches can be used efficiently for the longest path is a new algorithm to tackle the longest path problem based problem. Some examples of algorithms in this category are on principles of dynamic programming. Hence, our algo- Depth-First-Branch-and-Bound (DFBnB) and A*. Another rithm is called “Longest Path by Dynamic Programming” category represents “uninformed” searches, which do not re- (LPDP). Our algorithm solves the longest path problem (LP) quire any information other than what is already given in the for weighted undirected graphs. definition of the problem. Examples from this category are Dijkstra’s algorithm or DFBnB without a heuristic. Modify- 3.1 Exhaustive Depth First Search ing these algorithms to fit LP basically leads to brute force algorithms, which means that they still have to look at every A simple way to solve the longest path problem is exhaustive possible path in the search space. Hence, these uninformed depth-first search (Stern et al. 2014). In regular depth-first search strategies are not very beneficial for LP. The last cat- search (DFS) a vertex has two states: marked and unmarked. egory are suboptimal searches. The authors looked at a large Initially, all vertices are unmarked. The search starts by call- number of these algorithms that only find approximations of ing the DFS procedure with a given vertex as a parameter. a longest path. This vertex is called the root. The current vertex (the param- A similar problem to LP called Snake in the Box (SIB) eter of the current DFS call) is marked and then the DFS is the problem of finding the longest simple path in an n- procedure is recursively executed on each unmarked vertex dimensional hypercube. Additionally to the constraint of not reachable by an edge from the current vertex. The current allowing repeated vertices in the path it is required that for vertex is called the parent of these vertices. Once the recur- any two vertices u, v there is no edge between u and v un- sive DFS calls are finished we backtrack to the parent vertex. less u and v are adjacent in the path. Heuristic search LP The search is finished once DFS backtracks from the root. algorithms can be adapted to efficiently solve SIB (Palombo et al. 2015) by designing SIB specific heuristics. However, Search exhaustiveDFS(v) these techniques cannot be transferred to solving the general if v is unmarked then LP problem since they rely on SIB specific heuristics and mark v; therefore these results are not relevant for our work. foreach {v, w}∈E do w The LP problem is related to the Traveling Salesper- exhaustiveDFS( ); son Problem (TSP), which is a very well studied prob- end v lem. There exist several exact algorithms and solvers for unmark ; TSP, such as the Integer Linear Programming based exact end solver Concorde (Applegate et al. 1994). TSP problems can Algorithm 1: Exhaustive depth first search. In order to be solved by translating them into LP problems and using solve LP we start this search from the start node and up- an LP solver (Hardgrave and Nemhauser 1962). The trans- date the best found solution each time the (unmarked) lation is very efficient since it only adds one new vertex target node is found. and at most n new edges, where n is the number of ver- tices of the TSP problem. This raises the question if we can solve TSP problems faster by using our new algorithm Exhaustive DFS is a DFS that unmarks a vertex upon (after translating them to LP) than the state of the art TSP backtracking. In that way every simple path in the graph solver Concorde (Applegate et al. 1994). If we consider the starting from the root vertex is explored. The LP problem standard TSP benchmark problems, i.e., the TSPLib collec- can be solved with exhaustive DFS by using the start ver- tion (Reinelt 1991), the answer is no. The reason is that all tex as root. During the search the length of the current path the TSPLib benchmark problems are cliques and they re- is stored and compared to the previous best solution each main cliques after translating them to LP (Hardgrave and time the target vertex is reached. If the current length is Nemhauser 1962). This is very unfortunate, since our algo- greater than that of the best solution, it is updated accord- rithm relies on graph partitioning, which is not very help- ingly.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages9 Page
-
File Size-