Heuristic Search cs475 lecture note supplement for CS570 by Jin Hyung Kim Computer Science Departmen - PowerPoint PPT Presentation

1 / 53
About This Presentation
Title:

Heuristic Search cs475 lecture note supplement for CS570 by Jin Hyung Kim Computer Science Departmen

Description:

node, start node(root), leaf (tip node), root, path, ancestor, descendant, child ... [N, A, S, GD], solution path. Examples of SSR. TIC_TAC_TOE. n2-1 Puzzle ... – PowerPoint PPT presentation

Number of Views:109
Avg rating:3.0/5.0
Slides: 54
Provided by: Jinhyu
Category:

less

Transcript and Presenter's Notes

Title: Heuristic Search cs475 lecture note supplement for CS570 by Jin Hyung Kim Computer Science Departmen


1
Heuristic Searchcs475 lecture note(supplement
for CS570)by Jin Hyung KimComputer Science
DepartmentKAIST
2
Search Algorithm
  • Guarantee to find a solution ?
  • always terminate ?
  • Guarantee the solution to be optimal
  • Complexity - time and space
  • How can the complexity be reduced ?
  • How can utilize representation language ?

State Space Search
3
Example of Representation
  • Euler Path

4
Graph Theory
  • Graph consists of
  • A set of nodes may be infinite
  • A set of arcs(links)
  • Directed graph, underlying graph, tree
  • Notations
  • node, start node(root), leaf (tip node), root,
    path, ancestor, descendant, child(children, son),
    parent(father), cycle, DAG, connected, locally
    finite graph, node expansion

5
State Space Representation
  • Basic Components
  • set of states s
  • set of operators o s -gt s
  • control strategy c sn -gt o
  • State space graph
  • State -gt node
  • operator -gt arc
  • Four tuple representation
  • N, A, S, GD, solution path

6
Examples of SSR
  • TIC_TAC_TOE
  • n2-1 Puzzle
  • Traveling salesperson problem (TSP)

7
Strategies of SS Search
  • Data-Driven vs. Goal Driven(model-driven)
  • Forward chaining / Backward chaining
  • Irrevocable strategy vs. revocable
  • Irrevocable
  • Most popular in Human problem solving
  • No shift of attention to suspended alternatives
  • End up with local-maxima
  • ltlt Commutative gtgt
  • Revocable
  • An alternative chosen, others reserve

8
Implementing Graph Search
  • Revocable strategy
  • Uninformed search
  • Search does not depend on the nature of solution
  • Systematic Search Method
  • Breadth-First Search
  • Depth-First Search (backtracking)
  • Uniform Cost Search
  • Informed or Heuristic Search

9
Breadth-First Search Algorithm
yes
Expand n. Put successors at the end of
OPEN pointers back to n
yes
10
Breadth-First Search Example
What is in OPEN when node 6 expanded ? How many
nodes should have been expanded to find the goal ?
11
Depth-First Search Algorithm
yes
yes
12
Depth-First Search Example
What is in OPEN when node 6 expanded ? How many
nodes should have been expanded to find the goal ?
13
Comparison of BFS and DFS
  • BFS always terminate if goal exist
  • cf. DFS on locally finite infinite tree
  • Gurantee shortest path to goal - BFS
  • Space requirement
  • BFS - Exponential
  • DFS - Linear,
  • keep children of a single node
  • Which is better ? BFS or DFS ?

14
Iterative Deepening
  • Compromise of BFS and DFS
  • Save on Storage, guarantee shortest path
  • Additional node expansion is negligible

proc Iterative_Deeping_Search(Root) begin
Success 0 for (depth_bound 1
depth_bound Success 1) depth_first_search
(Root, depth_bound) if goal found, Success
1 end
15
Uniform Cost Search
  • A Genaralized version of Breadth-First Search
  • C(ni, nj) cost of going from ni to nj
  • G(n) (tentative minimal) cost of a path from s
    to n.
  • Guarantee to find the minimum cost path
  • Dijkstra Algorithm

16
Uniform Cost Search Algorithm
yes
yes
n goal ?
17
More on Uniform cost Search
  • How do you modify UCS of previous page for
    searching a goal on graph ?
  • Can you apply the iterative deepening idea to the
    uniform cost search ?

