When we access statistics, we often misunderstand various fundamental theories, exceptionally dynamic theories. AlgoMonster is mainly for beginners to quickly and clearly distinguish dynamic programming from other programming.
Before you start reading this article, as you look at these words： Dynamic programming. Static programming. Linear programming. Nonlinear programming.
Do you feel a slight shiver?
Do you have goosebumps on your skin dominated by fear?
What differs dynamic programming and static programming?
There is a straightforward idea of exhausting all possible paths and choosing the shortest one from them. The disadvantage of this approach is that it is slow because finishing all the routes faces an astronomical amount of computation when the problem is significant.
But at first, we should be clear:
what is Dynamic programming?
Dynamic programming can divide an activity process into several interconnected stages. At each stage, make decisions so that the whole process can achieve the best activity result. Of course, the selection of decisions at each step is not arbitrary. It depends on the current state and affects future development. When finishing making decisions at each stage, it forms a sequence of decisions and thus determines a line of activity for the whole process. In obtaining the final result, it is necessary to maintain a table where the values in the table are changing to get the optimal solution, so it is called dynamic programming.
Simply put, it is an optimization technique that we can use to solve the problem of the same work being repeated over and over again. For example, do you know how web servers use caching? That’s basically what it is.
Of course, this method also has the advantage of always keeping a feasible solution during the exhaustion process. If we do not want to continue the computation, we can always get a possible solution that is not too bad after stopping the calculation. Lucky, it may be the optimal solution. If you have time later and want to continue the exhaustive enumeration, it is theoretically possible. In this method, we start from one or more feasible solutions and optimize the existing viable solutions to get the optimal solution. Static programming says so.
The simplex solution method of linear programming is a static programming method. First, generate a feasible solution of linear programming, and then optimize the viable solution by continuous iteration, and finally, obtain the optimal solution. Static optimization’s distinctive feature is that a feasible solution or a near-optimal solution is always maintained during the iterative computation.
Advantages of dynamic programming over static programming:
1. can obtain the optimal global solution;
2. can obtain a family of optimal solutions;
3. because dynamic programming reflects the links and characteristics of the evolution of dynamic processes, it is possible to use practical knowledge and experience in the calculation to improve the solution’s efficiency.
Disadvantages of dynamic programming
1. there is no unified standard model.
2. dimensional disaster in numerical methods of solving.
What are dynamic programming and linear programming?
Dynamic programming is a problem-solving strategy.
Linear programming is a class of problems. The objective function is a linear function of specific variables, and the constraint is a linear inequality (standard form) or equation (slack form) of these variables. The objective is to find the maximum or minimum value of the objective function. Linear and nonlinear programming is referred to as static programming, but no authoritative reference has been found.
Linear programming problem
When the objective function and the constraints are linear, it is linear programming.
A linear programming problem is a problem of finding the maximum or minimum of a linear objective function subject to a set of linear constraints. In solving practical issues, reducing the case to a linear programming mathematical model is an important step, but often a difficult one, and whether building a model directly affects the solution. And choosing the appropriate decision variables is one of the keys for us to build an effective model.
Is dynamic programming nonlinear?
Ditto to the previous question. DP is a widely used mathematical method for solving linear and nonlinear optimization problems. The term “dynamic” stems from the fact that the technique is used to derive a sequence of optimal decisions that accommodate changes in scenarios that occur dynamically over time in most applications.
Nonlinear programming is the problem of solving an optimization defined by a set of equations and inequalities collectively called constraints, consisting of a group of unknown fundamental functions, accompanied by an objective function maximized or minimized, except that some constraints or objective functions are nonlinear. It is a subfield of optimization dealing with nonlinear problems.
Are divide and conquer and dynamic programming the same?
Divide and conquer
Divide and conquer works by dividing a problem into subproblems, solving each subproblem recursively, and then combining these solutions.
Another difference between divide and conquer and dynamic programming might be
Divide and conquer.
1. more work is done on the subproblems, so there is more time-consuming.
2. in divide and conquer, the subproblems are independent of each other.
1. Solve the subproblem only once and then store it in a table.
2. In dynamic programming, subproblems are not independent of each other.
Is dynamic programming easy?
Dynamic programming is difficult for beginners, both difficult and counterintuitive. Most of us learn by looking for patterns in different problems. But for dynamic programming, it can be tough to find similarities. But is dynamic programming complex? There are rules and routines for learning any algorithm. As long as you master its rules and conventions for solving problems and practice many exercises, we believe it is not difficult to master it.