Le Lecture ture 3 AI AI ap appl plicatio ications, ns, Un - - PowerPoint PPT Presentation

le lecture ture 3
SMART_READER_LITE
LIVE PREVIEW

Le Lecture ture 3 AI AI ap appl plicatio ications, ns, Un - - PowerPoint PPT Presentation

Computer Science CPSC 322 Le Lecture ture 3 AI AI ap appl plicatio ications, ns, Un Uninf nform ormed ed Se Sear arch h St Strat ategies egies (Ch Ch 3. 3.1-3.4) 3.4) 1 Todays Lecture Discussion on AI applications


slide-1
SLIDE 1

Computer Science CPSC 322

Le Lecture ture 3

AI AI ap appl plicatio ications, ns, Un Uninf nform

  • rmed

ed Se Sear arch h St Strat ategies egies (Ch Ch 3. 3.1-3.4) 3.4)

1

slide-2
SLIDE 2

Today’s Lecture

  • Discussion on AI applications
  • Search
  • Search Spaces
  • Generic Search Algorithm
  • Uninformed Search (time permitting)
  • Depth first

2

slide-3
SLIDE 3

AI a I agents ents in in th this is course rse

Would like most general agents possible, but in this course we need to restrict ourselves to:

  • Flat representations (vs. hierarchical)
  • Knowledge given (vs. knowledge learned)
  • Goals and simple preferences (vs. complex preferences)
  • Single-agent scenarios (vs. multi-agent scenarios)

We will look at

  • Deterministic and stochastic domains
  • Static and Sequential problems

And see examples of representations using

  • Explicit state or features or relations

3

slide-4
SLIDE 4

AI Application

  • Today, we will look at some AI applications that

you have found for your assignment 0

  • You are asked to described them in terms of the

elements above and some more

4

slide-5
SLIDE 5
  • What does it do
  • Goals
  • prior knowledge needed
  • past experiences that it does (or could) learn from
  • Observations needed
  • Actions performed
  • AI technologies used
  • Why is it intelligent?
  • Evaluation?

5

slide-6
SLIDE 6

Today’s Lecture

  • Discussion on AI applications
  • Search
  • Search Spaces
  • Generic Search Algorithm
  • Uninformed Search
  • Depth first

6

slide-7
SLIDE 7

Represent presentational ational Dim imensions ensions

En Environmen nment

7

Problem lem Type Query Planning Deterministic Stochastic Constraint Satisfaction

Search Arc Consistency Search Search Logic gics ST STRIPS Variab riables les + + Cons nstra train ints ts Value Iteration Variable Elimination Baye yesia sian Nets Decis cision ion Nets

Markov kov Processe esses Static atic Sequential ntial

Representatio esentation Reasoning Technique

Variable Elimination

slide-8
SLIDE 8

Slide 8

  • Search is a key computational mechanism in many AI agents
  • We study the basic principles of search via a simple

deterministic search agent model

Recap cap

  • Agent is in a start

art state ate

  • Agent is given a goal

goal (subset of possible states)

  • Environment changes only when the agent acts
  • Agent perfectly knows:
  • actions

ns that can be applied in any given state

  • the state

ate it is going to end up in when an action is applied in a given state

  • The sequence of actions (and appropriate ordering)

taking the agent from the start state to a goal state is the solut lution ion

slide-9
SLIDE 9

Defini finition tion of a f a se search arch problem

  • blem

9

  • Init

itial ial state(s) ate(s)

  • Set of actions

ions (operators) available to the agent

  • An action

ion funct ction ion that, given a state and an action, returns a new state

  • Goal

l state(s) ate(s)

  • Search

ch space: set of states that will be searched for a path from initial state to goal, given the available actions

  • states

tes ar are node nodes s and actions ions are e lin links between them.

  • Not necessarily given explicitly (state space might be

infinite)

  • Path

h Co Cost t (we ignore this for now)

slide-10
SLIDE 10

Search Space for the Delivery Robot

10

slide-11
SLIDE 11

Today’s Lecture

  • Discussion on AI applications
  • Search
  • Search Spaces
  • Generic Search Algorithm
  • Uninformed Search
  • Depth first

11

slide-12
SLIDE 12

Example: mple: vacuum uum world rld

Slide 12

