Analysis of Dijkstra's and A* Algorithm to Find The

Total Page:16

File Type:pdf, Size:1020Kb

Analysis of Dijkstra's and A* Algorithm to Find The ANALYSIS OF DIJKSTRA’S AND A* ALGORITHM TO FIND THE SHORTEST PATH AMANI SALEH ALIJA A thesis submitted in fulfillment of the requirements for the award of the Degree of Master of Computer Science (Software Engineering) Faculty of Computer Science and Information Technology Universiti Tun Hussein Onn Malaysia SEPTEMBER, 2015 v ABSTRACT There are so many algorithms used to find the shortest path such as Dijkstra, A* algorithm, Genetic algorithm, Floyd algorithm and Ant algorithm. In this study, two algorithms will be focused on. This study compares the Dijkstra’s, and A* algorithm to estimate search time and distance of algorithms to find the shortest path. It needs the appropriate algorithm to search the shortest path. Therefore, the purpose of this research is to explore which is the best shortest path algorithm by comparing the two types of algorithms. Such that it can be used to solve the problem path, search to analyze their efficiency in an environment based on two dimensional matrix which is best because of lookup time. This study implements the algorithm in visual C++ 2008 and design interface for the algorithms that allow the user to find the shortest path with the search time and the distance by determine the size of map, starting node and the destination node. The experimental result showed the search time of A* algorithm is faster than Dijkstra’s algorithm with average value 466ms and the distance is same of the both of algorithms. vi ABSTRAK Terdapat banyak algoritma yang digunakan untuk mencari laluan terpendek seperti Dijkstra dan algoritma A*, algoritma genetic, algoritma Floyd dan algoritma Ant. Untuk kajian ini, dua jenis algoritma akan ditekankan. Kajian ini akan membandingkan masa carian daripada Dijkstra dan algoritma A * untuk mengetahui algoritma yang paling pantas apabila mencari laluan terpendek. Ia perlu algoritma yang sesuai untuk mencari laluan terpendek. Oleh itu, tujuan kajian ini adalah untuk meneroka laluan algoritma terpendek yang terbaik dengan membandingkan dua jenis algoritma yang boleh digunakan untuk menyelesaikan masalah laluan carian untuk dianalisa kecekapannya. Lingkungan berdasarkan matriks dua dimensi adalah yang terbaik oleh kerana masa pencariannya. Kajian ini akan menggunakan algoritma visual C++ 2008 dan reka bentuk antaramuka untuk algoritma yang membolehkan pengguna untuk mencari laluan terpendek dengan carian masa dan jarak dengan menentukan saiz peta, nod permulaan dan destinasi nod.Keputusan experimental menunjukkan carian masa bagi algoritma A* adalah lebih pantas daripada algoritma Djikstra dengan nilai purata 466ms dan mempunyai jarak yang sama. Bagi kebanyakkan komputer moden, memori tidak begitu penting, dan jika ia penting sekalipun, kawasan yang tidak digunakan boleh disembunyikan dan dimuaturun bila diperlukan. Untuk membandingkan jalan algoritma terpendek di antara dua algoritma yang digunakan, satu antaramuka telah direkabentuk. Ini adalah supaya perbandingan dapat ditentukan dan algortima yang mana yang lebih sesuai untuk mencari laluan terpendek. vii TABLE OF CONTENTS TITLE i DECLARATION ii DEDICATION iii ACKNOWLEDGEMENT iv ABSTRACT v ABSTRAK vi CONTENTS vii LIST OF TABLE x LIST OF FIGURES xi CHAPTER 1 1 INTRODUCTION 1 1.1 Background of study 1 1.2 Problem Statement 3 1.3 Objectives of the Research 3 1.4 Scope of Research 4 1.5 Motivation 4 1.6 Research Outline 4 CHAPTER 2 5 LITERATURE REVIEW 5 2.1 Introduction 5 2.2 Application Areas of Path Finding Algorithms 5 2.2.1 PFAs in Games and Virtual Tours 6 2.2.2 Robot Motion and Navigation 7 viii 2.2.3 Driverless Vehicles 8 2.2.4 Transportation Networks 10 2.2.5 Human Navigation 11 2.3 Shortest path analysis 14 2.4 Shortest path algorithm 14 2.4.1 Dijkstra’s algorithm 15 2.4.2 Depth-first search algorithm 20 2.4.3 A* algorithm 20 2.4.3.1 Manhattan distance 23 2.4.3.2 Diagonal distance 25 2.4.3.3 Euclidean distance 25 2.5 Comparison of A* and Dijkstra’s 26 2.6 Review of the techniques 27 2.7 Summury 31 CHAPTER 3 32 RESEARCH METHODOLOGY 32 3.1 Introduction 32 3.2 The flow chart for the project work 32 3.2.2 Finding the shortest path using Dijkstra algorithm 35 3.2.2 Finding the shortest path using the A* algorithm 35 3.2.3 Compare the result 37 3.3 Summary 37 CHAPTER 4 38 PSEUDO CODE FOR THE AND IMPLEMENTATION 38 4.1 Introduction 38 4.2 Dijkstra's algorithm 38 4.2.1 Pseudo code for Dijkstra's algorithm 39 4.2.2 Implementation of Dijkstra's algorithm 40 4.3 A* algorithm 41 ix 4.3.1 Pseudo code for the A * algorithm 42 4.3.2 Implementation of A* algorithm 43 4.4 Summary 44 CHAPTER 5 45 RESULT AND DISCUSSION 45 5.1 Introduction 45 5.2 Comparative Analysis 45 5.3 Summary 50 CHAPTER 6 51 CONCLUSIONS 51 6.1 Objectives Achievement 51 6.2 Summary 51 6.3 Future Work 52 REFERENCES 53 VITA 56 APPENDIX I 57 x LIST OF TABLES 2.1 Difference between A* algorithm and Dijkstra’s algorithm 26 2.2 Comparison of finding path algorithm 30 5.1 Comparison between A* algorithm and Dijkstra’s algorithm in search time 50 xi LIST OF FIGURES 2.1 3D Model of latiff and Hassan 6 2.2 (a) Grid vs (b) Framed-Quadtreee approach in D* algorithm 8 2.3 Autonomuos vehicle used in D* algorithm test 9 2.4 Champion DARPA challenge race 2005 10 2.5 (a) Dijkstra’s search, (b)A* search on road network of Dallas Ft-Worth urban Area 11 2.6 Kulyukin’s Robotic Aid 12 2.7 Wearable interface for Finger-Braille 12 2.8 Drishti’s navigation system 13 2.9 Dijkstra’s search 16 2.10 First step of Dijkstra’s algorithm 16 2.11 Second step of Dijkstra’s algorithm 17 2.12 Third step of Dijkstra’s algorithm 17 2.13 Step 4 of Dijkstra’s algorithm 18 2.14 Fifth step of Dijkstra’s algorithm 18 2.15 Step6 of Dijkstra’s algorithm 19 2.16 Shortest path by Dijkstra’s algorithm 19 2.17 Starting and Destination point in A* algorithm 21 2.18 Starting the A* search algorithm 21 2.19 Putting the neighboring cells to the open list 22 xii 2.20 Parent relation of Starting Node 22 2.21 Manhattan distance calculation 24 2.22 Diagonal distance calculation 25 2.23 Euclidean distance calculation 26 2.24 Comparison between A* and Dijkstra’s algorithm 27 3.1 The Steps Involved in the project work 33 3.2 The flow chart of Dijkstra’s algorithm 34 3.3 The flow chart of A* algorithm 36 4.1 Pseudo-code of the dijkstra’s algorithm for the shortest path problem 39 4.2 Segmentation source code for Dijkstra’s algorithm 40 4.3 Interface of Dijkstra’s algorithm 41 4.4 Pseudo-code of the A* algorithm for the shortest path problem 42 4.5 Segmentation source code for A* algorithm 43 4.6 Interface of A* algorithm 44 5.1 Case1 of Comparison between A*algorithm and Dijkstra’s algorithm 6 5.2 Case2 of Comparison between A*algorithm and Dijkstra’s algorithm 47 5.3 Case3 of Comparison between A*algorithm and Dijkstra’s algorithm 48 5.4 Case4 of Comparison between A*algorithm and Dijkstra’s algorithm 49 CHAPTER 1 INTRODUCTION 1.1 Background of the Study Path finding is defined as the process of moving an object from its earlier position to the final position. Different application areas used Path Finding Algorithms (PFA). These include Games and Virtual Tours, Driverless Vehicles, Robot Motion and Navigation. Path finding is usually described as a process of finding a path between two points in a certain environment. In most cases the objective is to find the shortest path possible, which would be optimal i.e., the shortest, cheapest or simplest. Several criteria such as, path which imitates path chosen by a person, path which requires the lowest amount of fuel, or from two points A and B through point C is often found relevant in many path finding tasks. Finding the shortest path is the most difficult issue in many fields, starting with navigational systems, artificial intelligence and ending with computer simulations. Although these fields have their own specific algorithms, there are many general purpose path finding algorithms that are applied successfully. However, it remains unclear what benefits certain algorithm have in comparison with others. Shortest path algorithms are currently used widely. They are the basis of some problems such as network flow problems, tree problems and other related problems. They decide the minimum cost of travel of the problems production cycle, the shortest path in an electric circuit or the most reliable way. The internet is a vast field where the shortest path algorithm is usually applied. The Internet problems comprise data package transmissions with minimal time or using the most reliable path. 2 This research attempts to make an implementation of a shortest path algorithm by using A* algorithm and compare it with Dijkstra's algorithm on different criteria, including search time and the distance were implemented to analyze their efficiency in an environment based on 2 dimensional matrix. A* algorithm is an algorithm that is widely used in path finding and graph traversal. The process of plotting a resourcefully traversal path between points is called nodes. A* traverses the chart and follows the lowermost known path, keeping a sorted priority queue of alternate path sections along the system. If at any position, a segment of the path being traversed has a higher cost as compared to another encountered path segment, it leaves the higher-cost path segment and traverse low cost path segment instead this procedure continues until the goal is reached.
Recommended publications
  • Adversarial Search
    Adversarial Search In which we examine the problems that arise when we try to plan ahead in a world where other agents are planning against us. Outline 1. Games 2. Optimal Decisions in Games 3. Alpha-Beta Pruning 4. Imperfect, Real-Time Decisions 5. Games that include an Element of Chance 6. State-of-the-Art Game Programs 7. Summary 2 Search Strategies for Games • Difference to general search problems deterministic random – Imperfect Information: opponent not deterministic perfect Checkers, Backgammon, – Time: approximate algorithms information Chess, Go Monopoly incomplete Bridge, Poker, ? information Scrabble • Early fundamental results – Algorithm for perfect game von Neumann (1944) • Our terminology: – Approximation through – deterministic, fully accessible evaluation information Zuse (1945), Shannon (1950) Games 3 Games as Search Problems • Justification: Games are • Games as playground for search problems with an serious research opponent • How can we determine the • Imperfection through actions best next step/action? of opponent: possible results... – Cutting branches („pruning“) • Games hard to solve; – Evaluation functions for exhaustive: approximation of utility – Average branching factor function chess: 35 – ≈ 50 steps per player ➞ 10154 nodes in search tree – But “Only” 1040 allowed positions Games 4 Search Problem • 2-player games • Search problem – Player MAX – Initial state – Player MIN • Board, positions, first player – MAX moves first; players – Successor function then take turns • Lists of (move,state)-pairs – Goal test
    [Show full text]
  • Artificial Intelligence Spring 2019 Homework 2: Adversarial Search
    Artificial Intelligence Spring 2019 Homework 2: Adversarial Search PROGRAMMING In this assignment, you will create an adversarial search agent to play the 2048-puzzle game. A demo of ​ ​ the game is available here: gabrielecirulli.github.io/2048. ​ ​ I. 2048 As A Two-Player Game ​ II. Choosing a Search Algorithm: Expectiminimax ​ III. Using The Skeleton Code ​ IV. What You Need To Submit ​ V. Important Information ​ VI. Before You Submit ​ I. 2048 As A Two-Player Game 2048 is played on a 4×4 grid with numbered tiles which can slide up, down, left, or right. This game can ​ ​ be modeled as a two player game, in which the computer AI generates a 2- or 4-tile placed randomly on the board, and the player then selects a direction to move the tiles. Note that the tiles move until they either (1) collide with another tile, or (2) collide with the edge of the grid. If two tiles of the same number collide in a move, they merge into a single tile valued at the sum of the two originals. The resulting tile cannot merge with another tile again in the same move. Usually, each role in a two-player games has a similar set of moves to choose from, and similar objectives (e.g. chess). In 2048 however, the player roles are inherently asymmetric, as the Computer AI ​ ​ places tiles and the Player moves them. Adversarial search can still be applied! Using your previous experience with objects, states, nodes, functions, and implicit or explicit search trees, along with our skeleton code, focus on optimizing your player algorithm to solve 2048 as efficiently and consistently ​ ​ as possible.
    [Show full text]
  • Quantum Algorithms for Matching Problems
    Quantum Algorithms for Matching Problems Sebastian D¨orn Institut f¨urTheoretische Informatik, Universit¨atUlm, 89069 Ulm, Germany [email protected] Abstract. We present quantum algorithms for the following matching problems in unweighted and weighted graphs with n vertices and m edges: √ – Finding a maximal matching in general graphs in time O( nm log2 n). √ – Finding a maximum matching in general graphs in time O(n m log2 n). – Finding a maximum weight matching in bipartite graphs in time √ O(n mN log2 n), where N is the largest edge weight. – Finding a minimum weight perfect matching in bipartite graphs in √ time O(n nm log3 n). These results improve the best classical complexity bounds for the corre- sponding problems. In particular, the second result solves an open ques- tion stated in a paper by Ambainis and Spalekˇ [AS06]. 1 Introduction A matching in a graph is a set of edges such that for every vertex at most one edge of the matching is incident on the vertex. The task is to find a matching of maximum cardinality. The matching problem has many important applications in graph theory and computer science. In this paper we study the complexity of algorithms for the matching prob- lems on quantum computers and compare these to the best known classical algo- rithms. We will consider different versions of the matching problems, depending on whether the graph is bipartite or not and whether the graph is unweighted or weighted. For unweighted graphs, the best classical algorithm for finding a match- ing of maximum√ cardinality is based on augmenting paths and has running time O( nm) (see Micali and Vazirani [MV80]).
    [Show full text]
  • Best-First and Depth-First Minimax Search in Practice
    Best-First and Depth-First Minimax Search in Practice Aske Plaat, Erasmus University, [email protected] Jonathan Schaeffer, University of Alberta, [email protected] Wim Pijls, Erasmus University, [email protected] Arie de Bruin, Erasmus University, [email protected] Erasmus University, University of Alberta, Department of Computer Science, Department of Computing Science, Room H4-31, P.O. Box 1738, 615 General Services Building, 3000 DR Rotterdam, Edmonton, Alberta, The Netherlands Canada T6G 2H1 Abstract Most practitioners use a variant of the Alpha-Beta algorithm, a simple depth-®rst pro- cedure, for searching minimax trees. SSS*, with its best-®rst search strategy, reportedly offers the potential for more ef®cient search. However, the complex formulation of the al- gorithm and its alleged excessive memory requirements preclude its use in practice. For two decades, the search ef®ciency of ªsmartº best-®rst SSS* has cast doubt on the effectiveness of ªdumbº depth-®rst Alpha-Beta. This paper presents a simple framework for calling Alpha-Beta that allows us to create a variety of algorithms, including SSS* and DUAL*. In effect, we formulate a best-®rst algorithm using depth-®rst search. Expressed in this framework SSS* is just a special case of Alpha-Beta, solving all of the perceived drawbacks of the algorithm. In practice, Alpha-Beta variants typically evaluate less nodes than SSS*. A new instance of this framework, MTD(ƒ), out-performs SSS* and NegaScout, the Alpha-Beta variant of choice by practitioners. 1 Introduction Game playing is one of the classic problems of arti®cial intelligence.
    [Show full text]
  • General Branch and Bound, and Its Relation to A* and AO*
    ARTIFICIAL INTELLIGENCE 29 General Branch and Bound, and Its Relation to A* and AO* Dana S. Nau, Vipin Kumar and Laveen Kanal* Laboratory for Pattern Analysis, Computer Science Department, University of Maryland College Park, MD 20742, U.S.A. Recommended by Erik Sandewall ABSTRACT Branch and Bound (B&B) is a problem-solving technique which is widely used for various problems encountered in operations research and combinatorial mathematics. Various heuristic search pro- cedures used in artificial intelligence (AI) are considered to be related to B&B procedures. However, in the absence of any generally accepted terminology for B&B procedures, there have been widely differing opinions regarding the relationships between these procedures and B &B. This paper presents a formulation of B&B general enough to include previous formulations as special cases, and shows how two well-known AI search procedures (A* and AO*) are special cases o,f this general formulation. 1. Introduction A wide class of problems arising in operations research, decision making and artificial intelligence can be (abstractly) stated in the following form: Given a (possibly infinite) discrete set X and a real-valued objective function F whose domain is X, find an optimal element x* E X such that F(x*) = min{F(x) I x ~ X}) Unless there is enough problem-specific knowledge available to obtain the optimum element of the set in some straightforward manner, the only course available may be to enumerate some or all of the elements of X until an optimal element is found. However, the sets X and {F(x) [ x E X} are usually tThis work was supported by NSF Grant ENG-7822159 to the Laboratory for Pattern Analysis at the University of Maryland.
    [Show full text]
  • Trees, Binary Search Trees, Heaps & Applications Dr. Chris Bourke
    Trees Trees, Binary Search Trees, Heaps & Applications Dr. Chris Bourke Department of Computer Science & Engineering University of Nebraska|Lincoln Lincoln, NE 68588, USA [email protected] http://cse.unl.edu/~cbourke 2015/01/31 21:05:31 Abstract These are lecture notes used in CSCE 156 (Computer Science II), CSCE 235 (Dis- crete Structures) and CSCE 310 (Data Structures & Algorithms) at the University of Nebraska|Lincoln. This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License 1 Contents I Trees4 1 Introduction4 2 Definitions & Terminology5 3 Tree Traversal7 3.1 Preorder Traversal................................7 3.2 Inorder Traversal.................................7 3.3 Postorder Traversal................................7 3.4 Breadth-First Search Traversal..........................8 3.5 Implementations & Data Structures.......................8 3.5.1 Preorder Implementations........................8 3.5.2 Inorder Implementation.........................9 3.5.3 Postorder Implementation........................ 10 3.5.4 BFS Implementation........................... 12 3.5.5 Tree Walk Implementations....................... 12 3.6 Operations..................................... 12 4 Binary Search Trees 14 4.1 Basic Operations................................. 15 5 Balanced Binary Search Trees 17 5.1 2-3 Trees...................................... 17 5.2 AVL Trees..................................... 17 5.3 Red-Black Trees.................................. 19 6 Optimal Binary Search Trees 19 7 Heaps 19
    [Show full text]
  • Lecture 18 Solving Shortest Path Problem: Dijkstra's Algorithm
    Lecture 18 Solving Shortest Path Problem: Dijkstra’s Algorithm October 23, 2009 Lecture 18 Outline • Focus on Dijkstra’s Algorithm • Importance: Where it has been used? • Algorithm’s general description • Algorithm steps in detail • Example Operations Research Methods 1 Lecture 18 One-To-All Shortest Path Problem We are given a weighted network (V, E, C) with node set V , edge set E, and the weight set C specifying weights cij for the edges (i, j) ∈ E. We are also given a starting node s ∈ V . The one-to-all shortest path problem is the problem of determining the shortest path from node s to all the other nodes in the network. The weights on the links are also referred as costs. Operations Research Methods 2 Lecture 18 Algorithms Solving the Problem • Dijkstra’s algorithm • Solves only the problems with nonnegative costs, i.e., cij ≥ 0 for all (i, j) ∈ E • Bellman-Ford algorithm • Applicable to problems with arbitrary costs • Floyd-Warshall algorithm • Applicable to problems with arbitrary costs • Solves a more general all-to-all shortest path problem Floyd-Warshall and Bellman-Ford algorithm solve the problems on graphs that do not have a cycle with negative cost. Operations Research Methods 3 Lecture 18 Importance of Dijkstra’s algorithm Many more problems than you might at first think can be cast as shortest path problems, making Dijkstra’s algorithm a powerful and general tool. For example: • Dijkstra’s algorithm is applied to automatically find directions between physical locations, such as driving directions on websites like Mapquest or Google Maps.
    [Show full text]
  • Parallel Technique for the Metaheuristic Algorithms Using Devoted Local Search and Manipulating the Solutions Space
    applied sciences Article Parallel Technique for the Metaheuristic Algorithms Using Devoted Local Search and Manipulating the Solutions Space Dawid Połap 1,* ID , Karolina K˛esik 1, Marcin Wo´zniak 1 ID and Robertas Damaševiˇcius 2 ID 1 Institute of Mathematics, Silesian University of Technology, Kaszubska 23, 44-100 Gliwice, Poland; [email protected] (K.K.); [email protected] (M.W.) 2 Department of Software Engineering, Kaunas University of Technology, Studentu 50, LT-51368, Kaunas, Lithuania; [email protected] * Correspondence: [email protected] Received: 16 December 2017; Accepted: 13 February 2018 ; Published: 16 February 2018 Abstract: The increasing exploration of alternative methods for solving optimization problems causes that parallelization and modification of the existing algorithms are necessary. Obtaining the right solution using the meta-heuristic algorithm may require long operating time or a large number of iterations or individuals in a population. The higher the number, the longer the operation time. In order to minimize not only the time, but also the value of the parameters we suggest three proposition to increase the efficiency of classical methods. The first one is to use the method of searching through the neighborhood in order to minimize the solution space exploration. Moreover, task distribution between threads and CPU cores can affect the speed of the algorithm and therefore make it work more efficiently. The second proposition involves manipulating the solutions space to minimize the number of calculations. In addition, the third proposition is the combination of the previous two. All propositions has been described, tested and analyzed due to the use of various test functions.
    [Show full text]
  • Faster Shortest-Path Algorithms for Planar Graphs
    Journal of Computer and System SciencesSS1493 journal of computer and system sciences 55, 323 (1997) article no. SS971493 Faster Shortest-Path Algorithms for Planar Graphs Monika R. Henzinger* Department of Computer Science, Cornell University, Ithaca, New York 14853 Philip Klein- Department of Computer Science, Brown Univrsity, Providence, Rhode Island 02912 Satish Rao NEC Research Institute and Sairam Subramanian Bell Northern Research Received April 18, 1995; revised August 13, 1996 and matching). In this paper we improved algorithms for We give a linear-time algorithm for single-source shortest paths in single-source shortest paths in planar networks. planar graphs with nonnegative edge-lengths. Our algorithm also The first algorithm handles the important special case of yields a linear-time algorithm for maximum flow in a planar graph nonnegative edge-lengths. For this case, we obtain a linear- with the source and sink on the same face. For the case where time algorithm. Thus our algorithm is optimal, up to con- negative edge-lengths are allowed, we give an algorithm requiring O(n4Â3 log(nL)) time, where L is the absolute value of the most stant factors. No linear-time algorithm for shortest paths in negative length. This algorithm can be used to obtain similar bounds for planar graphs was previously known. For general graphs computing a feasible flow in a planar network, for finding a perfect the best bounds known in the standard model, which for- matching in a planar bipartite graph, and for finding a maximum flow in bids bit-manipulation of the lengths, is O(m+n log n) time, a planar graph when the source and sink are not on the same face.
    [Show full text]
  • Backtracking Search (Csps) ■Chapter 5 5.3 Is About Local Search Which Is a Very Useful Idea but We Won’T Cover It in Class
    CSC384: Intro to Artificial Intelligence Backtracking Search (CSPs) ■Chapter 5 5.3 is about local search which is a very useful idea but we won’t cover it in class. 1 Hojjat Ghaderi, University of Toronto Constraint Satisfaction Problems ● The search algorithms we discussed so far had no knowledge of the states representation (black box). ■ For each problem we had to design a new state representation (and embed in it the sub-routines we pass to the search algorithms). ● Instead we can have a general state representation that works well for many different problems. ● We can build then specialized search algorithms that operate efficiently on this general state representation. ● We call the class of problems that can be represented with this specialized representation CSPs---Constraint Satisfaction Problems. ● Techniques for solving CSPs find more practical applications in industry than most other areas of AI. 2 Hojjat Ghaderi, University of Toronto Constraint Satisfaction Problems ●The idea: represent states as a vector of feature values. We have ■ k-features (or variables) ■ Each feature takes a value. Domain of possible values for the variables: height = {short, average, tall}, weight = {light, average, heavy}. ●In CSPs, the problem is to search for a set of values for the features (variables) so that the values satisfy some conditions (constraints). ■ i.e., a goal state specified as conditions on the vector of feature values. 3 Hojjat Ghaderi, University of Toronto Constraint Satisfaction Problems ●Sudoku: ■ 81 variables, each representing the value of a cell. ■ Values: a fixed value for those cells that are already filled in, the values {1-9} for those cells that are empty.
    [Show full text]
  • Best-First Minimax Search Richard E
    Artificial Intelligence ELSEVIER Artificial Intelligence 84 ( 1996) 299-337 Best-first minimax search Richard E. Korf *, David Maxwell Chickering Computer Science Department, University of California, Los Angeles, CA 90024, USA Received September 1994; revised May 1995 Abstract We describe a very simple selective search algorithm for two-player games, called best-first minimax. It always expands next the node at the end of the expected line of play, which determines the minimax value of the root. It uses the same information as alpha-beta minimax, and takes roughly the same time per node generation. We present an implementation of the algorithm that reduces its space complexity from exponential to linear in the search depth, but at significant time cost. Our actual implementation saves the subtree generated for one move that is still relevant after the player and opponent move, pruning subtrees below moves not chosen by either player. We also show how to efficiently generate a class of incremental random game trees. On uniform random game trees, best-first minimax outperforms alpha-beta, when both algorithms are given the same amount of computation. On random trees with random branching factors, best-first outperforms alpha-beta for shallow depths, but eventually loses at greater depths. We obtain similar results in the game of Othello. Finally, we present a hybrid best-first extension algorithm that combines alpha-beta with best-first minimax, and performs significantly better than alpha-beta in both domains, even at greater depths. In Othello, it beats alpha-beta in two out of three games. 1. Introduction and overview The best chess machines, such as Deep-Blue [lo], are competitive with the best humans, but generate billions of positions per move.
    [Show full text]
  • Shortest Path Problems and Algorithms
    Shortest path problems and algorithms 1. Shortest path problems . Shortest path problem . Single-source shortest path problem . Single-destination shortest path problem . All-pairs shortest path problem 2. Algorithms . Dijkstra’s algorithm for single source shortest path problem (positive weight) . Bellman–Ford algorithm for single source shortest path problem (allow negative weight) . Floyd–Warshall algorithm for all pairs shortest paths . Johnson's algorithm for all pairs shortest paths CP412 ADAII 1. Shortest path problems Shortest path problem: Input: weight graph G = (V, E, W), source vertex s and destination vertex t. Output: a shortest path of G from s to t. Single-source shortest path problem: Output: shortest paths from source vertex s to all other vertices of G. Single-destination shortest path problem: Output: shortest paths from all vertices of G to a single destination t. All-pairs shortest path problem: Output: shortest paths between every pair of vertices u, v in the graph. CP412 ADAII History of SPP and algorithms Shimbel (1955). Information networks. Ford (1956). RAND, economics of transportation. Leyzorek, Gray, Johnson, Ladew, Meaker, Petry, Seitz (1957). Combat Development Dept. of the Army Electronic Proving Ground. Dantzig (1958). Simplex method for linear programming. Bellman (1958). Dynamic programming. Moore (1959). Routing long-distance telephone calls for Bell Labs. Dijkstra (1959). Simpler and faster version of Ford's algorithm. CP412 ADAII Dijkstra’s algorithms Edger W. Dijkstra’s quotes . The question of whether computers can think is like the question of whether submarines can swim. In their capacity as a tool, computers will be but a ripple on the surface of our culture.
    [Show full text]