CS414-Artificial Intelligence

Similar documents
Artificial Intelligence. Informed search methods

Introduction to Artificial Intelligence. Informed Search

PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE

Informed search algorithms

COMP9414/ 9814/ 3411: Artificial Intelligence. 5. Informed Search. Russell & Norvig, Chapter 3. UNSW c Alan Blair,

Informed search algorithms. Chapter 4, Sections 1 2 1

Overview. Path Cost Function. Real Life Problems. COMP219: Artificial Intelligence. Lecture 10: Heuristic Search

Artificial Intelligence: Search Part 2: Heuristic search

COMP219: Artificial Intelligence. Lecture 10: Heuristic Search

COMP219: Artificial Intelligence. Lecture 10: Heuristic Search

CS:4420 Artificial Intelligence

Lecture Plan. Best-first search Greedy search A* search Designing heuristics. Hill-climbing. 1 Informed search strategies. Informed strategies

Informed Search Algorithms. Chapter 4

TDT4136 Logic and Reasoning Systems

COSC343: Artificial Intelligence

Introduction to Artificial Intelligence (G51IAI)

Informed search algorithms

Informed Search. Topics. Review: Tree Search. What is Informed Search? Best-First Search

Informed Search and Exploration

Princess Nora University Faculty of Computer & Information Systems ARTIFICIAL INTELLIGENCE (CS 370D) Computer Science Department

Solving Problems using Search

Artificial Intelligence

Planning, Execution & Learning 1. Heuristic Search Planning

Informed Search and Exploration

Artificial Intelligence, CS, Nanjing University Spring, 2018, Yang Yu. Lecture 3: Search 2.

Searching and NetLogo

Informed search algorithms

Outline. Informed search algorithms. Best-first search. Review: Tree search. A search Heuristics. Chapter 4, Sections 1 2 4

Informed Search and Exploration

Algorithm. December 7, Shortest path using A Algorithm. Phaneendhar Reddy Vanam. Introduction. History. Components of A.

Foundations of Artificial Intelligence

Robot Programming with Lisp

Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany, Course on Artificial Intelligence,

Foundations of Artificial Intelligence

Informed Search and Exploration

16.1 Introduction. Foundations of Artificial Intelligence Introduction Greedy Best-first Search 16.3 A Weighted A. 16.

Artificial Intelligence. 2. Informed Search

Problem solving and search

Solving Problems by Searching

Graphs vs trees up front; use grid too; discuss for BFS, DFS, IDS, UCS Cut back on A* optimality detail; a bit more on importance of heuristics,

Artificial Intelligence CS 6364

CSE 473. Chapter 4 Informed Search. CSE AI Faculty. Last Time. Blind Search BFS UC-BFS DFS DLS Iterative Deepening Bidirectional Search

CS486/686 Lecture Slides (c) 2015 P.Poupart

Informed Search. Dr. Richard J. Povinelli. Copyright Richard J. Povinelli Page 1

Automated Planning & Artificial Intelligence

CS486/686 Lecture Slides (c) 2014 P.Poupart

AGENTS AND ENVIRONMENTS. What is AI in reality?

Solving Problems by Searching. Artificial Intelligence Santa Clara University 2016

Foundations of Artificial Intelligence

Problem solving and search

4. Solving Problems by Searching

Optimal Control and Dynamic Programming

Outline for today s lecture. Informed Search. Informed Search II. Review: Properties of greedy best-first search. Review: Greedy best-first search:

Informatics 2D: Tutorial 2 (Solutions)

Summary. Search CSL302 - ARTIFICIAL INTELLIGENCE 1

Informed search methods

AGENTS AND ENVIRONMENTS. What is AI in reality?

Outline. Best-first search

Week 3: Path Search. COMP9414/ 9814/ 3411: Artificial Intelligence. Motivation. Example: Romania. Romania Street Map. Russell & Norvig, Chapter 3.

Outline for today s lecture. Informed Search I. One issue: How to search backwards? Very briefly: Bidirectional search. Outline for today s lecture