18
And/Or Graph
  • Devide a problem into subproblems and solve
    them individually
  • divide and conquer
  • And/Or Graph
  • Node subproblems
  • Links And Link, Or Link
  • And connect parent and subproblems
  • Or represents alternatives

19
And/Or graph examples
  • Tower of Hanoi Puzzle
  • Algebraic Problem solving integration probelm
  • language parsing
  • Game tree

20
Searching And/Or Graph
  • Objective of Search
  • To show whether start node is Solvable?
  • or Unsolvable ?
  • Definition of Solvable
  • Terminal node is solvable
  • A non-terminal OR node is solvable if at least
    one of its successor is solvable
  • A non-terminal AND node is solvable iff all of
    its successors are solvable

21
Searching And/Or Graph
  • Definition of UnSolvable
  • Non-Terminal node with no successor is unsolvable
  • A non-terminal OR node is unsolvable iff all of
    its successors are unsolvable
  • A non-terminal AND node is unsolvable if at least
    one of its successors is unsolvable
  • Search terminate when start node is labeled
    either solvable or unsolvable

22
Solution Graph
  • Subgraph of solvable nodes demonstrating start
    node solvable
  • called strategy in game
  • Search procedure
  • 1. Whenever a terminal generated, apply
    solve-labeling to see start node solvable
  • 2. Whenever a terminal generated, apply
    unsolve-labeling to see start node unsolvable

23
Use of Heuristics
  • Tic-tac-toe

24
Tic-tac-toe
  • Most-Win Heuristics

x
x
x
2 win
3 win
4 win
25
Use of Heuristics
  • 8-Puzzel

1
2
3
3
2
1
8
4
4
8
5
6
5
6
7
7
3
2
3
8
2
2
3
8
1
1
4
4
4
1
8
6
7
7
5
6
7
5
5
6
a
c
b
26
Road Map Problem
s
g
27
Best First Search Algorithm( for tree search)
yes
yes
n goal ?
28
Algorithm A
  • Best-First Algoorithm with f(n) g(n) h(n)
  • where g(n) cost of n from start to node n
  • h(n) heuristic estimate of the
    cost
  • from n to a goal
  • Algorithm is admissible if it terminate with
    optimal solution
  • What if f(n) f(n) where f(n) g(n) h(n)
  • where g(n) shortest cost to n
  • h(n) shortest actual cost from n to goal

29
Algorithm A
  • Algorithm A becomes A if h(n) lt h(n)
  • Algorithm A is admissible
  • can you prove it ?
  • If h(n) 0, A algorithm becomes uniform cost
    algorithm
  • Uniform cost algorithm is admissible
  • If n is on optimal path, f(n) C
  • f(n) gt C implies that n is not on optimal path
  • A terminate in finite graph


30
Best First Search Algorithm (extention for graph
search)
yes
Fail
yes
n goal ?
Expand n. calculate f(.) of successor Put
successors to OPEN pointers back to n
31
Modification for Graph Search
Expand n. For suc in Successor(n) do compute
f(suc) if suc is in OPEN or CLOSE then set
f(suc) to smaller put suc OPEN if not already
in redirect pointer else put suc to OPEN pointers
back to n
32
Monotonicity
  • A heuristic function is monotone if
  • for all states ni and nj suc(ni)
  • h(ni) - h(nj) cost(ni,nj)
  • and h(goal) 0
  • Monotone heuristic is admissible

33
Examples of Admissible Heuristics
  • 8 puzzle heuristic
  • 8 queen problem, Tic-tac-toe
  • Air distance heuristic
  • Traveling Salesperson Problem
  • Mechanical generation of Heuristics
  • Solution with less constrained problems

34
More Informedness
  • For two admissible heuristic h1 and h2, h2 is
    more informed than h1 if
  • h1(n) h2(n) for all n

h(n)
h1(n)
h2(n)
0
35
Iterative Deeping A
  • Modification of A
  • use threshold as depth bound
  • increase threshold as mininum of f(.) of
  • previous cycle
  • Still admissible
  • same order of node expansion
  • Storage Efficient - practical

36
Iterative Deepening A Search Algorithm ( for
tree search)
set threshold as h(s)
yes
threshold min( f(.) , threshold )
yes
n goal ?
Expand n. calculate f(.) of successor if f(suc) lt
threshold then Put successors to OPEN if
pointers back to n
37
Performance Measure
  • Penetrance
  • how search algorithm focus on goal rather than
    wander off in irrelevant directions
  • P L / T
  • Effective Branching Factor (B)
  • B B2 B3 ..... BL T
  • less dependent on L

