Boland Dumitrescu

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 50

Shortest Paths:

Applications, Variations
and Optimization
Natashia Boland
Irina Dumitrescu

Mathematics and Statistics


University of Melbourne
&
HEC Montreal, Canada Research Chair in
Distribution Management
Outline
Applications of shortest paths
- Minefield path planning
- Approximating piecewise linear functions
- Systems of difference constraints
- DNA sequence alignment
Optimization: linear programming
formulation
Variations of shortest paths
- Resource constraints
- Elementary paths
Minefield Path Planning
Find safe path through naval minefield
- Given starting point and end point
- Location of mines is known accurately

Each mine is considered a potential threat

Risk from a mine decreases with distance from it

Risk at each point in space is total risk from all mines

Total risk for a path is accumulated along the path

Minimize risk
100 Random Mines
A Risk Model
The risk (probability of damage) from the
ith threat (mine) ri(x) at any point x in
space is proportional to the inverse square
of the distance from it:
ri(x)=i(di(x))-2
threat-dependent constant distance from x to mine i

The total risk is the sum of the risks:


r(x) = i r (x)
i
The Risk Model
Loosely speaking, the probability of
successfully completing the path P,
defined as a set of points in space, is

xP
(1-r(x))

where r(x) is the risk at point x.


Maximizing this is equivalent to minimizing
xPc(x)dx = xP(-log(1-r(x))) dx

where c(x) is the additive risk at point x.


Optimal control path
Corridor of Mines
A Local Optimum

Length: 1.41
Total risk: 6195.67
Alternative

Length: 1.41
Total risk: 6195.67

Length: 2.62
Total risk: 115.35
Local vs Global
Continuous approaches can only yield
locally optimal solutions

These may be far from globally optimal

Space discretization gives an


approximate problem but means we
can find a globally optimal solution
Network Model
Discrete points in space form vertex set V

Arcs A connect selected pairs of vertices

Directed graph space discretization G=(V,A)


Regular Grid Discretization
Optimal Risk Path Algorithms
- Zabarankin, Uryasev and Pardalos
Hexagonal Grid Discretization
Path Planning For Unmanned Aerial Vehicles in
Uncertain and Adversarial Environments
- Jun and DAndrea
Network Models
Each arc has risk value given by the integral of c
along the line segment joining the two vertices that
form the endpoints of the arc

Shortest path algorithms find minimum risk paths in


graph G(V, A)

These ideas can be applied to many similar situations


- Submarine sonar avoidance path planning
- Military aircraft radar avoidance path planning
- Commercial aircraft flight planning
- Highway or railway construction
Function Approximation
f(x) a piecewise linear function defined by n points
(x1,y1), (x2,y2),,(xn,yn), where x1 x2 xn

f(x)
(x5,y5) (x6,y6)
(x2,y2)
(x4,y4)

(x7,y7) (x8,y8)
(x3,y3)

(x1,y1)

x
Function Approximation
n is very large: approximate f(x) by g(x)
Restrict attention to g(x) also piecewise linear defined
by (x1,y1), (xn,yn) and a subset of (x2,y2),,(xn-1,yn-1)
f(x)
(x5,y5) (x6,y6)
(x2,y2)
(x4,y4)

(x7,y7) (x8,y8)
(x3,y3)
g(x)
(x1,y1)

x
How Good Is It?
Quality of approximation: measure by [f(xi)-g(xi)]2
n

Find g(x) to minimize [f(x )-g(x )]


i=1
i i
2

Trade off vs number of points used to define g(x)


f(x)
(x5,y5) (x6,y6)
(x2,y2)
(x4,y4)

(x7,y7) (x8,y8)
(x3,y3)

(x1,y1) f(x2)- g(x2)

x
Network Model
Node i for each point i=1,,n

Arc (i,j) defined for all i,j=1,,n with i < j

Arc (i,j) indicates possibility that g(x) uses point (xi,yi)


and then point (xj,yj), i.e. skips points
(xi+1,yi+1),,(xj-1,yj-1)

Arc (i,j) has cost (length) (only if jn)


j-1

[f(x )-g(x )] +
k=i+1 k k
2

Find shortest path from node 1 to node n


1 2 3 4 5 6 7 8

f(x)

(x5,y5) (x6,y6)
(x2,y2)
(x4,y4)

(x7,y7) (x8,y8)
(x3,y3)
g(x)
(x1,y1)

x
1 2 3 4 5 6 7 8

f(x)

(x5,y5) (x6,y6)
(x2,y2)
(x4,y4)

(x7,y7) (x8,y8)
(x3,y3) g(x)

