1 Chapter 2 Heuristic Search Techniques. 344-471 AI & ESChapter 2 2 Defining the problem A water jug problem: 4-gallon and 3-gallon - no marker on the.

Slides:



Advertisements
Similar presentations
Problems and Search Chapter 2.
Advertisements

BEST FIRST SEARCH - BeFS
Artificial Intelligence: Knowledge Representation
Heuristic Search techniques
Chapter 3 Heuristic Search Techniques
State Space Representation and Search
Ch 4. Heuristic Search 4.0 Introduction(Heuristic)
State Space 3 Chapter 4 Heuristic Search. Three Algorithms Backtrack Depth First Breadth First All work if we have well-defined: Goal state Start state.
Solving Problem by Searching
ICS-171:Notes 4: 1 Notes 4: Optimal Search ICS 171 Summer 1999.
State Space Search Classic AI.
Part2 AI as Representation and Search
Search Techniques MSc AI module. Search In order to build a system to solve a problem we need to: Define and analyse the problem Acquire the knowledge.
Problems and Search Chapter 2.
CSC 423 ARTIFICIAL INTELLIGENCE
1 Pertemuan 2 PROBLEMS, PROBLEM SPACES, AND SEARCH Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1/0.
Best-First Search: Agendas
Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2004.
MAE 552 – Heuristic Optimization Lecture 27 April 3, 2002
1 Tree Searching Strategies. 2 The procedure of solving many problems may be represented by trees. Therefore the solving of these problems becomes a tree.
Using Search in Problem Solving
Uninformed Search Reading: Chapter 3 by today, Chapter by Wednesday, 9/12 Homework #2 will be given out on Wednesday DID YOU TURN IN YOUR SURVEY?
Blind Search-Part 2 Ref: Chapter 2. Search Trees The search for a solution can be described by a tree - each node represents one state. The path from.
Using Search in Problem Solving
1 Tree Searching Strategies. 2 The procedure of solving many problems may be represented by trees. Therefore the solving of these problems becomes a tree.
5-1 Chapter 5 Tree Searching Strategies. 5-2 Breadth-first search (BFS) 8-puzzle problem The breadth-first search uses a queue to hold all expanded nodes.
State-Space Searches. 2 State spaces A state space consists of –A (possibly infinite) set of states The start state represents the initial problem Each.
For Friday Finish chapter 3 Homework: –Chapter 3, exercise 6 –May be done in groups. –Clarification on part d: an “action” must be running the program.
Solving Problems by Searching
State-Space Searches.
Brute Force Search Depth-first or Breadth-first search
Heuristic Search Heuristic - a “rule of thumb” used to help guide search often, something learned experientially and recalled when needed Heuristic Function.
Problems, Problem Spaces and Search
Informed Search Strategies
Problem Solving and Search Andrea Danyluk September 11, 2013.
Vilalta&Eick: Informed Search Informed Search and Exploration Search Strategies Heuristic Functions Local Search Algorithms Vilalta&Eick: Informed Search.
1 State Space of a Problem Lecture 03 ITS033 – Programming & Algorithms Asst. Prof.
Formal Description of a Problem In AI, we will formally define a problem as –a space of all possible configurations where each configuration is called.
State Space Search. State Space representation of a problem is a graph  Nodes correspond to problem states  Arcs correspond to steps in a solution process.
Introduction to search Chapter 3. Why study search? §Search is a basis for all AI l search proposed as the basis of intelligence l inference l all learning.
Chapter 2 Problems, Problem Spaces, and Search?
Dr.Abeer Mahmoud ARTIFICIAL INTELLIGENCE (CS 461D) Dr. Abeer Mahmoud Computer science Department Princess Nora University Faculty of Computer & Information.
Today’s Topics FREE Code that will Write Your PhD Thesis, a Best-Selling Novel, or Your Next Methods for Intelligently/Efficiently Searching a Space.
Problems, Problem Spaces and Search
CS 415 – A.I. Slide Set 5. Chapter 3 Structures and Strategies for State Space Search – Predicate Calculus: provides a means of describing objects and.
State-Space Searches. 2 State spaces A state space consists of A (possibly infinite) set of states The start state represents the initial problem Each.
A RTIFICIAL I NTELLIGENCE UNIT : 2 Search Techniques.
Chapter 2 Problems, Problem Spaces, and Search?
For Friday Finish reading chapter 4 Homework: –Lisp handout 4.
For Monday Read chapter 4, section 1 No homework..
1 Defining a Problem as a State Space 1. Define a state space that contains all the possible configurations of the relevant objects. 2. Specify one (or.
1 Solving problems by searching 171, Class 2 Chapter 3.
Search CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
PROBLEM SOLVING – BASIC SEARCH METHODS 12/8/2015Dr. Sunil Kumar 1.
Reasoning as Search. Reasoning We can describe reasoning as search in a space of possible situations.
Basic Problem Solving Search strategy  Problem can be solved by searching for a solution. An attempt is to transform initial state of a problem into some.
Problem Reduction So far we have considered search strategies for OR graph. In OR graph, several arcs indicate a variety of ways in which the original.
Search Techniques CS480/580 Fall Introduction Trees: – Root, parent, child, sibling, leaf node, node, edge – Single path from root to any node Graphs:
Search in State Spaces Problem solving as search Search consists of –state space –operators –start state –goal states A Search Tree is an efficient way.
Graph Search II GAM 376 Robin Burke. Outline Homework #3 Graph search review DFS, BFS A* search Iterative beam search IA* search Search in turn-based.
Problems, Problem Spaces and Search. Contents Defining the problem as a State Space Search Production Systems Control Strategies Breadth First Search.
Problem and Production System Characteristics
Introduction to Artificial Intelligence
Introduction Defining the Problem as a State Space Search.
Problem and Production System Characteristics
STATE SPACE REPRESENTATION
STATE SPACE REPRESENTATION
BEST FIRST SEARCH -OR Graph -A* Search -Agenda Search CSE 402
CO Games Development 1 Week 8 Depth-first search, Combinatorial Explosion, Heuristics, Hill-Climbing Gareth Bellaby.
Chapter 2 Problems, Problem Spaces, and Search?
Presentation transcript:

1 Chapter 2 Heuristic Search Techniques

AI & ESChapter 2 2 Defining the problem A water jug problem: 4-gallon and 3-gallon - no marker on the bottle - pump to fill the water into the jug - How can you get exactly 2 gallons of water into the 4-gallons jug? 4 3

AI & ESChapter 2 3 A state space search (x,y) : order pair x : water in 4-gallons  x = 0,1,2,3,4 y : water in 3-gallons  y = 0,1,2,3 start state : (0,0) goal state : (2,n) where n = any value Rules : 1. Fill the 4 gallon-jug (4,-) 2. Fill the 3 gallon-jug(-,3) 3. Empty the 4 gallon-jug(0,-) 4. Empty the 3 gallon-jug(-,0)

AI & ESChapter (x,y)(4,y)Fill the 4-gallon jug if x < 4 2 (x,y)(x,3)Fill the 3-gallon jun if y < 3 3 (x,y)(x – d,y)Pour some water out of if x > 0 the 4-gallon jun 4 (x,y)(x,y – d)Pour some water out of if y > 0the 3-gallon jun 5 (x,y)(0,y)Empty the 4-gallon jun if x > 0on the ground 6 (x,y)(x,0)Empty the 3-gallon jun if y > 0on the ground Water jug rules

AI & ESChapter (x,y) (4,y – (4 - x))Pour water from the if x+y >= 4 and y > 03-gallon jug into the 4-gallon jug until the 4-gallon jug is full 8 (x,y) (x – (3 - y),3)Pour water from the if x+y >= 3 and y > 0 4-gallon jug into the 3-gallon jug until the 3-gallon jug is full 9 (x,y) (x+y,0)Pour all water from the if x+y 0from the 3-gallon jug into the 4-gallon jug 10 (x,y) (0,x + y ) Pour all water from the if x + y 0 from the 4-gallon jug into the 3-gallon jug 11 (0,2) (2,0) Pour the 2 gallons from the 3- gallon jug into the 4-gallon jug 12 (2,y) (0,y)Empty the 2 gallons in the 4-gallon jug on the ground Water jug rules

AI & ESChapter 2 6 A water jug solution 4-Gallon Jug3-Gallon JugRule Applied or or 11 Solution : path / plan

AI & ESChapter 2 7 Formal description of a problem 1. Define a state space that contains all the possible configurations of the relevant objects. 2. Specify state/states that describes the situation of start state. 3. Specify state/states that describes the situation of goal state. 4. Specify the set of rules.  assumption, generalization

AI & ESChapter 2 8 Search Tree (0,0) (4,0)(0,3) (4,3)(0,0)(4,3)(3,0)(1,3)(0,0) Water jug problem.

AI & ESChapter 2 9 Search Graph Water jug problem. Cycle When will the search terminate? (0,0) (4,0)(0,3) (4,3) (3,0)(1,3)

AI & ESChapter 2 10 Homework 2 (1%) Is there any other solution for a water jug problem? If there is some other solution, describe in an order pair of how to solve it. due date

AI & ESChapter 2 11 Question answering question Marcus was a man. Marcus was a Pompeian. Marcus was born in 40 A.D. All men are mortal. All Pompeians died when the volcano erupted in 79 A.D. No mortal lives longer than 150 years. It is now 1991 A.D. Is Marcus alive?

AI & ESChapter 2 12 Solution 1 1. Marcus was man. axiom 1 4. All men are mortal. axiom 4 8. Marcus is mortal. 1,4 3. Marcus was born in 40 A.D. axiom 3 7. It is now 1991 A.D. axiom 7 9. Marcus’ age is 1951 years. 3,7 6. No mortal lives longer than 150 years axiom Marcus is dead. 8,6,9

AI & ESChapter It is now 1991 A.D. axiom 7 5. All Pompeians died in 79 A.D. axiom All Pompeians are dead now. 7,5 2. Marcus was a Pompeian. axiom Marcus is dead. 11,2 Solution 2

AI & ESChapter 2 14 The bank president ate a dish of pasta salad with the fork. Understanding a sentence bank = financial institution / a side of a river dish = eat dish / eat pasta pasta salad : dog food  food with dog meat? with a fork : with....her friend. / with vegetable. solution : state of the world

AI & ESChapter 2 15 A blocks world on(c,a). on(b,d). ontable(a). ontable(d). clear(b). clear(c). hand_empty. a c d b

AI & ESChapter 2 16 Seven problem characteristics 1.Decomposable Problem Block world problem 2.Can solution steps be ignored or undone? Ignorable : theorem proving solution steps can be ignored Recoverable : 8 puzzle solution steps can be undone (backtracking) Irrecoverable : chess solution steps can not be undone

AI & ESChapter 2 17 Seven problem characteristics 3. Is the universe predictable? 8-puzzel (yes) bridge (no)  but we can use probabilities of each possible outcomes controlling robot arm  gear of the arm might stuck helping the lawyer to decide how to defend his client against a murder charge. 4. Is a good solution absolute or relative? - formal inference methods - More than one solution? - traveling salesman problem

AI & ESChapter 2 18 Seven problem characteristics 5. Is the solution a state or a path? - consistent interpretation for the sentence - water jug problem  path / plan 6. What is the role of knowledge? knowledge for perfect program of chess (need knowledge to constrain the search) newspaper story understanding (need knowledge to recognize a solution) 7. Does the task require interaction with a person? solitary/ conversational

AI & ESChapter 2 19 Production system 1.A set of rules. 2.Knowledge contains information for a particular task. 3.A control strategy.  resolve conflict rule.  Breadth-first search  Depth-first search

AI & ESChapter 2 20 Breadth-first search Algorithm BFS: 1.Create a variable called NODE-LIST and set it to the initial state. 2.Until a goal state is found or NODE-LIST is empty do:  Remove the first element from NODE-LIST and call it E. If NODE- LIST was empty, quit.  For each way that each rule can match the state described in E do:  Apply the rule to generate a new state.  If the new state is a goal state, quit and return this state.  Otherwise, add the new state to the end of NODE-LIST.

AI & ESChapter 2 21 Advantage BFS 1. will not trapped exploring a blind alley ( ไม่ลงลึกไปทางใดทางหนึ่ง เฉพาะ ที่อาจจะไม่ใช่คำตอบ ) 2. if there is a solution, DFS is guaranteed to find it. 3. if there are multiple solutions, a minimum solution will be found.

AI & ESChapter 2 22 Depth-first search Algorithm DFS: 1.If the initial state is a goal state, quit and return success. 2.Otherwise, do the following until success or failure is signaled:  Generate a successor, E, of the initial state. If there are no more successors, signal failure.  Call Depth-First Search with E as the initial state.  If success is returned, signal success. Otherwise continue in this loop.

AI & ESChapter 2 23 Advantage DFS 1.require less memory 2.may find a solution without examining much of the search space.

AI & ESChapter 2 24 Production System  Working memory  Production set = Rules Figure 5.3  Trace Figure 5.4 Data driven Figure 5.9 Goal driven Figure 5.10  Iteration #  Working memory  Conflict sets  Rule fired

AI & ESChapter 2 25 Production System

AI & ESChapter 2 26 Production System

AI & ESChapter 2 27 Production System

AI & ESChapter 2 28 Production System

AI & ESChapter 2 29 And-Or Graph start Data driven Goal driven b cd efgoal

AI & ESChapter 2 30 Heuristic Search Heuriskein  to discover (Greek word) Heuristic is a technique that improves the efficiency of the search process. - It is often useful to introduce heuristics based on relatively unstructured knowledge. - can not use Mathematical analysis. Heuristic function : is the function that maps from problem state descriptions to measures of desirability, usually represent as number  guide the most profitable direction

AI & ESChapter 2 31 Generate-and-test  Generate all possible solutions  DFS + backtracking  Generate randomly  Test function  ANSWER yes/no  Algorithm page

AI & ESChapter 2 32 Hill Climbing  Similar to generate-and-test  Test function + heuristic function  Tell how close to the goal state  EX : In unfamiliar city without a map... downtown = tall building... heuristic function = distance between downtown and tall building  Stop  Goal state meet  No alternative state to move

AI & ESChapter 2 33 Simple Hill Climbing  Task specific knowledge into the control process  Is one state better than another  If the new state is...better... than the current state then make it the current state  Algorithm page

AI & ESChapter 2 34 Steepest-Ascent Hill Climbing  Consider all moves from the current state  Select the best one as the next state  Algorithm page

AI & ESChapter 2 35 Hill Climbing Characteristic  Local method  It decides what to do next by looking only at the immediate consequences of its choice (rather than by exhaustively exploring all of the consequence)  Look only one more ahead

AI & ESChapter 2 36 Local heuristic function  Block world figure 3.1 p  Local heuristic function 1. Add one point for every block that is resting on the thing it is supposed to be resting on. 2. Subtract one point for every block that is sitting on the wrong thing.  Initial state score = 4 (6-2)  C,D,E,F,G,H correct = 6  A,B wrong = -2  Goal state score = 8  A,B,C,D,E,F,F,H all correct Heuristic function : max value

AI & ESChapter 2 37 Local heuristic function Current state : figure 3.1 หยิบ A วางบนโต๊ะ B C D E F G H วางเรียงเหมือนเดิม  Score = 6 (B C D E F G H correct) Block world figure 3.2 p. 69 case a : Next state score = 4 (6-2) case b : Next state score = 4 (6-2) case c : Next state score = 4 (6-2) All 3 cases a,b,c...have no better score than the current state = 6  so we... Stop Local minimum problem ติดอยู่ในกลุ่มระดับ local มองไปไม่พ้นอ่าง Heuristic function : max value

AI & ESChapter 2 38 Global heuristic function  Block world figure 3.1 p  Global heuristic function For each block that has the correct support structure ( บริเวณฐานของมันต้องถูกหมด )add one point for every block in the support structure. For each block that has an incorrect support structure, subtract one point for every block in the existing support structure.

AI & ESChapter 2 39 Global heuristic function  initial state score = -28  C = -1, D = -2, E = -3, F = -4, G = -5, H = -6, A = -7 C บริเวณฐานของมันต้องผิด 1 ตัว D บริเวณฐานของมันต้องผิด 2 ตัว...  Goal state score = 28  B = 1, C = 2, D = 3, E = 4, F = 5, G = 6, H = 7 B บริเวณฐานของมันต้องถูกหมด 1 ตัว C บริเวณฐานของมันต้องถูกหมด 2 ตัว.... Heuristic function : max value

AI & ESChapter 2 40 Global heuristic function Current state : figure 3.1 หยิบ A วางบนโต๊ะ B C D E F G H วางเรียงเหมือนเดิม Score = -21 (C = -1, D = -2, E= -3, F = -4, G= -5, H = -6) Block world figure 3.2 p. 69 Next state : move to case(c) case a = -28 same as initial state case b = -16 (C = -1, D = -2, E= -3, F = -4, G= -5, H = -1) case c = -15 (C = -1, D = -2, E= -3, F = -4, G= -5) No Local minimum problem  It ’ s work Heuristic function : max value

AI & ESChapter 2 41 New heuristic function 1. Incorrect structure are bad and should be taken apart. More subtract score 2. Correct structure are good and should built up. Add more score for the correct structure.  สิ่งที่เราต้องพิจารณา How to find a perfect heuristic function? เข้าไปในเมองที่ไม่เคยไปจะหลีกเลี่ยงทางตัน dead end ได้ อย่างไร

AI & ESChapter 2 42 Best first search Heuristic function : min value page 74

AI & ESChapter 2 43  OR GRAPH : each of its branches represents an alternative problem-solving pattern  we assumed that we could evaluate multiple paths to the same node independently of each other  we want to find a single path to the goal  use DFS : select most promising path  use BSF : when no promising path/ switch part to receive the better value  old branch is not forgotten  solution can be find without all completing branches having to expanded Best first search

AI & ESChapter 2 44 f’ = g + h’ g: cost from initial state to current state h’: estimate cost current state to goal state f’: estimate cost initial state to goal state Open node : most promising node Close node : keep in memory, already discover node. Best first search

AI & ESChapter 2 45 Best First Search Algorithm page 75-76

AI & ESChapter 2 46 A* algorithm  h ’ : count the nodes that we step down the path, 1 level down = 1 point, except the root node.  Underestimate : we generate up until f ’ (F)= 6 > f ’ (C) =5 then we have to go back to C. 1 level 2 level 3 level f ’ (E) = f ’ (C) = 5 f’ = g + h’ Heuristic function : min value

AI & ESChapter 2 47 A* algorithm f’ = g + h’ 1 level 2 level 3 level ปัญหา Overestimate : Suppose the solution is under D but we will not generate D because f ’ (D) = 6 > f ’ (G) = 4. page 76 Heuristic function : min value

AI & ESChapter 2 48 And-Or Graph / Tree  can be solved by decomposing them into a set of smaller problems  And arcs are indicated with a line connecting all the components

AI & ESChapter 2 49 And-Or Graph / Tree  each arc with the successor has a cost of choose lowest value = f ’ (B) = 5+1 ABEF = Heuristic function : min value

AI & ESChapter 2 50 And-Or Graph / Tree

AI & ESChapter 2 51 To solve a problem 1. Define the problem precisely. Specify the problem space, and the starting and goal state (s). 2. Analyze the problem to determine where it falls with respect to seven important issues. 3. Identify and represent the knowledge required by the task. 4. Choose one or more techniques for problem solving, and apply those techniques to the problem.

AI & ESChapter 2 52