First, the definition:
The process of dynamic planning is: each time the decision depends on the current state, and then the transfer of state, a decision sequence is generated in the state of change, the use of this multistage optimization decision-making to solve the problem is the dynamic planning.
Second, basic ideas and strategies:
Firstly, the problem to be solved is decomposed into several sub-problems, and the solution of the latter problem depends on the solution of the previous problem. When solving any sub-problem, all possible local solutions are listed, the solutions that can reach the optimal decision are preserved by decision, the local solutions of other decisions are discarded, the sub-problems are solved in turn, and the solution of the last sub-problem is the solution of the initial problem.
Due to the problem of dynamic programming, there are overlapping sub-problems, in order to reduce the repetition, each sub-problem is computed only once, and the different states of its different stages are saved in a two-dimensional array.
The difference between the division and the method is: suitable for solving problems with dynamic programming, the sub-problems obtained after decomposition are often not independent of each other, that is, the solution of the next sub-problem depends on the solution of the last sub-problem.
Third, the application of the situation
The problem that can be solved by dynamic programming generally has 3 properties.
1, the optimal substructure properties. That is, the solution of sub-problems contained in the optimal solution of the problem is also optimal.
2, there are overlapping sub-problems. That is, the sub-problems are not independent, and the sub-problems have interdependencies.
3, no effect. That is, once the state of a certain stage is determined, it is not affected by the decision after that state, that is to say, the process after a certain state is related to the current state.
Iv. Solution Steps
The problem that the dynamic plan deals with is a multi-stage decision-making problem, starting from the initial state, through the choice of each stage decision, reaching the final decision, that is, to the last state, these decision-making processes form a decision sequence, and the dynamic programming mode is as follows:
Initial status-------> decision 1-------> Decision 2-------, ...------> Decision n-------> end state.
1, the Division stage. According to the time or spatial characteristics of the problem, divide the problem into various stages. In the partitioning phase, note that after the division of the stage must be ordered or sortable, otherwise the problem can not be solved.
2. Determine the state and state variables. When the problem is developed into various stages, the various states are listed, of course, the choice of state to satisfy the aftereffect.
3, determine the decision-making and write the state transfer equation. There is a close relationship between decision-making and state transition. State transfer is to export the state of this stage according to the state and decision of the previous stage, so if the decision is determined, the state transfer equation can be written out. However, the fact is often reversed, according to the relationship between the neighboring two states, to determine the decision-making method and the state transfer equation.
5, look for boundary conditions. The given state transition equation is a recursive type that requires a recursive termination condition or boundary condition.
In general, the state transition equation (including boundary conditions) can be written as long as the phase, state, and state transfer decisions are resolved.
In practical applications, follow these steps:
1. Analyze the properties of the optimal solution and characterize its structure.
2, recursive definition of the optimal solution.
3. Calculate the optimal value from bottom up or top down.
4, according to calculate the best worth of information, structural problems of the optimal solution.
Three elements: The stage of the problem, the state of each stage, the recurrence relationship between the previous state and the latter state.
The three elements of dynamic programming are determined, the whole process can be expressed by an optimal decision table, the optimal decision table is a two-dimensional table, the row represents the decision stage, and the column represents the state of the problem. The table needs to fill in the data generally corresponds to this problem in a certain state of the optimal value (such as the shortest path, the longest common sub-series, the maximum value, etc.), the process of filling out is based on the recurrence of the relationship, starting from 1 rows and 1 columns, in the order of row or column priority, fill in the form, Finally, the optimal solution of the problem is obtained by simple trade-offs or calculations based on the data of the whole table.
f (n,m) =max{f (N-1,m), F (N-1,m-w[n]) +p (n,m)}
Five, the algorithm framework
for (j=1; j<=m; j=j+1)//First stage
xn[j] = initial value;
for (i=n-1; i>=1; i=i-1)//Other n-1 stages
for (j=1; j>=f (i); j=j+1)//f (i) expressions related to I
Xi[j]=j=max (or min) {g (xi-1[j1 : J2]), ..., G (xi-1[jk:jk+1])};
t = g (x1[j1:j2]); Solution for solving the optimal solution of the whole problem by the optimal solution of sub-problem
print (x1[j1]);
for (i=2; i<=n-1; i=i+1)
{
t = T-xi-1[ji];
for (j=1; j>=f (i); j=j+1)
if (T=xi[ji]) break
;
}