38
Game Tree Search
  • Game Tree Special case of AND/OR Graph
  • Objective of Game tree Search
  • To find good first move
  • Static Evaluation Funtion e
  • Measure the Worth?of a tip node
  • if p is win for MAX, then e(p)
  • if p is win for MIN, then e(p) -

39
MiniMax Procedure
  • Select the maximum worth alternative
  • Under Assumption of that the opponent do his best
  • Back-Up Value(BUV)
  • 1. At tip node p, BUV is e(p)
  • 2. At AND node, BUV is max. of BUV of children
  • 3. At OR node, BUV is min. of BUV of children

40
MiniMax for Tic-Tac-Toe
  • Two player, X and O, X play first
  • Static Evaluation function
  • If p is not a winning position
  • e(p) (complete rows, coluumns, or diagonal
    that are still open for X) - (complete rows,
    coluumns, or diagonal that are still open for O)
  • If p is a win for X, e(p)
  • if p is a win for O, e(p) -

41
1
-1
X
X
1
X
O
O
-2
6 - 5
X
X
X
O
X
X
O
5 - 4
6 - 4
O
X
5 - 5
6 - 5
O
X
5 - 5
O
O
O
O
X
X
O
X
X
X
O
4 - 5
5 - 6
5 - 5
5 - 6
5 - 5
4 - 6
42
Alpha-Beta Procedure
  • Improvement of MiniMax Procedure
  • combining search procedure evaluation

max
S
A
B
C
1
-2
-1
0
1
43
Alpha-Beta Procedure
  • When we have BUV(A) -1, we know
  • BUV(S) gt -1 (LowerBound ?-value)
  • When we have BUV(C) -2, we know
  • BUV(B) lt -2 (UpperBound ?-value)
  • Final value of B never exceed current value of S.
    We can prune the other children of B.
  • ?-value of MAX never decrease
  • ?-value of MIN never decrease

44
Alpha-Beta Procedure
  • Rules of Discontinuing Search
  • Any MIN node having ?-value lt ?-value of any MAX
    anscester (?-cutoff)
  • Any MAX node having ?-value lt ?-value of any MIN
    anscester (?-cutoff)
  • ?-??value computation during search
  • ?-value of MAX is set to largest final BUV of its
    successor
  • ?-value of MIN is set to smallest final BUV of
    its successor

45
Control and Implementation of State Space Search
  • Recursion-based Search
  • Pattern-Directed Search
  • Production System

46
Recursion-based Search
Function depthsearch(current_state) begin if
current_state is a goal then return(success) add
current_state to CLOSED while current_state has
unexamined children begin child next unexamined
child if child not member of closed then if
depthsearch(child) sucess then
return(sucess) end return(fail) end
47
Pattern Directed Search
  • Use Unification for checking goal satisfaction
  • Recursive search
  • Lugers book page 157

48
Production System
  • Model of Search and Human Problem Solving
  • Heavily used in AI (Expert) system
  • Production System components
  • Production rules (or production)
  • also called Long-term memory
  • Working Memory
  • also called Short-term memory
  • Recognize-act cycle
  • also called control structure, engine

49
Production Rules
  • Production
  • condition part and action part
  • premise and conclusion
  • LHS and RHS
  • Condition Part - pattern matching
  • Action Part - problem solving step
  • Single chunk of knowledge
  • Good for representing Judgmental knowledge

50
Working Memory
  • Description of Current state of World
  • Description will be matched against condition
    part of production to select problem solving
    action
  • Modified by problem solving action

51
Recognize-Act cycle
  • Inference Engine
  • data in WM is matched against condition part of
    every production rules
  • collect all matching productions as conflict set
  • subset of conflict set is selected (by confilct
    resolution) and the selected productions are
    fired.
  • Action of the fired production may modify WM

52
Control of Production System
  • Data Driven vs Goal Driven
  • Forward vs Backward Search
  • Bidrectional Search

53
Implementation
  • OPS5
  • Originally written in LISP
  • Most popular production system
  • Forward chaining system
  • CLIPS
  • C version of OPS5
  • Most portable (available in PC)
Write a Comment
User Comments (0)
About PowerShow.com