geography and cs
play

Geography and CS Where am I? Localization Problem 2 How do I get - PDF document

Maps Problem 1 Geography and CS Where am I? Localization Problem 2 How do I get there? Philip Chan Navigation Localization--Where am I? Cell phone Localization GPSGlobal Positioning System Problem


  1. Maps  Problem 1 Geography and CS  Where am I?  “Localization”  Problem 2  How do I get there? Philip Chan  “Navigation” Localization--Where am I?  Cell phone Localization  GPS—Global Positioning System Problem 1 Localization--Where am I? Localization--Where am I?  Cell phone  Cell phone  Reference points:  Reference points: cell towers  GPS—Global Positioning System  GPS—Global Positioning System  Reference points:  Reference points: satellites 1

  2. Localization--Where am I? Localization--Where am I?  Cell phone  Cell phone  Reference points: cell towers  Reference points: cell towers  Need 3 reference points  GPS—Global Positioning System  GPS—Global Positioning System  Reference points: satellites  Reference points: satellites  How many reference points are needed to fix  How many reference points are needed to fix the location? the location? Localization [2D] Localization--Where am I? (Problem Formulation)  Cell phone  Given (input)  Reference points: cell towers  Coordinates of the reference points  Need 3 reference points  GPS—Global Positioning System  Distances from the reference points  Reference points: satellites  Need 4 reference points,  Find (output)  but 3 are ok if I know that I’m not floating in  Coordinates of the location space above the satellites  How many reference points are needed to fix the location? Localization [2D] Algorithm (Problem Formulation)  Given (input)  What is the mathematical relationship among the variables?  Coordinates of the reference points  ( x 1 , y 1 ), ( x 2 , y 2 ), ( x 3 , y 3 )  Distances from the reference points  d 1 , d 2 , d 3  Find (output)  Coordinates of the location  ( x , y ) 2

  3. Algorithm  What is the mathematical relationship among Navigation the variables?  Hint: given two points [two pairs of (x,y) coordinates], what is the distance between them? Problem 2 Navigation Navigation [Problem understanding] [Problem Formulation]  Finding a route from the origin to the  Given (input) destination  Map  Address of the origin  “Static” directions  Address of the destination  Mapquest, Google maps  Find (output)  Turn-by-turn directions  “Dynamic” on-board directions  GPS navigation  Simplification  if the car deviates from the route, it finds a new route  In the same city, all two-way streets, all left and right turns are allowed, no overpass/tunnels… Navigation Navigation [Problem Formulation  Graph Problem] [Problem Formulation  Graph Problem]  Given (input)  Given (input)  Map  ?  Map  edge=street, vertex=intersection, weight=length  Address of the origin  ?  Address of the origin  vertex  Address of the destination  ?  Address of the destination  vertex  Find (output)  Find (output)  Turn-by-turn directions  ?  Turn-by-turn directions  ?  Simplification  Simplification  In the same city, all two-way streets, all left and  In the same city, all two-way streets, all left and right turns are allowed, no overpass/tunnels… right turns are allowed, no overpass/tunnels… 3

  4. Navigation Map/Street Data (input) [Problem Formulation  Graph Problem]  Given (input)  Need more thoughts:  Map  edge=street, vertex=intersection, weight=length  What do we need to know about the streets?  Address of the origin  vertex  How could they be represented?  Address of the destination  vertex  Find (output)  Turn-by-turn directions  shortest path  Simplification  In the same city, all two-way streets, all left and right turns are allowed, no overpass/tunnels … Map/Street Data (input) Map/Street Data (input)  Tessellation or Vector?  Tessellation or Vector?  Tessellation:  Tessellation: “image” of the streets  Vector:  Vector: “description” of the streets Map/Street data (input) Map/Street data (input)  Vector  Vector  Name  Name  Two end points in x,y coordinates  Two end points in x,y coordinates  Range of house numbers  Range of house numbers  What if the street is curvy (not straight)?  What if the street is curvy (not straight)?  “Polyline”  Additional intermediate x,y coordinates and house numbers  Street name, ( x 1 , y 1 , h 1 ), ( x 2 , y 2 , h 3 ), … 4

  5. Map/Street data (input) Map/Street data (input)  What if a straight street has multiple  What if a straight street has multiple intersections? intersections?  Polyline (like curvy street)  Additional x,y coordinates and house numbers Algorithm Overview Vertices in the graph 1. Preprocessing  What should be a vertex? Convert the map, origin & destination into a  Intersections  graph  How about intermediate points in the polyline 2. Main algorithm of a curvy street? Dijkstra’s shortest path algorithm  3. Postprocessing  Convert shortest path to turn-by-turn directions Vertices in the graph Curvy streets vs intersections  What should be a vertex?  An intermediate point of a polyline could be:  intersection  a vertex  Intersections  part of a curvy street  not a vertex  How about intermediate points in the polyline of a curvy street?  Vector representation:  No, fewer vertices, but need to sum segment distances  Street name, ( x 1 , y 1 , h 1 ), ( x 2 , y 2 , h 3 ), …  (Yes, make program simpler)  How could we tell the difference?  Each vertex corresponds to a pair of x,y coordinates  What is the weight of an edge? 5

  6. Curvy Streets vs Intersections Curvy Streets vs Intersections  Additional info in vector representation  Additional info in vector representation  intersection: Pointer to the cross street s [assuming  intersection: Pointer to the cross street s [assuming only one cross street; a list otherwise] only one cross street; a list otherwise]  curvy street: no pointer  curvy street: no pointer  Street name, ( x 1 , y 1 , h 1, s 1 ), ( x 2 , y 2 , h 2, s 2 ), …  Street name, ( x 1 , y 1 , h 1, s 1 ), ( x 2 , y 2 , h 2, s 2 ), …  No additional info in vector representation  Intersection: Two streets with the same vertex ID  A convenient vertex ID would be? Curvy Streets vs Intersections Converting Address to Vertex  Additional info in vector representation  For the origin and destination  intersection: Pointer to the cross street s [assuming  Given street name and house number only one cross street; a list otherwise]  Create:  curvy street: no pointer One temporary vertex (unless at an intersection)   Street name, ( x 1 , y 1 , h 1, s 1 ), ( x 2 , y 2 , h 2, s 2 ), … Two temporary edges, why?   No additional info in vector representation  Intersection: Two streets with the same vertex ID  A convenient vertex ID would be?  (concatenation of) x, y coordinates  Time-space tradeoffs? Converting Address to Vertex Converting Address to Vertex  For the origin and destination  Tradeoffs between:  Given street name and house number Replace original edge with temporary vertex 1.  Create: & edges [then reverse the process later]  One temporary vertex (unless at an intersection) Add temporary vertex & edges [then reverse the 2.  Two temporary edges, why? process later]  What are the x,y coordinates of the new temporary vertex?  What are the weights of the two new temporary edges? 6

  7. Main Algorithm Main Algorithm—Greedy Algorithm  If you do not know about Dijkstra’s algorithm  Greedy algorithm Pick the closest vertex (shortest edge) 1.  How would you solve the shortest path Go to the vertex 2. problem? Repeat until the destination vertex is reached 3.  Does this always find the shortest path?  If not, what could be a counter example? Main Algorithm-- Dijkstra’s shortest Main Algorithm-- Dijkstra’s shortest path algorithm path algorithm  What are the key ideas?  What are the key ideas?  Similar to BFS:  pick a leaf and expand its children  Different in which leaf to pick, how? Main Algorithm-- Dijkstra’s shortest Main Algorithm-- Dijkstra’s shortest path algorithm path algorithm  What are the key ideas?  What are the key ideas?  Similar to BFS:  Similar to BFS:  pick a leaf and expand its children  pick a leaf and expand its children  Different in which leaf to pick, how?  Different in which leaf to pick, how?  the shortest length so far  the shortest length so far  instead of the fewest # of levels in BFS  instead of the fewest # of levels in BFS  BFS is a special case of Dijkstra’s, why? 7

Recommend


More recommend