This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: 6 Dynamic Programming The next main topic is a general algorithmic technique for solving optimiza tion problems; this is in contrast to previous topics in this course and in the fall, where we have focused on a class of optimization models, such as the minimumcost network flow problem, or linear programming. 6.1 Example 1: shortest paths in layered graphs Suppose that we want to compute the shortest path from node s to node t in the graph below. Observe that this input graph has a special structure: we can partition the nodes into layers, first s , then A, B, C, D , then E, F, G, H , then I, J, K, L, M , and a final layer with just node t . Each directed edge in the graph goes from a node in one layer, to a node in the next one. Such a graph is often called a layered graph . As indicated in the figure, each edge has an associated cost, and the aim is to select a path from s to t of minimum total cost. s A B C D E F G H I J K L M t1 4 5 6 3 2 4 6 710 3 2 6 1 4 2 12 3 1 4 stage 0 stage 1 stage 2 stage 3 stage 4 Of course, we already know how to solve this problem, even if the costs are allowed to take on negative values. We can formulate this problem as a 41 minimumcost flow problem: since there are no cycles in this graph at all, there are no cycles of total cost that is negative, even if every cost in the input is negative. For every problem that we attack by dynamic programming, we will view the selection of an optimal solution as a process of making a series of decisions; each decision corresponds to a stage of the dynamic programming procedure. For our shortest path problem, it is clear that selecting a path corresponds to selecting, for each node encountered, which directed edge will be used to leave that node. By making a series of such decisions, we select a path from s to t . In the language of dynamic programming, we refer to the current situation after making some number (possibly 0) of decisions, as the current state . In this way, the nodes of each layer correspond to the possible states for each stage of the process. One central feature of dynamic programming is that we define a related optimization problem for each possible state encountered throughout the process. In this way, we are solving one optimization input that we care about by solving a large number of related problems along the way. In this case, we shall define f * i ( r ) to be the minimum total cost remaining to go from state r in stage i to completion (at node t in stage 4). As an example of this, we see that f * 4 ( t ) = 0 and f * 3 ( M ) = 4. In this notation, the * is used to denote that we are referring to the optimal value, the subscript i refers to the relevant stage of the process, and the value r refers to the highlighted state. Let c ( p, q ) denote the cost of the edge from a generic node p to another node q ....
View
Full
Document
This note was uploaded on 04/06/2008 for the course ORIE 321 taught by Professor Shmoys/lewis during the Spring '07 term at Cornell University (Engineering School).
 Spring '07
 SHMOYS/LEWIS

Click to edit the document details