problem spaces & search cse 573. © daniel s. weld 2 logistics mailing list reading ch 4.2, ch 6...
TRANSCRIPT
![Page 1: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/1.jpg)
Problem Spaces & Search Problem Spaces & Search
•CSE 573
![Page 2: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/2.jpg)
© Daniel S. Weld 2
LogisticsLogistics
•Mailing list•Reading
•Ch 4.2, Ch 6•Mini-Project I
•Partners
•Game Playing?
![Page 3: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/3.jpg)
© Daniel S. Weld 3
573 Topics 573 Topics
Agency
Problem Spaces
Search
Knowledge Representation
Reinforcement
Learning Inference Planning
SupervisedLearning
Logic-Based Probabilistic
Multi-agent NLP SoftboticsRobotic
s
![Page 4: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/4.jpg)
© Daniel S. Weld 4
Weak MethodsWeak Methods
•“In the knowledge lies the power…”• [Feigenbaum]
•But what if you have very little knowledge????
![Page 5: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/5.jpg)
© Daniel S. Weld 5
Generate & TestGenerate & Test
•As weak as it gets…
•Works on semi-decidable problems!
![Page 6: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/6.jpg)
© Daniel S. Weld 6
Mass SpectrometryMass Spectrometry
Rel
ativ
e ab
un
dan
ce
m/z value
C 12O 4
N 2H 20
+
![Page 7: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/7.jpg)
© Daniel S. Weld 7
Example: Fragment of 8-Puzzle Problem
Space
Example: Fragment of 8-Puzzle Problem
Space
![Page 8: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/8.jpg)
© Daniel S. Weld 8
Search thru a Search thru a
•Set of states•Operators [and costs]•Start state•Goal state [test]
•Path: start a state satisfying goal test
•[May require shortest path]
•Input:
•Output:
Problem Space / State Space Problem Space / State Space
![Page 9: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/9.jpg)
© Daniel S. Weld 9
Example: Route Planning
Example: Route Planning
•Input:•Set of states
•Operators [and costs]
•Start state
•Goal state (test)
•Output:
![Page 10: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/10.jpg)
© Daniel S. Weld 10
Example: N QueensExample: N Queens
•Input:•Set of states
•Operators [and costs]
•Start state
•Goal state (test)
•Output
Q
Q
Q
Q
![Page 11: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/11.jpg)
© Daniel S. Weld 11
Ex: Blocks WorldEx: Blocks World• Input:
• Set of states
• Operators [and costs]
• Start state
• Goal state (test)
Partially specified plans
Plan modification operators
The null plan (no actions)
A plan which provably achieves
The desired world configuration
![Page 12: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/12.jpg)
© Daniel S. Weld 12
Multiple Problem Spaces
Multiple Problem Spaces
•Real World• States of the world (e.g. block configurations) • Actions (take one world-state to another)
•Problem Space 1•PS states =
•models of world states
•Operators = •models of actions
Robot’s Head
•Problem Space 2•PS states =
•partially spec. plan•Operators =
•plan modificat’n ops
![Page 13: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/13.jpg)
© Daniel S. Weld 13
Classifying SearchClassifying Search•GUESSING (“Tree Search”)
• Guess how to extend a partial solution to a problem.
• Generates a tree of (partial) solutions.• The leafs of the tree are either “failures”
or represent complete solutions
•SIMPLIFYING (“Inference”)• Infer new, stronger constraints by
combining one or more constraints (without any “guessing”)Example: X+2Y = 3 X+Y =1 therefore Y = 2
•WANDERING (“Markov chain”)• Perform a (biased) random walk through
the space of (partial or total) solutions
![Page 14: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/14.jpg)
© Daniel S. Weld 15
Search Strategies v2
• Blind Search
• Informed Search• Constraint Satisfaction• Adversary Search
• Depth first search• Breadth first search• Iterative deepening
search• Iterative broadening
search
![Page 15: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/15.jpg)
© Daniel S. Weld 16
Depth First SearchDepth First Search
a
b
c d
e
f g h
• Maintain stack of nodes to visit• Evaluation
•Complete?
•Time Complexity?
•Space Complexity?Not for infinite spaces
O(b^d)
O(bd)
d=max depth of tree
![Page 16: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/16.jpg)
© Daniel S. Weld 17
Breadth First SearchBreadth First Search
• Maintain queue of nodes to visit• Evaluation
•Complete?
•Time Complexity?
•Space Complexity?Yes (if branching factor is finite)
O(bd+1)
O(bd+1)
a
b
c d
e
f g h
![Page 17: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/17.jpg)
© Daniel S. Weld 18
Memory a Limitation?Memory a Limitation?
•Suppose:•2 GHz CPU•1 GB main memory•100 instructions / expansion•5 bytes / node
•200,000 expansions / sec•Memory filled in 100 sec … < 2 minutes
![Page 18: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/18.jpg)
© Daniel S. Weld 19
• DFS with limit; incrementally grow limit• Evaluation
•Complete?
•Time Complexity?
•Space Complexity?
Iterative Deepening Search
Iterative Deepening Search
Yes
O(b^d)
O(d)
a
b
c d
e
f g h
![Page 19: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/19.jpg)
© Daniel S. Weld 20
Cost of Iterative Deepening
Cost of Iterative Deepening
b ratio ID to DFS
2 3
3 2
5 1.5
10 1.2
25 1.08
100 1.02
![Page 20: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/20.jpg)
© Daniel S. Weld 21
SpeedSpeed
• 8 Puzzle
• 2x2x2 Rubik’s
• 15 Puzzle
• 3x3x3 Rubik’s
• 24 Puzzle
• 105 .01 sec
• 106 .2 sec
• 1017 20k yrs
• 1020 574k yrs
• 1037 1023 yrs
• BFS• Nodes
Time
• Iter. Deep.
• Nodes Time
• Assuming 10M nodes/sec & sufficient memory
• 105 .01 sec
• 106 .2 sec
• 1013 6 days
• 1019 68k yrs
• 1025 12B yrs
• Adapted from Richard Korf presentation
Why the difference? Rubik has higher branch factor 15 puzzle has greater depth
# of duplicates
8x
1Mx
![Page 21: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/21.jpg)
© Daniel S. Weld 22
When to Use Iterative Deepening
When to Use Iterative Deepening
•N Queens? Q
Q
Q
Q
![Page 22: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/22.jpg)
© Daniel S. Weld 23
Search Space with
Uniform Structure
Search Space with
Uniform Structure
![Page 23: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/23.jpg)
© Daniel S. Weld 24
Search Space with
Clustered Structure
Search Space with
Clustered Structure
![Page 24: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/24.jpg)
© Daniel S. Weld 25
Iterative Broadening SearchIterative Broadening Search• What if know solutions lay at depth
N?• No sense in doing iterative deepening
• Increment sum of sibling indiciesa
b
c
d
e
f g
h
i
![Page 25: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/25.jpg)
© Daniel S. Weld 26
Forwards vs. BackwardsForwards vs. Backwardsst
art
end
![Page 26: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/26.jpg)
© Daniel S. Weld 27
vs. Bidirectionalvs. Bidirectional
![Page 27: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/27.jpg)
© Daniel S. Weld 28
ProblemProblem
•All these methods are slow (blind)
•Solution add guidance (“heurstic estimate”) “informed search”
… coming next …
![Page 28: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/28.jpg)
© Daniel S. Weld 29
Recap: Search thru a Recap: Search thru a
•Set of states•Operators [and costs]•Start state•Goal state [test]
•Path: start a state satisfying goal test
•[May require shortest path]
•Input:
•Output:
Problem Space / State Space
Problem Space / State Space
![Page 29: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/29.jpg)
© Daniel S. Weld 30
CryptarithmeticCryptarithmetic
SEND
+ MORE
------
MONEY
• Input:• Set of states
• Operators [and costs]
• Start state
• Goal state (test)
• Output:
![Page 30: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/30.jpg)
© Daniel S. Weld 31
Concept LearningConcept LearningLabeled Training Examples <p1,blond,32,mc,ok> <p2,red,47,visa,ok> <p3,blond,23,cash,ter> <p4,…
Output: f: <pn…> {ok, ter}
• Input:• Set of states• Operators [and costs]• Start state• Goal state (test)
• Output:
![Page 31: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/31.jpg)
© Daniel S. Weld 32
Symbolic IntegrationSymbolic Integration
•E.g. x2ex dx = • ex(x2-2x+2) + C
Operators: Integration by parts
Integration by substitution
…
![Page 32: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/32.jpg)
© Daniel S. Weld 33
Search Strategies v2
• Blind Search• Informed Search
• Constraint Satisfaction• Adversary Search
• Best-first search• A* search• Iterative deepening A*
search• Local search
![Page 33: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/33.jpg)
© Daniel S. Weld 34
Best-first SearchBest-first Search• Generalization of breadth first search• Priority queue of nodes to be explored• Cost function f(n) applied to each node
Add initial state to priority queueWhile queue not empty Node = head(queue) If goal?(node) then return node
Add children of node to queue
![Page 34: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/34.jpg)
© Daniel S. Weld 35
Old FriendsOld Friends• Breadth first = best first
• With f(n) = depth(n)
• Dijkstra’s Algorithm = best first• With f(n) = g(n), i.e. the sum of edge
costs from start to n• Space bound (stores all generated
nodes)
![Page 35: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/35.jpg)
© Daniel S. Weld 36
A* SearchA* Search• Hart, Nilsson & Rafael 1968
• Best first search with f(n) = g(n) + h(n)• Where g(n) = sum of costs from start to n• h(n) = estimate of lowest cost path n goal
h(goal) = 0• If h(n) is admissible (and monotonic) then A* is
optimal
Underestimates cost of any solution which can reached from node{ f values increase from
node to descendants(triangle inequality)
{
![Page 36: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/36.jpg)
© Daniel S. Weld 44
Optimality of A* Optimality of A*
![Page 37: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/37.jpg)
© Daniel S. Weld 45
Optimality ContinuedOptimality Continued
![Page 38: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/38.jpg)
© Daniel S. Weld 46
A* SummaryA* Summary
• Pros
• Cons
![Page 39: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/39.jpg)
© Daniel S. Weld 47
Iterative-Deepening A*Iterative-Deepening A*• Like iterative-deepening depth-first, but...• Depth bound modified to be an f-limit
• Start with limit = h(start)• Prune any node if f(node) > f-limit• Next f-limit = min-cost of any node
pruned
a
b
c
d
e
fFL=15
FL=21
![Page 40: Problem Spaces & Search CSE 573. © Daniel S. Weld 2 Logistics Mailing list Reading Ch 4.2, Ch 6 Mini-Project I Partners Game Playing?](https://reader036.vdocuments.mx/reader036/viewer/2022062515/56649f4a5503460f94c6c4f9/html5/thumbnails/40.jpg)
© Daniel S. Weld 48
IDA* AnalysisIDA* Analysis• Complete & Optimal (ala A*)• Space usage depth of solution• Each iteration is DFS - no priority queue!• # nodes expanded relative to A*
• Depends on # unique values of heuristic function• In 8 puzzle: few values close to # A* expands• In traveling salesman: each f value is unique
1+2+…+n = O(n2) where n=nodes A* expandsif n is too big for main memory, n2 is too long to wait!
• Generates duplicate nodes in cyclic graphs