Dynamic Programming
Dynamic Programming
Dynamic Programming
TLO 6: Illustrate the algorithm for solving simple applications of dynamic programming and
goal programming
DYNAMIC PROGRAMMING
Dynamic programming starts with the last stage of the problem and works
backward toward the first stage, making optimal decisions at each stage of the
problem.
The circles (nodes) represent the origin, destination, and other cities where
routes intersect. The arrows (or branches) represent the highways connecting the
nodes, each with its mileage indicated.
2
Kooch’s problem is to find the shortest route from Atlanta to St. Louis.
Stage 1. There is one route each from input node 8 and 9 going to node 10, with
the following distances:
Stage 2. Analysis of stage 2 distances from input and output nodes are as follows:
Note that there are two output nodes for node 5: 8 and 9. The choice of an optimal
route from node 5 is either 500 miles or 400 miles. Route 5-8-10 is the optimal
one.
Stage 3. We begin with node 2. Using the optimal answers for nodes 6 and 5 from
stage 2, we evaluate routes 2-6 and 2-5 and choose route 2-6 (300 + 300 < 275 +
400).
Looking at node 4, we see that we have three choices: we use the optimal answers
for nodes 6, 5 and 7 from stage 2 (300, 400, 275). We evaluate routes 4-6, 4-5
and 4-7 and choose 4-6 (500 < 575 or 550).
For node 3, there are two choices: routes 3-5 and 3-7. Using the optimal answers
for nodes 5 and 7 from stage 2, we choose route 3-5 (600 < 625).
2 6 2-6 600
4 6 4-6 500
3 5 3-5 600
Stage 4. There is only one input in stage 4, node 1, and so we have 3 choices: 1-2,
1-4 or 1-3. Using the output of stage 3, we evaluate the 3 routes and choose 1-4
(650 < 700 or 775).
Now that we have solved the four individual problems, let us go through the
network from stage 4 to stage 1 and pick the route at each stage which leads us to
the optimal decision. The table below illustrates this process. We can see now that
the shortest route between Atlanta and Saint Louis is
1-4-6-9-10, with a total distance of 650 miles.