(x1,y1)

x
72

1 2 3 4 5 6 7 8

(22+ 32) + 52 +

f(x) Path length = (22+32)++ 52++ 72 = (22+32+52+72)+2

(x5,y5) (x6,y6)
(x2,y2) 5
(x4,y4)
7
2 3 (x7,y7) (x8,y8)
(x3,y3) g(x)

(x1,y1)

x
Systems of Difference
Constraints
Variables x1, x2,, xn
Constraints xjk xik bk, k=1,,m

Does this system of constraints have a


feasible solution, or not?
Applications
Workforce scheduling
- Fluctuating hourly or daily demands
- Cyclical demands
- Consistentshift structure or work patterns,
e.g. 5 days on, 2 days off per week
- Minimize
number of workers needed to
meet demands

Other similar, e.g. trucks, maintenance


Example
Variables x1, x2, x3, x4
Constraints
x3 x4 5
x4 x1 -10
x1 x3 8
x2 x1 -11
x3 x2 4

Does this system of constraints have a


feasible solution, or not?
+ + + + for any
Network Model
Node i for each variable xi i

Arc for each constraint bij


i j
xj xi bij

Nodes N={1,,n}
Arcs A={(ik,jk) : k=1,,m}
Length of arc (ik,jk) is bk

This is called the constraint graph


Example: Constraint
Graph
Variables x1, x2, x3, x4
Constraints
x3 x4 5 1 -11 2

x4 x1 -10 8 4
-10
x1 x3 8
x2 x1 -11 4 3
5
x3 x2 4
Feasibility Condition
System of difference constraints is feasible

Constraint graph has no negative length cycles

Modified example -11


1 2
x3 x4 5 x2 x1 -11
5
x4 x1 -10 x3 x2 4 -10 4

x1 x3 5 x1 x3 5
4 3
x2 x1 -11 0 -2 5

x3 x2 4 Negative cycle constraints


Feasible Example
Augmented constraint graph:
- Node 0
- Arcs (0,i) for all i=1,,n of length 0

Find shortest path from 0 to all nodes


x3 x4 5 1 -11 2 -11
Solution: 0
x4 x x=1 0 -10 8 4
1 -10
8
x1 x2x=3 -11
-11
x2 x3x=1 -7 4
5
3
-7
0
4
x3 x4x=2 -10 0
-10
Path Optimality
d(j) = label on node j
Optimality means d(j) d(i) length of (i,j)
Solution xj =d(j)
xj xi = d(j) d(i) length of (i,j) = bij

x3 x4 5 1 -11 2 -11
x1 = 0 0
x4 x1 -10 x2 = -11 -10 8 4
x1 x3 8 x3 = -7
x2 x1 -11 x4 = -10 4
5
3
-7
0 -10
x3 x2 4 0
DNA Sequences
Two sequences B and D
- e.g. B = TCCG, D = CTAGC

Convert B to D in a minimal way


- Align matching elements in sequence
- Insert new elements into B (cost a)
- Delete elements from B (cost b)
- Mutate elements in B (cost depends on
elements, e.g. to convert C to G costs g
(C,G))
Example
B C T C C G C

a b g(C,A) a

D C T A G C

Cost = 2a + b + g(C,A)
B T C C G C

g(T,C) g(C,T) g(C,A) a

D C T A G C

Cost = a + g(T,C) + g(C,T) + g(C,A)


Network Model
Sequence B has elements b1,,bN, sequence D has
elements d1,,dM

Node for each pair (i,j), i=0,1,,N, j=0,1,,M


represents decision about matching element bi with dj
(0,0) is the start node, with nothing matched
j=0 indicates deleting element at start of B up to bi+1
i=0 indicates adding new elements at start of B to match
up to dj+1 (i-1,j-1) (i-1,j)

Arc for each option: g(bi,dj)


b
Match (diagonal arc)
Insert new element (horizontal arc) (i,j-1)
a (i,j)
Example Network
D
C T A G C
a
(0,0) (0,1) (0,2) (0,3) (0,4) (0,5)
g(T,C) g(T,T)
T (1,0) (1,1) (1,2) (1,3) (1,4) (1,5)
g(C,T) b
C (Assume
(2,0) (2,1) (2,2) (2,3) (2,4) (2,5)
g(C,A) g(X,X)=0)
B
C (3,0) (3,1) (3,2) (3,3) (3,4) (3,5)
g(G,G)

G (4,0) (4,1) (4,2) (4,3) (4,4) (4,5)


