Problem Spaces & Search CSE 473. © Daniel S. Weld 2 473 Topics Agents & Environments Problem Spaces...

30
Problem Spaces & Search CSE 473
  • date post

    20-Dec-2015
  • Category

    Documents

  • view

    212
  • download

    0

Transcript of Problem Spaces & Search CSE 473. © Daniel S. Weld 2 473 Topics Agents & Environments Problem Spaces...

Problem Spaces & Search Problem Spaces & Search

CSE 473

© Daniel S. Weld 2

473 Topics 473 Topics

Agents & EnvironmentsProblem SpacesSearch & Constraint SatisfactionKnowledge Repr’n & Logical ReasoningMachine LearningUncertainty: Repr’n & ReasoningDynamic Bayesian NetworksMarkov Decision Processes

© Daniel S. Weld 3

Weak MethodsWeak Methods

“In the knowledge lies the power…”

[Feigenbaum]

But what if no knowledge????

© Daniel S. Weld 4

Generate & TestGenerate & Test

As weak as it gets…

Works on semi-decidable problems!

© Daniel S. Weld 5

Example: Fragment of 8-Puzzle Problem Space

Example: Fragment of 8-Puzzle Problem Space

© Daniel S. Weld 6

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

© Daniel S. Weld 7

Example: Route PlanningExample: Route Planning

Input:•Set of states

•Operators [and costs]

•Start state

•Goal state (test)

Output:

© Daniel S. Weld 8

Example: N QueensExample: N Queens

Input:•Set of states

•Operators [and costs]

•Start state

•Goal state (test)

Output

Q

Q

Q

Q

© Daniel S. Weld 9

Example: Blocks World

Example: 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

© Daniel S. Weld 10

Multiple Problem Spaces

Multiple Problem Spaces

Real WorldStates of the world (e.g. block configurations)

Actions (take one world-state to another)

Problem Space 1PS states =

models of world statesOperators =

models of actions

Robot’s Head

Problem Space 2PS states =

partially spec. plan

Operators =

plan modification ops

© Daniel S. Weld 11

Classifying SearchClassifying SearchGUESSING (“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

© Daniel S. Weld 12

RoadmapRoadmapGuessing – State Space Search1. BFS2. DFS3. Iterative Deepening4. Bidirectional5. Best-first search6. A*7. Game tree8. Davis-Putnam (logic)9. Cutset conditioning (probability)

Simplification – Constraint Propagation1. Forward Checking2. Path Consistency (Waltz labeling, temporal

algebra)3. Resolution4. “Bucket Algorithm”

Wandering – Randomized Search1. Hillclimbing2. Simulated annealing3. Walksat4. Monte-Carlo Methods

Constraint Satisfaction

© Daniel S. Weld 13

Search Strategies v2

Blind Search

Informed Search

Constraint Satisfaction

Adversary Search

• Depth first search• Breadth first search• Iterative deepening search• Iterative broadening

search

© Daniel S. Weld 14

Depth First SearchDepth First Search

a

b

c d

e

f g h

Maintain stack of nodes to visitEvaluation

• Complete?

• Time Complexity?

• Space Complexity?Not for infinite spaces

O(b^d)

O(d)

© Daniel S. Weld 15

Breadth First SearchBreadth First Search

a

b c

d e f g h

Maintain queue of nodes to visitEvaluation

• Complete?

• Time Complexity?

• Space Complexity?Yes

O(b^d)

O(b^d)

© Daniel S. Weld 16

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

© Daniel S. Weld 17

Iterative Deepening Search

Iterative Deepening Search

a b

c d

e

f

g h

DFS with limit; incrementally grow limitEvaluation

• Complete?

• Time Complexity?

• Space Complexity?Yes

O(b^d)

O(d)j

i

k L

© Daniel S. Weld 18

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

© Daniel S. Weld 19

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

BFSNodes 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

© Daniel S. Weld 20

When to Use Iterative Deepening

When to Use Iterative Deepening

N Queens?Q

Q

Q

Q

© Daniel S. Weld 21

Search Space with

Uniform Structure

Search Space with

Uniform Structure

© Daniel S. Weld 22

Search Space with

Clustered Structure

Search Space with

Clustered Structure

© Daniel S. Weld 23

Iterative Broadening Search

Iterative Broadening Search

What if know solutions lay at depth N?

No sense in doing iterative deepening

a

b

c

d

e

f g

h

i j

© Daniel S. Weld 24

Forwards vs. BackwardsForwards vs. Backwardsst

art

end

© Daniel S. Weld 25

vs. Bidirectionalvs. Bidirectional

© Daniel S. Weld 26

ProblemProblem

All these methods are slow (blind)

Solution add guidance (“heurstic estimate”)

“informed search”

… next time …

© Daniel S. Weld 27

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

© Daniel S. Weld 28

CryptarithmeticCryptarithmetic

SEND

+ MORE

------

MONEY

Input:• Set of states

• Operators [and costs]

• Start state

• Goal state (test)

Output:

© Daniel S. Weld 29

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:

© Daniel S. Weld 30

Symbolic IntegrationSymbolic Integration

E.g. x2ex dx =

ex(x2-2x+2) + C

Operators: Integration by parts

Integration by substitution