AI - Lecture 1b: Route Finding

Chris Thornton


Introduction

The goal in AI is to reproduce intelligent behaviour.

The focus is particularly on replicating thought processes and knowledge representation.

Other approaches, such as Alife, neural networks and robotics, focus more on replication of behaviour.

AI approaches are informed by an

Search as a key concept

A key discovery in AI has been that many forms of knowledge and thought can be represented in terms of a mechanism which

  1. identifies ways in which possible actions can be arranged into sequences

  2. finds a `route' through the sequences which achieves a desired result.

This is the process known as search.

Most AI methods use search in one way or another.

Route finding

In the simplest case, the possible actions are physical transitions from one location to another. starting point to a goal location.

Toy rail map of Europe

Each (blob-connecting) line represents a direct rail connection somewhere in western europe.

Route finding task

Route-finding task

In this problem, action sequences form a tree structure.

At some given point, certain actions are possible.

These actions take you to new points.

At each of those new points, more actions are possible.

And so on.

At each point the possible actions form a branch.

Joining up the branches gives you a tree.

Search by generation

To find a solution, we need to search the tree of possible action sequences looking for one with the right start and finish.

But since the tree doesn't actually exist to begin with, we will have to generate it first.

If we are going to do this, we may as well inspect nodes as we are going along.

So, in practice, `tree generation' and `search' are merged into one process.

Search strategies

The two basic methods of search:

DFS is a `maverick'. BFS is `conservative'.

The two strategies can be illustrated by showing how they generate the search tree for the route-finding problem.

Breadth-first search from `Brussels': step 1

Step 2

Step 3

Step 4

Step 5

Depth-first search from `Brussels': step 1

Step 2

Step 3

Step 4

Step 5

Node expansion

Search completion

The process can end once it has achieved the desired result.

When a node is about to be expanded, a check should be made to see if it is the node we're searching for, i.e., if it's a node representing the goal location.

This is the target or goal node.

As soon as we identify the goal node, a solution to the problem can be generated by listing out the sequence of nodes connecting the start node to the goal node.

Any such sequence of nodes is a path.

A path connecting the start node to the goal node is a solution path.

How much work is involved?

The number of nodes in a search tree multiplies with each new level.

Even simple problems can create search trees which are extremely large.

If we don't want to waste a lot of time using trial-and-error, we need a way of estimating how much work is going to be involved in a particular search.

Branching factor

Time and space complexity are both proportional to the number of nodes in the tree (although as we'll see, space complexity is also strongly affected by the strategy used).

To estimate this, we need to calculate the branching factor, which is just the average number of children of each node.

Next we calculate the depth of the tree, i.e., the expected number of levels.

To estimate the total number of nodes at a particular level, we then raise the branching factor to the relevant degree, i.e., we calculate


where b is the branching factor and d is the depth. This gives the number of nodes at depth d.

Example

Say the branching factor is 3.

The number of states to be processed at level 1 is then 3.

The number to be processed at level 2 is 3 x 3, or


The number to be processed at level 3 is 3 x 3 x 3, or


And so on.

Time and space complexity

The number of nodes at the deepest level of search is a lower bound on the total number of nodes.

For many purposes, deriving this value is sufficient to decide whether or not search is a practical option.

If the expected depth is 8 and the branching factor is 5, a lower bound on the total number of nodes in the space is


To estimate time complexity, we would multiply this by the time it takes to check out a single node.

To estimate space complexity, we would multiply this by the amount of memory it takes to represent a single node.

Again these values would in fact be lower bounds.

.

Summary

Questions

More questions

Exercises

This schematic map of Brighton shows bus routes between a number of locations. A valid bus route is simply a connected sequence of locations.

Exercises cont.

Exercises cont.

Resources