Possible start state Possible goal state

  • States
  • Two rooms: r1, r2
  • Each room can be

either dirty or not

  • Vacuuming agent can

be in either in r1 or r2

slide-13
SLIDE 13

Example: mple: vacuum uum world rld

Slide 13

  • States
  • Two rooms: r1, r2
  • Each room can be

either dirty or not

  • Vacuuming agent can

be in either in r1 or r2

Feature-based representation:

  • Features?
  • how many states?

Possible start state Possible goal state

slide-14
SLIDE 14

Example: mple: vacuum uum world rld

Slide 14

  • States
  • Two rooms: r1, r2
  • Each room can be

either dirty or not

  • Vacuuming agent can

be in either in r1 or r2

Feature-based representation:

  • Features?
  • how many states?

Possible start state Possible goal state

slide-15
SLIDE 15

Suppose we have the same problem with k rooms. The number of states is….

16

  • D. 2 * kk
  • A. k3
  • C. k * 2k
  • B. k * 2k

…..

slide-16
SLIDE 16

Suppose we have the same problem with k rooms. The number of states is….

17

  • D. 2 * kk
  • A. k3
  • C. k * 2k
  • B. k * 2k

…..

Loc() feature can take k possible values For each room i, dirty_room_i can take 2 values, and there are k of these features

slide-17
SLIDE 17

Search Space

18

  • Actions – left, right, suck
  • Successor states in the graph describe the effect of each

action applied to a given state

  • Possible Goal – no dirt
slide-18
SLIDE 18

Search Space

19

  • Actions – left, right, suck
  • Successor states in the graph describe the effect of each

action applied to a given state

  • Possible Goal – no dirt
slide-19
SLIDE 19

Search Space

20

  • Actions– left, right, suck
  • Successor states in the graph describe the effect of each

action applied to a given state

  • Possible Goal – no dirt
slide-20
SLIDE 20

Search Space

21

  • Actions – left, right, suck
  • Successor states in the graph describe the effect of each

action applied to a given state

  • Possible Goal – no dirt
slide-21
SLIDE 21

Search Space

22

  • Actions – left, right, suck
  • Successor states in the graph describe the effect of each

action applied to a given state

  • Possible Goal – no dirt
slide-22
SLIDE 22

Eight Puzzle

23

slide-23
SLIDE 23

Eight Puzzle

States: each state specifies which number/blank occupies each

  • f the 9 tiles

HOW MANY STATES ? Actions: Goal:

24

slide-24
SLIDE 24

Eight Puzzle

States: each state specifies which number/blank occupies each

  • f the 9 tiles

HOW MANY STATES ? Actions: Goal:

9!

25

slide-25
SLIDE 25

Eight Puzzle

States: each state specifies which number/blank occupies each

  • f the 9 tiles

HOW MANY STATES ? Actions: blank moves left, right, up down Goal: configuration with numbers in right sequence

9!

26

slide-26
SLIDE 26

Search arch space ce fo for 8puzzle uzzle

Slide 27

slide-27
SLIDE 27

Search arch space ce fo for 8puzzle uzzle

Slide 28

slide-28
SLIDE 28

How w can we fi find a so soluti lution?

  • n?

Slide 29

  • How can we find a sequence of actions and their

appropriate ordering that lead to the goal?

  • Need smart ways to search the space

ce gra raph

slide-29
SLIDE 29

Today’s Lecture

  • Discussion on AI applications
  • Search
  • Search Spaces
  • Generic Search Algorithm
  • Uninformed Search (time permitting)
  • Depth first

30

slide-30
SLIDE 30

Search: arch: Abstract stract Defini finition tion

Slide 31

How to search

  • Start at the start state
  • Evaluate the effect of taking different actions starting from

states that have been encountered in the search so far

  • Stop when a goal state is encountered

To make this more formal, we'll use the definition of a graph that you were asked to review for today

slide-31
SLIDE 31
  • A directed graph consists of a set N of nodes

(vertices) and a set A of ordered pairs of nodes, called edges (arcs).

  • Node n2 is a neighbor of n1 if there is an arc from n1

to n2. That is, if  n1, n2   A.

  • A path is a sequence of nodes n0, n1,..,nk such that

 ni-1, ni   A.

  • A cycle is a non-empty path such that the start node

is the same as the end node.

  • A directed acyclic graph (DAG) is a graph with no

