We will now use our typeless graph class developed in
to implement a standard
dynamic programming algorithm.
The standard Dynamic Programming algorithm is an iterative technique for
minimizing the cost of moving from a chosen start
to a chosen goal node in a graph of N nodes. If we label all of
the nodes in the graph with say the lexicographic ordering,
0 q
N, the standard
Dynamic Programming algorithm may be stated as follows: if Jq
denotes the cost of moving from node q to the goal, then the optimal
node costs satisfy the equation:
| Jq | = |
where S(q) is the set of successors to a given node
and
Tq
i denotes the cost of
moving from node q to the successor node
i
S(q).
This equation is
usually solved via an iterative procedure:
| Jqt + 1 | = |
with the initial goal costs Jq set in some fashion.