2. What is Dynamic Programming? Dynamic programming is a methodology useful for solving problems that involve taking decisions over several stages in a sequence. The term 'dynamic programming' refers to a general optimization technique useful for solving a class of multistage problems. Technique that divides the problem to be solved into a number of sub problems and then solves each sub-problem in such a way that the overall solution is optimal to the original problem.
3. Djikstra’s Algorithm Dijkstra's algorithm, conceived by Dutch computer scientistEdsgerDijkstra in 1956 and published in 1959,[1][2] is a graph search algorithm that solves the single-source shortest path problem for a graph with nonnegative edge path costs, producing a shortest path tree. This algorithm is often used in routing and as a subroutine in other graph algorithms. Indeed, it is safe to say that the shortest path problem is one of the most important generic problem in such fields as OR/MS, CS and artificial intelligence (AI). One of the reasons for this is that essentially any combinatorial optimization problem can be formulated as a shortest path problem. Thus, this class of problems is extremely large and includes numerous practical problems that have nothing to do with actual ("genuine") shortest path problems. Click Here for the Example
4. Consider the following diagram where circles denote states, and lines between two such circles represent highways connecting the states. The numbers inside the circles represent state numbers, and those given beside the lines denote the distances between the states connected by the lines. The problem is to find the shortest route from state 1 to state 10 where the Bell Well temple is situated. For a systematic approach to dynamic programming problem, consider the following notations. n = number of stages.s = state variable.dsj = immediate distance from entering state s to existing state j. Notice that the entire trip from state 1 to state 10 requires four stages (highways), regardless of the particular routing. Now, the problem is to select these four highways so that the total distance covered is least. The first highway has to be chosen from 1-2, 1-3, or 1-4, as 1 is the starting state. Likewise, the second highway has to be chosen from 2, 3, or 4, the third from 5, 6, or 7 and the fourth from 8 or 9.
5. There is one table for each possible stage n, namely, n = 1, 2, 3, and 4. We start calculating distances between pair of states from stage 4 backwards. At the beginning of stage 4, we can be in either 8 or 9 (states). We note that state 10 is the only destination from both states 8 & 9. We summarize this information in the format below. Stage 4 (n = 1) Stage 3 (n = 2)
6. Stage 2 (n = 3) Stage 1 (n = 4) The computations terminate in the above table with n = 4. The shortest route from state 1 to state 10 is given by 1-3-6-8-10, and the distance to be covered is 23.