a
Shortest path model
Each path from (0,0) to (N,M)
represents a different way to
convert sequence B to sequence D

Least cost path corresponds to


best match
Other Applications
There are numerous applications
of shortest path problems
Shortest paths are often solved as
subproblems in other procedures
See Network Flows by R. Ahuja
et al., Chapter 4, and references
therein
Linear Programming
The shortest path problem can be
formulated as a network flow
Digraph G=(V,A)
Arc costs or lengths cij, for all (i,j) A
Path start node s V, end node t V, s t

Variables xij = 1 if (i,j) in path, 0 otherwise

Net flow into node i = x


j : (j,i) A ij -
xij
j : (i,j) A
LP Formulation
min cij xij
(i,j) A

s.t.
x -
j : (j,i) A ji
x =
j : (i,j) A ij
-1, i=s
0, is,t i V
1, i=t
x0
Duality Results
LP dual has variables ui for each node i V
ui can be interpreted as the length of path
from node s to node i
LP dual constraints are difference constraints!
LP is bounded below if and only if there is no
negative length cycle
LP optimality conditions correspond to the
usual path optimality conditions
Can deduce that the LP formulation has the
integrality property, i.e. 0-1 solutions naturally
Time Windows
A path in a network G=(V,A) may represent a
route for a delivery vehicle
In this case, the time that the vehicle makes
each delivery may be constrained
Tij = time needed for vehicle to drive from node
i to node j (may includes unloading at i)
[ai,bi] = time interval must arrive at node i in
ti = time arrive at node i
If (i,j) in path, then tj = max{ti + Tij, ai}
Require ti bi for all i V
Integer LP Formulation
min
x{0,1}|A|, t
cij xij
(i,j) A

s.t.
x -
j : (j,i) A ji
x =
j : (i,j) A ij
-1, i=s
0, is,t i V
1, i=t

tj ti +Tij (bi+Tij-aj)(1-xij), (i,j) A


Additive Arc Resources
A path in a network G=(V,A) may represent a
route for a delivery vehicle
The petrol consumed by the vehicle may be
constrained by its tank capacity, Q
Dij = petrol consumed on arc (i,j)
di = total petrol consumed visiting all customers
on the route up to and including i
If (i,j) in path, then dj = di + Dij
Require di Q for all i V (or just dt Q)
Special case of time windows [0,Q]
ILP Formulation
min
x{0,1}|A|
cij xij
(i,j) A

s.t.
x -
j : (j,i) A ji
x =
j : (i,j) A ij
-1, i=s
0, is,t i V
1, i=t
Dx
(i,j) A Q
ij ij
Additive Node Resources
A path in a network G=(V,A) may represent a
route for a delivery vehicle
The quantity that can be carried on the vehicle
may be constrained by its capacity, Q
Di = demand quantity for node i
di = total demand for all customers preceding
on the route, including i
If (i,j) in path, then dj = di + Dj
Require di Q for all i V (or just dt Q)
Special case of additive arc resource
ILP Formulation
min
x{0,1}|A|
cij xij
(i,j) A

s.t.
x -
j : (j,i) A ji
x =
j : (i,j) A ij
-1, i=s
0, is,t i V
1, i=t
Dx
(i,j) A Q - Dt
i ij
Vector Resources
Arc (i,j) may use rkij units of resource k
Resource limits Rk for each resource k
qki = cumulative units of resource k used
on path nodes from s to i
If (i,j) in path, then qkj = qki + rkij
Require qkt Rk for all k
(Alternatively, some resources may be
time window type, not just additive)
ILP Formulation
min
x{0,1}|A|
cij xij
(i,j) A

s.t.
x -
j : (j,i) A ji
x =
j : (i,j) A ij
-1, i=s
0, is,t i V
1, i=t
rk x
(i,j) A R k
, resources k
ij ij
Renewable Resources
A path may represent a sequence of work
for a crew in a job network, perhaps
including several duty periods with rests
in between
The resource can be replenished at some
special nodes, R V
If (i,j) in path and j R, then dj = di + Dj
So if j R then free to re-set dj = 0
Require di Q for all i V
Elementary Paths
Shortest path problems often arise as
sub-problems in column generation
In these cases there may be negative
length cycles a shortest elementary
path (no repeated nodes) is sought
This can be modelled by using a vector of
additive resources, one for each node i
Resource rki=1 if k=i, 0 otherwise i,k V
Resource limit Rk=1 for each k V
Other Variations
Multi-criteria optimization
Dynamic shortest paths e.g. with time-
dependent travel times, such as due to
peak-hour congestion
Subset disjoint paths
Many others

You might also like