Categorizing AI Environments


  • Fully Observable v/s Partially Observable
  • Single Agent v/s Multi Agent
  • Deterministic v/s Non-Deterministic
  • Episodic v/s Sequential
  • Static v/s Dynamic
  • Discrete v/s Continuous
  • Known v/s Unknown

Let's now think about building an AI


Consider the Missionaries and Cannibals game...

Consider the Missionaries and Cannibals game...


SEARCH


Representation: State Space Graph


Nodes: States or World Configurations

Edges: Actions

Edge Weights: Cost of Action

Successor/Transition Function: Set of Edges & Edge Weights

Path: Sequence of Actions


Solution: A Path leading from Start to Goal

SEARCH


Assume a Fully Observable, Static, Deterministic, Known environment (for now)


Let us try and formalize the following problems.

Route Planning


  • State Space
  • Start & End State
  • Successor/Transition Function (Action & Cost)
    • When riding the T?
    • When driving?

Maze Solving


  • State Space
  • Start & End State
  • Successor/Transition Function (Action & Cost)

8 Puzzle


  • State Space
    • How many possible states?
  • Start & End State
  • Successor/Transition Function (Action & Cost)

Chess


  • State Space
    • How many possible states?
  • Start & End State
  • Successor/Transition Function (Action & Cost)

Depth First Search


From start state, explore one branch, until leaf node reached.

If goal not found along path, backtrack to last branch and continue.


Let's try this on an example!

Depth First Search


Depth First Search


Is DFS complete?

Is DFS optimal?


How would you implement it?


Hint: Stacks or Recursion!

Depth First Search


Let's check out how stupid DFS can be.

Breadth First Search


From start state, explore all neighbors.

If goal not found, explore all neighbors of neighbors.


Let's try this on the same example!

Breadth First Search


Breadth First Search


Is BFS complete?

Is BFS optimal?


How would you implement it?


Hint: Queues!

Breadth First Search


Let's check out how expensive BFS can be.

A Hybrid Approach - Iterative Deepening


Run DFS limited to depth of 1.

Run DFS limited to depth of 2.

...

Run DFS limited to depth of n.


A Hybrid Approach - Iterative Deepening


Is Iterative Deepening complete?

Is Iterative Deepening optimal?


Why is this useful?

How much extra work are we doing?

What do BFS, DFS & IDS have in common?


Not Cost Sensitive!

Uninformed Searches - no clue if getting closer to goal

Unnecessary Search Tree Expansion


What can we do?

Uniform Cost Search


Extending BFS to Weighted Graphs

Uniform Cost Search


  • Instead of a queue, use a priority queue
  • Priority is based on the cost of the path
  • Always expand the least costly path

Uniform Cost Search



								function UCS ( G , s, goal ):
									PQ.push( 0, s, [] )
									while PQ is not empty:
										c, v, path = PQ.pop()
										if v not visited:
											mark v as visited
											path.append(v)
											if v == goal:
												return path
											for all neighbors w of v:
												if w not visited:
													PQ.push( c + WT(v, w), w, path )	
						

Towards Informed Search


Heuristics

Estimates of how good the next state is

Approximations, not necessarily exact values

Can often be quickly computed

Examples of

Heuristics


  • Mazes - Distance to goal
  • 8-puzzle - Number of tiles out of place
  • Driving - Straight line distance * constant factor

Properties of

Heuristics



Admissible Heuristics

Never overestimates cost to goal

Consistent Heuristics

For every node $n$ and every successor node $n'$
$h(n) \le c(n \rightarrow n') + h(n')$

Next Class


Greedy Best First Search

A* Search


Project Logistics