Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

29
www.spatialanalysisonline.com Chapter 7 Part A: Network analysis

Transcript of Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

Page 1: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

www.spatialanalysisonline.com

Chapter 7

Part A: Network analysis

Page 2: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

3rd edition www.spatialanalysisonline.com 2

Network analysis

Networks – basic components: Collections of interconnected linear forms:

Lines (or Edges, E) Intersections (or Vertices, V) Regions (or Cells, C) - created by the partitioning of

space by the lines Planar - e.g. streets, all on same level, vertices

at every intersection of edges Non-planar - e.g. airline routes, highways with

bridges/flyovers, electronic circuits

Page 3: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

3rd edition www.spatialanalysisonline.com 3

Network analysis

Sample problems: Shortest (least time/cost) between vertices (SPA) Shortest path (tree) connecting all vertices (MST) Shortest route visiting all locations once and returning to

start point (Travelling Salesman Problem, or TSP) Minimum cost of constructing a network between a set

of vertices Identification of zones within specified travel time/cost Designing a network with minimum cost of USE Designing a network with minimum travel time to

specified vertices Including constraints, e.g. edge capacity, maximum

distances/times permitted, vehicle capacity

Page 4: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

3rd edition www.spatialanalysisonline.com 4

Network analysis

Networks – basic components: Directed (with predefined directions or flows) Non-directed (symmetric access/flows) Common level or hierarchical Abstracted as graphs and/or tables Connected or collection of sub-graphs Principal forms:

Paths, trees, circuits, cells

Page 5: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

3rd edition www.spatialanalysisonline.com 5

Network analysis

Networks – basic components: Degree (of a vertex) Path Connected graph Cycles/circuits Tree

Page 6: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

3rd edition www.spatialanalysisonline.com 6

Network analysis

Networks – basic components:

Paths - edges and vertices Tree - no circuits Circuit Cells: V-E+C=2

Intermediate data coding points - not vertices - can be

ignored/eliminated

Page 7: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

3rd edition www.spatialanalysisonline.com 7

Network analysis

Networks – compare topologies:

Page 8: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

3rd edition www.spatialanalysisonline.com 8

Network Analysis

Vertex connectivity or adjacency matrix: Symmetric, binary, 0=non-connected or self-connected, sparse; positive valued

To vertex

From vertex

Networks: Binary connectivity matrix

Page 9: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

3rd edition www.spatialanalysisonline.com 9

Network analysis

Networks – basic components: Direction

tree networks may have a consistent direction• e.g. river flows, broadcast data communications

circuit networks may have mixture of directions closed ‘circuits’ may exist in directed networks

Magnitude (edge length, time, cost…) Volume (flow from vertex to vertex) Weights/demand at vertices

Page 10: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

3rd edition www.spatialanalysisonline.com 10

Network analysis

Networks: Source data Network construction

Set of points in the plane Existing network to be augmented

Network analysis Existing set of vertices, edges and associated

attribute data A pre-defined or imposed topology Data representation issues

Page 11: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

3rd edition www.spatialanalysisonline.com 11

Network analysis

Networks – sample attributes: turn attributes at intersections: permitted/not-

permitted, turn penalties, U-turn permissions definition of weights/impedances, by direction definition of one-way edges and their direction specification of any permanent or temporary

barriers demand and capacity constraint levels (edge

and/or vertex based)

Page 12: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

3rd edition www.spatialanalysisonline.com 12

Network analysis

Computational complexity Optimisation problems and decision-making

Provably optimal Provably within defined bounds of optimality Good in practice

Big ‘O’ notation and complexity Polynomial (P): e.g. O(n2) and O(nlogn)

• O(logn)<O(n)<O(nlogn)<O(n2), n>3 Non-polynomial (NP): e.g. O(n!) and O(2n)

• O(2n)<<O(n!), n>3 NP-complete problems Heuristics

Page 13: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

3rd edition www.spatialanalysisonline.com 13

Network analysis

Key problems - 1: Hamiltonian circuit (HC) – NP-complete Eulerian circuit (EC) Shortest path (SP) – P (linear--) Spanning tree (ST) Minimal spanning tree (MST) – P (linear--) Steiner MST – NP-complete Steiner tree – NP-complete Travelling salesman problem (TSP) – NP-

complete

Page 14: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

3rd edition www.spatialanalysisonline.com 14

Network analysis

Key problems – 2: NP-hard or NP-complete: Vehicle routing problems (VRP) Transportation problems Trans-shipment problems Arc routing problems (ARP) Facility location on a network:

p‑median/p‑centre/coverage

Page 15: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

3rd edition www.spatialanalysisonline.com 15

Network analysis

Typical problem parameters: Objective function (e.g. length, cost, time…) Constraints on the path (e.g. direct or via specified nodes) Input geometry (e.g. obstacles/barriers) Dimension of the problem (2D, planar?) Type of moving object (simple, constraints, friction) Single shot vs. repetitive mode queries (e.g. 1st, 2nd..) Static vs. dynamic environments Exact vs. approximate algorithms Known vs. unknown map