Informed search algorithms Michal Pěchouček, Milan Rollo. Department of Cybernetics Czech Technical University in Prague

Shortest path using A Algorithm

PEAS: Medical diagnosis system

Outline. Best-first search

CS 380: Artificial Intelligence Lecture #4

Artificial Intelligence, CS, Nanjing University Spring, 2018, Yang Yu. Lecture 2: Search 1.

Artificial Intelligence: Search Part 1: Uninformed graph search

Informed (heuristic) search (cont). Constraint-satisfaction search.

Problem Solving and Search. Geraint A. Wiggins Professor of Computational Creativity Department of Computer Science Vrije Universiteit Brussel

Clustering (Un-supervised Learning)

Artificial Intelligence

Contents. Foundations of Artificial Intelligence. General Algorithm. Best-First Search

Chapter 3: Informed Search and Exploration. Dr. Daisy Tang

DFS. Depth-limited Search

Informed search algorithms. Chapter 4

Chapter4. Tree Search (Reviewed, Fig. 3.9) Best-First Search. Search Strategies. Best-First Search (cont.-2) Best-First Search (cont.

Seminar: Search and Optimization

CS-E4800 Artificial Intelligence

Problem solving and search

CS 771 Artificial Intelligence. Informed Search

Dr. Mustafa Jarrar. Chapter 4 Informed Searching. Artificial Intelligence. Sina Institute, University of Birzeit

Solving Problems by Searching

Solving Problems by Searching

COMP219: Artificial Intelligence. Lecture 7: Search Strategies

Informed search algorithms. (Based on slides by Oren Etzioni, Stuart Russell)

Planning and search. Lecture 1: Introduction and Revision of Search. Lecture 1: Introduction and Revision of Search 1

TDDC17. Intuitions behind heuristic search. Recall Uniform-Cost Search. Best-First Search. f(n) =... + h(n) g(n) = cost of path from root node to n

Artificial Intelligence

Artificial Intelligence

Informed Search. Notes about the assignment. Outline. Tree search: Reminder. Heuristics. Best-first search. Russell and Norvig chap.

Lecture 4: Informed/Heuristic Search

Artificial Intelligence

Wissensverarbeitung. - Search - Alexander Felfernig und Gerald Steinbauer Institut für Softwaretechnologie Inffeldgasse 16b/2 A-8010 Graz Austria

Informed search algorithms

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

Informed search algorithms

TDDC17. Intuitions behind heuristic search. Best-First Search. Recall Uniform-Cost Search. f(n) =... + h(n) g(n) = cost of path from root node to n

Search. Intelligent agents. Problem-solving. Problem-solving agents. Road map of Romania. The components of a problem. that will take me to the goal!

Artificial Intelligence

Informed Search. Best-first search. Greedy best-first search. Intelligent Systems and HCI D7023E. Romania with step costs in km

Transcription:

CS414-Artificial Intelligence Lecture 6: Informed Search Algorithms Waheed Noor Computer Science and Information Technology, University of Balochistan, Quetta, Pakistan Waheed Noor (CS&IT, UoB, Quetta) CS414-Artificial Intelligence August 2015 1 / 30

Outline 1 Informed Search 2 Best First Search A* Search Example More on Heuristic Reading 3 Hill-Climbing Search Readings Waheed Noor (CS&IT, UoB, Quetta) CS414-Artificial Intelligence August 2015 2 / 30

Outline 1 Informed Search 2 Best First Search A* Search Example More on Heuristic Reading 3 Hill-Climbing Search Readings Waheed Noor (CS&IT, UoB, Quetta) CS414-Artificial Intelligence August 2015 3 / 30

Informed Search What we have seen so far are all those search algorithms that operate with out any domain knowledge, and try to solve the problem in brute-force fashion. Such methods are insufficient for most problems specially when the problem is large and complex. Now we will look into another type of search techniques called informed search. Definition Informed Search Incorporates a heuristic in the search that determines the quality of any state in the search space. In a graph search, this results in a strategy for node expansion. The heuristic may consider the problem knowledge to guide the search strategy. Waheed Noor (CS&IT, UoB, Quetta) CS414-Artificial Intelligence August 2015 4 / 30

Outline 1 Informed Search 2 Best First Search A* Search Example More on Heuristic Reading 3 Hill-Climbing Search Readings Waheed Noor (CS&IT, UoB, Quetta) CS414-Artificial Intelligence August 2015 5 / 30

Best First Search I Best-FS tries to minimize some estimated measure (evaluation function) of the cost of the solution. Generally, in Best-FS, state space is evaluated on the basis of an evaluation function f (n) that incorporates an estimate of the measure of the cost of the path from the current state to the closest goal. Then the Best-FS may follow two strategies: 1 Greedy Search: Expands the node closest to the goal, i.e., f (n) = h(n). 2 A Search: Expands the node on the least cost solution path, i.e., f (n) = g(n) + h(n). Waheed Noor (CS&IT, UoB, Quetta) CS414-Artificial Intelligence August 2015 6 / 30

Best First Search II where h(n) is heuristic function and g(n) is estimated path-cost from start node to current node n. The h(n) can be an educated guess or estimate of the cheapest path from the state at node n to the goal. In Romania example, this may be a straight line between state at node n to goal. The g(n) is the cost from the start node to node n. The algorithm is often implemented by maintaining two list, an open one and a closed one. Open list is a priority queue consist nodes yet to be visited sorted by their evaluation function. Closed list contains nodes that have already been evaluated. Waheed Noor (CS&IT, UoB, Quetta) CS414-Artificial Intelligence August 2015 7 / 30

Best First Search III Best-FS specializes to BFS when f (n) = h(n) and to UCS when f (n) = g(n). Waheed Noor (CS&IT, UoB, Quetta) CS414-Artificial Intelligence August 2015 8 / 30

An Example Consider again the Romania example Oradea 71 Neamt 87 Zerind 75 151 Iasi Arad 140 92 Sibiu 99 Fagaras 118 80 Vaslui Timisoara Rimnicu Vilcea 111 142 211 Lugoj 97 Pitesti 70 98 146 Hirsova Mehadia 101 85 Urziceni 75 138 86 Bucharest 120 Dobreta 90 Craiova Eforie Giurgiu Straight line distance to Bucharest Arad 366 Bucharest 0 Craiova 160 Dobreta 242 Eforie 161 Fagaras 178 Giurgiu 77 Hirsova 151 Iasi 226 Lugoj 244 Mehadia 241 Neamt 234 Oradea 380 Pitesti 98 Rimnicu Vilcea 193 Sibiu 253 Timisoara 329 Urziceni 80 Vaslui 199 Zerind 374 Figure : Romania map with SLD Waheed Noor (CS&IT, UoB, Quetta) CS414-Artificial Intelligence August 2015 9 / 30

Greedy Fashion (a) The initial state (b) After expanding Arad Arad 366 Arad Sibiu Timisoara Zerind 253 329 374 (c) After expanding Sibiu Arad Sibiu Timisoara Zerind 329 374 Arad Fagaras Oradea Rimnicu Vilcea 366 176 380 193 (d) After expanding Fagaras Arad Sibiu Timisoara Zerind 329 374 Arad Fagaras Oradea Rimnicu Vilcea 366 380 193 Sibiu Bucharest 253 0 Figure : In the greedy fashion Waheed Noor (CS&IT, UoB, Quetta) CS414-Artificial Intelligence August 2015 10 / 30

Outline 1 Informed Search 2 Best First Search A* Search Example More on Heuristic Reading 3 Hill-Climbing Search Readings Waheed Noor (CS&IT, UoB, Quetta) CS414-Artificial Intelligence August 2015 11 / 30

Waheed Noor (CS&IT, UoB, Quetta) Figure : CS414-Artificial The A* implementation Intelligence August 2015 12 / 30 A* Search Example (a) The initial state (b) After expanding Arad Arad 366=0+366 Arad Sibiu 393=140+253 Timisoara Zerind 447=118+329 449=75+374 (c) After expanding Sibiu Arad Sibiu Timisoara Zerind 447=118+329 449=75+374 Arad Fagaras Oradea Rimnicu Vilcea 646=280+366 415=239+176 671=291+380 413=220+193 (d) After expanding Rimnicu Vilcea Arad Sibiu Timisoara Zerind 447=118+329 449=75+374 Arad Fagaras Oradea Rimnicu Vilcea 646=280+366 415=239+176 671=291+380 Craiova Pitesti Sibiu 526=366+160 417=317+100 553=300+253 (e) After expanding Fagaras Arad Sibiu Timisoara Zerind 447=118+329 449=75+374 Arad 646=280+366 Fagaras Oradea 671=291+380 Rimnicu Vilcea Sibiu Bucharest Craiova Pitesti Sibiu 591=338+253 450=450+0 526=366+160 417=317+100 553=300+253 (f) After expanding Pitesti Arad Sibiu Timisoara Zerind 447=118+329 449=75+374 Arad 646=280+366 Fagaras Oradea 671=291+380 Rimnicu Vilcea Sibiu Bucharest Craiova Pitesti Sibiu 526=366+160 553=300+253 591=338+253 450=450+0 Bucharest Craiova Rimnicu Vilcea 418=418+0 615=455+160 607=414+193

Class Activity Apply A & Greedy Best-FS on following problem Waheed Noor (CS&IT, UoB, Quetta) CS414-Artificial Intelligence August 2015 13 / 30

A* Search A* Search Rating Complete: Yes Time Complexity: O(b d ) Space Complexity: O(b d ) Optimal: Yes. A* search algorithm have two flavors, the graph based and tree based. Waheed Noor (CS&IT, UoB, Quetta) CS414-Artificial Intelligence August 2015 14 / 30

Conditions for Optimality Admissibility and Consistency Admissibility: That the heuristic is admissible i.e., that h(n) will never overestimate the cost to reach the goal. For A*, h(n) is admissible, since straight line is the shortest path between any two points. Consistent: Consistency (also called monotonicity) describes that the cost along the path is increasing or decreasing. For A* graph version, the h(n) needs to be the increasing function of n along the path to goal, i.e., h(n) < c(n, a, n ) + h(n ). The A* tree search is optimal when h(n) is admissible. The A* graph search is optimal when h(n) is consistent. Waheed Noor (CS&IT, UoB, Quetta) CS414-Artificial Intelligence August 2015 15 / 30

Outline 1 Informed Search 2 Best First Search A* Search Example More on Heuristic Reading 3 Hill-Climbing Search Readings Waheed Noor (CS&IT, UoB, Quetta) CS414-Artificial Intelligence August 2015 16 / 30

Heuristic for 8-Puzzle 7 2 4 51 2 3 5 6 4 5 6 8 3 1 7 8 Start State Goal State What possible heuristic h(n) you can propose? Waheed Noor (CS&IT, UoB, Quetta) CS414-Artificial Intelligence August 2015 17 / 30

Two Possible Heuristic for 8-Puzzle h 1 One possibility can be to count the number of misplaced tiles in the current state n than the goal state. For initial state given above h 1 (n) = 6. Maximum possible h 1 (n) = 8, since there are eight tiles. Is h 1 admissible? h 2 Second possibility can be the sum of the distance of tiles in the current state n from their goal. As the tiles in this problem can not move diagonal, they can either move horizontal or vertical therefore, this distance will be the count of horizontal and vertical distance/steps. This is also called Manhattan distance. The Manhattan distance from 1 to 8 for above problem start state is: Is h 2 admissible? h 2 (n) = 4 + 0 + 3 + 3 + 1 + 0 + 2 + 1 Waheed Noor (CS&IT, UoB, Quetta) CS414-Artificial Intelligence August 2015 18 / 30

Outline 1 Informed Search 2 Best First Search A* Search Example More on Heuristic Reading 3 Hill-Climbing Search Readings Waheed Noor (CS&IT, UoB, Quetta) CS414-Artificial Intelligence August 2015 19 / 30

Reading Read about Recursive best-first search (RBFS) and try on the Romania map example to develop your understanding. Waheed Noor (CS&IT, UoB, Quetta) CS414-Artificial Intelligence August 2015 20 / 30

Outline 1 Informed Search 2 Best First Search A* Search Example More on Heuristic Reading 3 Hill-Climbing Search Readings Waheed Noor (CS&IT, UoB, Quetta) CS414-Artificial Intelligence August 2015 21 / 30

Hill-Climbing Search An iterative algorithm that tries to find maximum (or minimum) value of an objective/evaluation function. In each iteration it moves towards the direction of increasing value. Unlike Best-First, it does not maintain a search tree and uses current state node and its immediate neighbors. Each time it follows a single node and hence its OPEN list contain only one node. It is also sometime called a greedy local search. Waheed Noor (CS&IT, UoB, Quetta) CS414-Artificial Intelligence August 2015 22 / 30

Hill-Climbing Search objective function global maximum shoulder local maximum "flat" local maximum current state state space Problems: Since hill-climbing search considers immediate neighbor state that is its local, therefore it may end-up with a local optimal solution, i.e., local maximum(or minimum) rather than global optimum solution. Solution: Random restart sometime solve the problem of local optimum. Waheed Noor (CS&IT, UoB, Quetta) CS414-Artificial Intelligence August 2015 23 / 30

Ridges and Plateau Ridges: Result in the a series of local optima and it is very difficult for greedy algorithm to overcome. Plateau: A plateau is the flat area of the state space with respect to the objective function. It can be a flat local optimum, for which no uphill exist or a shoulder where progress is possible. The hill-climbing may get lost in plateau, one possible solution can be to allow progress sideways, if plateau is shoulder. If plateau is flat local optima then it may result in an infinite loop, so we can then limit the number of sideway moves. Waheed Noor (CS&IT, UoB, Quetta) CS414-Artificial Intelligence August 2015 24 / 30

An Example h = 5 h = 2 h = 0 Figure : 4-Queen starting from state with heuristic cost estimate of h(n) = 4 In this problem our heuristic can be the number of conflicts we can observe in the current state. Obviously then our goal is h(n) = 0. The hill-climbing algorithm will often (say 80% of the time for this problem) fails to find the solution. But when the algorithm solve the problem, it is very efficient even in very large state space. Waheed Noor (CS&IT, UoB, Quetta) CS414-Artificial Intelligence August 2015 25 / 30

Discussion The hill-climbing algorithm explained today is incomplete, since it will often lost in local optima. Multiple restarts (with random initial state in each restart) may solve the problem. If p is the probability of success of hill-climbing algorithm then we need at-least 1/p restarts. It is also not guaranteed to give optimal solution globally. However, local optimal is guaranteed. The time and space complexity both are linear, i.e., O(d) and O(b) respectively. Since the algorithm consider only one state node at a time. Waheed Noor (CS&IT, UoB, Quetta) CS414-Artificial Intelligence August 2015 26 / 30

Outline 1 Informed Search 2 Best First Search A* Search Example More on Heuristic Reading 3 Hill-Climbing Search Readings Waheed Noor (CS&IT, UoB, Quetta) CS414-Artificial Intelligence August 2015 27 / 30

Readings You are supposed to read an alternative approach called Simulated Annealing, and discuss in a report the characteristics and comparison of hill climbing and simulated annealing algorithm. Your answer should contain at least 100 words. Waheed Noor (CS&IT, UoB, Quetta) CS414-Artificial Intelligence August 2015 28 / 30

References I Stuart Russell and Peter Norvig. Artificial Intelligence: A Modern Approach. Pearson Education, Inc, USA, second edition, 2003. George F. Luger. Artificial Intelligence: Structures and Strategies for Complex Problem Solving. Addison-Wesley Publishing Company, USA, 6th edition, 2008. Waheed Noor (CS&IT, UoB, Quetta) CS414-Artificial Intelligence August 2015 29 / 30