Dynamic planning is often applied to optimization problems, that is, to make a set of choices to achieve an optimal solution. At the same time, the same form of sub-problem often occurs. Dynamic planning is effective when a particular sub-problem may originate from more than one set of choices. The key technique is to store the solution of each of these sub-problems in case it recurs.
As with the partition method, dynamic programming solves the whole problem by combining the solution of the sub-problem. Dynamic programming applies to sub-problems that are not independent, that is, each sub-problem contains a common sub-sub-problem. The dynamic programming algorithm solves each sub-sub-problem only once and saves its results in a table to avoid recalculating the answer each time each sub-problem is encountered.
Dynamic planning is typically applied to optimization problems . There are a number of possible solutions to such problems. Each solution has a value, and we want to find a solution with the best value. This solution is called the "one" optimal solution of the problem.
The design of the dynamic programming algorithm can be divided into the following 4 steps:
1) Describe the structure of the optimal solution.
2) The value of the optimal solution is defined recursively.
3) Calculate the value of the optimal solution according to the bottom-up method.
4) An optimal solution is constructed from the calculated results.
Topic One:
assembly line scheduling problem.
Step 1: Structure of the fastest route through the factory
The first step of the dynamic programming method is to describe the characteristics of the structure of the optimal solution. For assembly line scheduling problems, you can perform the following. Consider the fastest possible route from the starting point of the chassis to the s1,j of the Assembly station. If the j=1, then the chassis can walk only one route, so it is easy to determine how much it s1,j to the Assembly station to spend the actual time. For j=2,3,..., N, there are two options: the chassis may be s1,j-1 directly from the Assembly station to the Assembly station S1,J, on the same assembly line, the time from the Assembly station J-1 to J is negligible. Alternatively, the chassis may come from the assembly station S2,J-1, and then move to the assembly station S1,J, the cost of the move is t2,j-1. We will consider these two possibilities separately, and we can see in fact that there are a lot of similarities between them. (Find recursion formula)
First, assume that the fastest path through the assembly station S1,J through the assembly station S1,J-1. The key point is that the chassis must be using the quickest route from the start point to the Assembly station S1,J-1.
Similarly, it is assumed that the fastest path through the assembly station S1,J through the assembly station S2,J-1.
More generally, for the assembly line scheduling problem, the optimal solution of a problem (to find the quickest route of the assembly station SI,J) contains the sub-problem (finding the quickest route through S1,j-1s2,j-1). We call this property the optimal substructure, which is one of the flags that can be applied to dynamic programming methods.
The following is illustrated by the optimal substructure: observing a s1,j route through the assembly station, it will be found that it must be the assembly station on the assembly line 1 or 2 j-1. Therefore, the fastest route through the assembly station S1,J can only be one of two:
S1,j-1 the fastest route through the assembly station and then s1,j directly through the assembly station.
The fastest route through the assembly station S2,J-1, moving from assembly line 2 to assembly line 1, and then s1,j through the Assembly station.
Using symmetric reasoning, the quickest route through the assembly station can only be one of the s2,j.
S2,j-1 the fastest route through the assembly station and then s2,j directly through the assembly station.
The fastest route through the assembly station S1,J-1, moving from assembly line 1 to assembly line 2, and then s2,j through the Assembly station.
To solve this problem, looking for the quickest route through the Assembly station J on either assembly line, we solved its sub-problem by finding the quickest route to j-1 through the Assembly station on the two assembly lines.
Therefore, for the assembly line scheduling problem, by establishing the optimal solution of sub-problem, we can establish an optimal solution of an instance of the original problem.
Step 2: A recursive solution
In the dynamic programming method, the second step is to recursively define the value of an optimal solution by using the optimal solution of the sub-problem. For the scheduling problem of assembly line, for the scheduling problem of assembly line, we choose the fastest line of Assembly station J on two assembly line as sub-problem, J=1,2...,n. FI[J] represents the fastest possible time for a chassis to s1,j from the starting point to the assembly station.
our ultimate goal is to determine the quickest time for the chassis to go through all the routes of the project, recorded as F*. The chassis must be routed all the way through assembly station N, 1 or 2, before reaching the factory exit. So:
f* = Min{f1[j] + x1, f2[j] + x2}
The boundary condition is then considered.
It is also easy to infer f1[1] and f2[2]. No matter which assembly line is on the assembly Station 1, the chassis is directly to the Assembly station. So
F1[1] = e1 + a1,1
F2[2] = e2 + a2,1
Formal consideration:
Now consider how to calculate f1[j], where j=2,3,...,n (i =).
First case F1[j] = f1[j-1] + a1,j
Second case f1[j] = f2[j-1] + t2,j-1 + a1,j
Similarly:
For the second assembly line:
First case F2[j] = f2[j-1] + a1,j
Second case f2[j] = f1[j-1] + t1,j-1 + a2,j
The recursive formula is derived after considering the marginal situation and the general situation:
Slightly
Dynamic Planning Summary