1
Artificial
Terminal
state
Initial
state
s
t
Stage 0
12
1_
a^
1
Stage 1
2
Stage 2
Stage N
Stage N-1
Fig. 1. Shortest paths in a trellis
Shortest Path Problems
Shortest paths in a trellis
See Fig.1. states → nodes
control → arcs
akij : cost of transition from state i at stage k to state j at stage k + 1.
aN
ij : terminal cost of state i
cost function = length of path from s to t.
D.P Algorithm :
JN (i) = aN
it
Jk (i) = min[akij + Jk+1 (j)],
j
February 6, 2017
k = N − 1, . . . , 1, 0
DRAFT
2
300
400
150
Stage 1
50
Shortest
path in red
100
200
350
Stage 2
400
Stage 3
Fig. 2. Shortest paths example
Optimal cost = J0 (s) = length of shortest path from s to t.
Example : Find shortest path from stage 1 to stage 3. See Fig. 2.
Redraw into trellis with initial and terminal node: See Fig. 3.
Here N = 3.
Call the top node state 1 and bottom node state 2.
Stage N :
J3 (1) = 0
J3 (2) = 0
Stage 2:
J2 (1) = min{a211 + J3 (1), a212 + J3 (2)}
= min{100 + 0, 200 + 0} = 100
DRAFT
February 6, 2017
3
400
1
0
300
100
1
400
100
0
1
0
200
250
s
t
0
150
Stage 0
2
250
50
Stage 1
0
350
2
350
Stage 2
400
2
0
Stage 3
Fig. 3. Redrawn shortest paths example
J2 (2) = min{a221 + J3 (1), a222 + J3 (2)}
= min{350 + 0, 400 + 0} = 350
Stage 1:
J1 (1) = min{a111 + J2 (1), a112 + J2 (2)}
= min{300 + 100, 400 + 350} = 400
J1 (2) = min{a121 + J2 (1), a122 + J2 (2)}
= min{150 + 100, 50 + 350} = 250
Stage 0:
J0 (s) = min{0 + J1 (1), 0 + J1 (2)} = 250
Shortest path to original problem in red in Fig. 2.
Forward D.P algorithm
•
Observe that optimal path s → t is also optimal path t → s if directions of arcs are reversed.
February 6, 2017
DRAFT
4
1
150
250
1
1
400
0
200
0
s
t
2
0
350
150
250
2
2
50
350
Fig. 4. Forward DP on shortest paths example
−→ Shortest path algorithm can be run forwards in time (see book for equations).
Fig. 4 shows the result of forward DP on shortest paths example.
•
Forward D.P useful in real-time applications where data arrives just before you need to make a
decision.
•
Viterbi algorithm uses this idea
•
Shortest paths is a deterministic problem, so forward D.P works.
•
For stochastic problems, no such concept of forward D.P
−→ Impossible to guarantee that any given state can be reached.
Viterbi algorithm applications
•
Estimation of hidden Markov models (HMMs)
– xk = Markov chain
– state transitions in xk not observed (hidden).
DRAFT
February 6, 2017
5
– observe zk , r(z, i, j) = probability observe z given a transition in Markov chain xk from state
i to j .
– Estimation problem:
Given ZN = {z1 , z2 , ..., zN } find a sequence X̂N = {x̂0 , x̂1 , ..., x̂N } over all possible
{x0 , x1 , ..., xN } that maximizes P (XN |ZN ).
Note that P (XN |ZN ) =
So
P (XN ,ZN )
P (ZN ) ,
max P (XN |ZN ) ←→
{x0 ,...,xN }
and P (ZN ) is “constant” given ZN
max lnP (XN , ZN )
{x0 ,...,xN }
After some calculations (see book), can show that problem is equivalent to:
min
{x0 ,...,xN }
− ln(πx0 ) −
N
X
ln(Pxk−1 xk × r(Zk , xk−1 , xk ))
k=1
where πx0 = probability of initial state and Pxk−1 xk = transition probabilities of Markov chain,
and ln πx0 and ln (Pxxk−1 xk × r(Zk , xk−1 , .., xk )) can be regarded as lengths of the different
stages
−→ shortest path problem through a trellis
•
Decoding of convolutional codes
•
Channel equalization in presence of ISI (Inter-symbol interference)
General shortest path problems
•
No trellis structure
eg: Find the shortest path from each node to node 5 in Fig. 5.
•
Graph with N +1 nodes {1, 2, ..., N, t}
•
aij = cost of moving from node i to node j .
•
Find the shortest path from each node i to node t.
•
Assume some a0ij s can be negative, but cycles have non-negative length.
−→ shortest path will not involve more than N arcs.
•
Reformulate as a trellis-type shortest path problem by allowing arcs from node i to itself with cost
aii = 0
•
D.P algorithm :
JN −1 (i) = ait
Jk (i) = min{aij + Jk+1 (j)},
j
k = 0, 1, ..., N − 2
•
This algorithm is essentially the Bellman-Ford algorithm.
•
Other algorithms have also been invented, e.g. Dijkstra’s algorithm when all a0ij s are positive.
February 6, 2017
DRAFT
6
5
2
3
7
4
1
2
1
3
4
DRAFT
5
February 6, 2017
© Copyright 2025 Paperzz