graphs david johnson. describing the environment how do you tell a person/robot how to get...

32
Graphs David Johnson

Upload: randall-newton

Post on 17-Jan-2016

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

Graphs

David Johnson

Page 2: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

Describing the Environment

• How do you tell a person/robot how to get somewhere?– Tell me how to get to the student services building…

Page 3: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

World Representation• Landmarks• Paths/Roads• Map

• This is abstracted as a graph– Not in the sense of a plot

Page 4: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

Graphs• A graph is a set of

landmarks and the paths between them

• A graph G has– Set of vertices (or nodes) V– Set of edges E

• A graph is a classic data structure in CS

V1

V2

V3

E1

E2

Page 5: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

Graphs

• A directed graph means – E(A,B) does not imply

E(B,A)– What kind of robot would

need a graph that is not bidirectional?

• Edges may have weights– Where would this be

appropriate?

V1

V2

V3

E1

E2

1.4

2.6

Page 6: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

Paths

• A path is a sequence of vertices such that for Vi and Vi+1 Ei,i+1 exists

• A graph is connected if there is a path between all V– For what kind of robot and

environment would this not be true?

V1

V2

V3

E1

E2

1.4

2.6

Page 7: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

Imagine a simple robot• What is the simplest

kind of robot you can think of?

Page 8: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

Point Robots

• A point robot can move along the infinitesimal width edges of a graph.

• Path planning for this simple case is just searching a graph for a path.

Page 9: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

Finding Paths

• Given a start and end, how do we find a path between them? V1

V2

V1V3

V4

V7

V6

V8

V5

Page 10: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

Depth First Search (DFS)

• Always take the first option

V1

V2

V1V3

V4

V7

V6

V8

V5

Page 11: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

Depth First Search (DFS)

• Always take the first option

V1

V2

V1V3

V4

V7

V6

V8

V5

Page 12: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

Depth First Search (DFS)

• Always take the first option

V1

V2

V1V3

V4

V7

V6

V8

V5

Page 13: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

Depth First Search (DFS)

• Always take the first option

V1

V2

V1V3

V4

V7

V6

V8

V5

Page 14: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

Depth First Search (DFS)

• Always take the first option

V1

V2

V1V3

V4

V7

V6

V8

V5

Page 15: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

Depth First Search (DFS)

• Always take the first option

V1

V2

V1V3

V4

V7

V6

V8

V5

Page 16: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

Depth First Search (DFS)

• Always take the first option

V1

V2

V1V3

V4

V7

V6

V8

V5

Page 17: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

Breadth First Search (BFS)

• Exhaust all possibilities at same level first V1

V2

V1V3

V4

V7

V6

V8

V5

Page 18: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

Breadth First Search (BFS)

• Exhaust all possibilities at same level first V1

V2

V1V3

V4

V7

V6

V8

V5

Page 19: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

Breadth First Search (BFS)

• Exhaust all possibilities at same level first V1

V2

V1V3

V4

V7

V6

V8

V5

Page 20: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

Breadth First Search (BFS)

• Exhaust all possibilities at same level first V1

V2

V1V3

V4

V7

V6

V8

V5

Page 21: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

Representing a graph in Matlab

• Demo

Page 22: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

Wavefront planner

• Use BFS on a grid• Label cells with values

– Start with zero– Expand from start – Add +1 to neighbors of current wavefront– Use gradient descent to search from goal to

start

Page 23: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

Representations: A Grid

• Distance is reduced to discrete steps– For simplicity, we’ll assume distance is uniform

• Direction is now limited from one adjacent cell to another

Page 24: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

Representations: Connectivity

• 8-Point Connectivity– (chessboard metric)

• 4-Point Connectivity– (Manhattan metric)

Page 25: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

The Wavefront Planner: Setup

Page 26: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

The Wavefront in Action (Part 1)

• Starting with the goal, set all adjacent cells with “0” to the current cell + 1– 4-Point Connectivity or 8-Point Connectivity?– Your Choice. We’ll use 8-Point Connectivity in our example

Page 27: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

The Wavefront in Action (Part 2)

• Now repeat with the modified cells– This will be repeated until goal is reached

• 0’s will only remain when regions are unreachable

Page 28: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

The Wavefront in Action (Part 3)

• Repeat again...

Page 29: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

The Wavefront in Action (Part 4)

• And again...

Page 30: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

The Wavefront in Action (Part 5)

• And again until...

Page 31: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

The Wavefront in Action (Done)

• You’re done

Page 32: Graphs David Johnson. Describing the Environment How do you tell a person/robot how to get somewhere? –Tell me how to get to the student services building…

The Wavefront

• To find the shortest path simply always move toward a cell with a lower number– The numbers generated by the Wavefront planner are roughly

proportional to their distance from the goal

Twopossibleshortestpathsshown