cycles

  • Given a set of start nodes and goal nodes, a solution

is a path from a start node to a goal node

Gr Grap aphs hs

32

slide-32
SLIDE 32

Grap aph h spe pecifica ificati tion

  • n fo

for th the e Del elive very ry Rob

  • bot
  • t

33

N={mail, ts, o103, b3, o109,...} A={ 〈ts,mail〉, 〈o103,ts〉, 〈o103,b3〉, 〈o103,o109〉, ...} One of several solution paths: 〈o103, o109, o119, o123, r123〉

slide-33
SLIDE 33
  • Generic search algorithm:
  • given a graph, start nodes, and goal

nodes, incrementally explore paths from the start nodes.

  • Maintain a frontier of paths that have

been explored from the start node

  • As search proceeds, the frontier expands

into the unexplored nodes until a goal node is encountered.

Gr Graph ph Searching arching

34

The way in which the frontier is expanded defines the search strategy. If there is only one thing you want to remember about search, this is it.

Ends of paths on frontier

slide-34
SLIDE 34

Probl

  • blem

em Solvi lving ng by Gr Graph aph Searchi arching ng

35

Ends of paths

  • n frontier
slide-35
SLIDE 35

Input ut:

  • a graph
  • a set of start nodes
  • Boolean procedure goal(n) testing if n is a

goal node frontier:= [<s>: s is a start node]; While ile frontier is not empty: select lect and remove emove path <no,….,nk> from frontier; If If goal( al(nk) return urn <no,….,nk>; For r every ery neighbor n of nk, add add <no,….,nk, n> to frontier; end end

Ge Gene neric ic Se Sear arch h Al Algo gorith ithm

36

  • The goal function defines what is a solution.
  • Which path is selected from the frontier defines the search strategy.

Ends of paths on frontier

slide-36
SLIDE 36

Slide 37

Com

  • mpa

paring ring Sea earch ching ng Algo gorithms: thms: Will it fi t find nd a s a sol

  • luti

ution

  • n?

? th the bes e best t on

  • ne?

e?

Def. . : A search algorithm is complete lete if, whenever there is at least one solution, the algorithm is guaran antee teed d to find nd it within a finite amount of time. De Def.: .: A search algorithm is optima imal if, when it finds a solution, it is the best st one

slide-37
SLIDE 37

Slide 38

Com

  • mpa

paring ring Se Sear arch ching ng Al Algo gorithms thms: : Com

  • mpl

plexity exity

De Def.: .: The tim ime complexity lexity of a search algorithm is the wo worst- case amount of tim ime it will take to run, expressed in terms of

  • maximum path length m

m

  • maximum branching factor b.

De Def.: .: The space e complexi xity ty of a search algorithm is the wo worst-ca case se amount of memory

  • ry that the algorithm will

use (i.e., the maximum number of nodes on the frontier),

  • also expressed in terms of m and b.

Branching factor b of a node in a graph is the number of arcs going out of the node

slide-38
SLIDE 38
  • The branching factor of a node is the number of

arcs going out of the node

  • If the forward branching factor of a node is b and

the graph is a tree, how many nodes are n steps away from that node?

Cli licker ker Qu Questions: stions: Branching anching Fa Factor tor

39

  • C. nb
  • A. nb
  • B. bn
  • D. n/b
slide-39
SLIDE 39
  • The branching factor of a node is the number of arcs

going out of the node

  • If the forward branching factor of a node is b and the

graph is a tree, how many nodes are n steps away from that node?

Branching anching Fa Factor tor

40

  • B. bn
slide-40
SLIDE 40

Learning Goals for today’s class

  • Identify real world examples that make use of

deterministic, goal-driven search agents

  • Formalize these examples in terms the

components of a search problem

  • Assess the size of the search space of a given

search problem.

  • Implement the generic solution to a search

problem.

  • Define completeness, optimality, time complexity

and space complexity for search algorithms

slide-41
SLIDE 41
  • Start Heuristic Search: Ch 3.6

TO TODO

  • Work on Pr

Practice tice Ex Exerc rcise ise 3A and 3.B in AI space (link also on class schedule)

  • http://www.aispace.org/exercises.shtml
  • Not for marks, but useful to review material from today’s

lecture and get ready for the next class

42