Page 16: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

3rd edition www.spatialanalysisonline.com 16

Network analysis

Example logistics software facilities: vehicle routing taking one-way streets into account trip routing taking restricted junctions into account varying speeds by road type and time of day trip routing of vehicles to avoid toll roads and toll bridges delivery routing taking account of customer access

constraints by time of day night time/weekend truck routing controls weight and height restrictions (e.g. for truck routing) vehicle routing costs per mile/km and/or per hour weight/climb related vehicle routing costs

Page 17: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

3rd edition www.spatialanalysisonline.com 17

Network analysis

Minimum spanning tree connect every point to its nearest neighbour —

typically this will result in a collection of unconnected sub-networks

connect each sub-network to its nearest neighbour sub-network

iterate step 2 until every sub-network is inter-connected

Page 18: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

3rd edition www.spatialanalysisonline.com 18

Network analysis

Minimum spanning tree (Euclidean)A. Point set (nodes or vertices)

B. MST

Page 19: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

3rd edition www.spatialanalysisonline.com 19

Network analysis

Gabriel networkA. Gabriel network construction

B. Gabriel network

included

excluded

Page 20: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

3rd edition www.spatialanalysisonline.com 20

Network analysis

Steiner tree (unweighted, Euclidean)A. MST B. MST with 1 Steiner point

Page 21: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

3rd edition www.spatialanalysisonline.com 21

Network analysis

Shortest paths Input: existing network, source vertex (s) and

target vertex (t) or vertices Output: shortest path – length, d(t), and vertex

list; set of shortest paths (1st, 2nd,… shortest); source to all vertices (shortest path tree)

Solve by systematic search algorithm (single paths in near linear time)

Large problems solve by A* heuristics

Page 22: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

3rd edition www.spatialanalysisonline.com 22

Network AnalysisDantzig Shortest path algorithm (SPA)

s=1, t=3:

Step 1: identify the shortest (least distance/cost/time) link from vertex 1 - this is to vertex 2 (cost = 4). Add vertex 2 and link from 1 to 2 to the tagged set

Step 2: identify the shortest (least cost/time) link from vertex 1 or from vertex 2 plus link 1 distance - this is to vertex 4 from 2 (cost=6). Add vertex 4 and link 2 to 4 to the tagged set

Step 3: identify the shortest (least cost/time) link from the tagged set - this is from vertex 1 to 2 to 4 to 3 (cost=7)

Stop - all vertices reached; repeat from vertex 2, 3 and 4

Page 23: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

3rd edition www.spatialanalysisonline.com 23

Network analysis

SPA: Dijkstra algorithm 1: initialise all vertices such that d(t)= and d(s)=0 2: For each edge leading from s, add the edge length

from s to the current value of the path length at s. If this new distance is less than the current value for d(t) replace this with the lower value

3: choose the lowest value in the set d(t) and move the current (active) vertex to this location

4: iterate steps 2 and 3 until the target vertex is reached or all vertices have been scanned

Optionally augment with preceding SP vertex list

Page 24: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

3rd edition www.spatialanalysisonline.com 24

Network analysis

SPA – sample problem – specified tourA. Delivery locations and road barriers

B. Solution (sequential tour from 1-4)

S T

Obstacles

Page 25: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

3rd edition www.spatialanalysisonline.com 25

Network analysis

Travelling salesman problems (TSPs) Basic problem: given N locations in the plane, what is the

shortest complete circuit Very difficult to solve for N large (NP-complete) Modest sized problems can be solved exactly, e.g. by systematic

tree-based search, LP + cutting planes Larger problems can be ‘solved’ using heuristic methods, e.g.

Genetic Algorithms, Cross-entropy methods, Simulated annealing

Applications: salesmen visiting customers; rubbish trucks servicing business premises; delivery trucks servicing retail outlets; security staff patrolling premises; VLSI design; analysis of DNA sequences…

Page 26: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

3rd edition www.spatialanalysisonline.com 26

Network analysis

Sample TSP problem and exact solutionA. Source vertices (130) – from TSPLib B. Exact TSP solution (Concorde)

Page 27: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

3rd edition www.spatialanalysisonline.com 27

Network analysis

Sample TSP problem and heuristic solution (L-K)A. Source vertices (130) – from TSPLib B. Heuristic TSP solution

Page 28: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

3rd edition www.spatialanalysisonline.com 28

Network analysis

Travelling salesman problems - extensions Multiple tours (e.g. divided point set) Should the tours start at the same point (e.g.

warehouse, bus depot…?) What if demand varies across the target points? Capacity constraints – e.g. service vehicles may have

limited capacity and vary in type ― what mix would be optimal?

do tours/deliveries have to be made in certain time windows?

Page 29: Www.spatialanalysisonline.com Chapter 7 Part A: Network analysis.

3rd edition www.spatialanalysisonline.com 29

Network analysis

Drive time zones Network-derived zones of

equal time from sample location

Created as polygon layer(s) Can use map algebra

techniques to compute estimated demand

May include differential speeds for route type and off-road

Can be slow to generate