Dynamic Programming - Mirage Group
Dynamic Programming - Mirage Group
SUBMITTED BY:
DR. DEBANJANA GHOSH DR. PRABHPREET KAUR DR. PRASHANTH KULALA DR. SANDIP KR NEOGI SHWETNISHA BOSE
DYNAMIC PROGRAMMING
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. Invented by American mathematician Richard Bellman in the 1950s to solve optimization problems Programming here means planning Dynamic programming is a stage-wise search method suitable for optimization problems whose solutions may be viewed as the result of a sequence of decisions.
MAIN IDEA
set up a recurrence relating a solution to a larger instance to solutions of some smaller instances solve smaller instances once record solutions in a table extract solution to the initial instance from that table
Computing the nth Fibonacci number recursively (top-down): F(n) F(n-1) F(n-2) + F(n-3) + F(n-2) F(n-3) + F(n-4)
Bad algorithm as numerous repetitive calculations are there
...
Example Fibonacci Numbers using Dynamic programming f(5) f(4) f(3) f(2) f(1) f(2) f(2) f(3) f(1)
Calculation from bottom to top and Values are stored for later use This reduces repetitive calculation
Given the current state, the optimal decision for each of the remaining states does not depend on the previous states or decisions. In the budgeting problem, it is not necessary to know how the money was spent in previous stages, only how much was spent. In the path problem, it was not necessary to know how you got to a node, only that you did. There exists a recursive relationship that identifies the optimal decision for stage j, given that stage j+1 has already been solved. The final stage must be solvable by itself. The last two properties are tied up in the recursive relationships given above.
The idea for this problem is that a salesman is traveling from one town to another town, in the old west. His means of travel is a stagecoach. Each leg of his trip cost a certain amount and he wants to find the minimum cost of his trip, given multiple paths.
Suppose we are at node i, we want to find the lowest cost route from i to 10 Start at node 10, and work backwards through the network. Define variables such that: cost of travel from node i to node j node chosen for stage n = 1; 2; 3; 4 state
STATE 8 9
DECISION
10
BEST DECISION
BEST DISTANCE
2+0 4+0
10 10
2 4
AT STAGE 2
STATE
DECISION 8
DECISION 9
BEST DECISION
BEST DISTANCE
5 6 7
8 9 8
3 7 5
APPLICATIONS
BELLMANS PRINCIPLE OF OPTIMALITY An optimal policy has the property that whatever the initial state and initial decisions are, the remaining decisions must constitute an optimal policy with regard to the state resulting from the first decision
OPTIMALITY PRINCIPLE
Assume that optimal path is the shortest one OP indicates that any portion of any optimal path is also optimal
A
2 2 1 4
B
3
C
2 1
Set of optimal paths from all sources to a given destination forms a tree that is routed at the destination
PRINCIPLE OF OPTIMALITY
Jab Jbe b Jbce
c Assertion: If abe is the optimal path from a to e, then be is the optimal path from b to e. Proof: Suppose it is not. Then there is another path (note that existence is assumed here) bce which is optimal from b to e, i.e. Jbce > Jbe but then Jabe = Jab+Jbe< Jab+ Jbce= Jabce This contradicts the hypothesis that abe is the optimal path from a to e.
PRINCIPLE OF OPTIMALITY
4 2 5 9 1 3 6 8 7
Bellmans Principle of Optimality: At any intermediate state xi in an optimal path from x0 to xf, the policy from xi to goal xf must itself constitute optimal policy
BELLMANS PROGRAMMING
Transforms a complex optimization problem into a sequence of simpler ones. Usually begins at the end and works backwards Can handle a wide range of problems Relies on recursion, and on the principle of optimality Developed by Richard Bellman
MARKOVIAN REQUIREMENT
An optimal policy starting in a given state depends only on the state of the process at that stage and not on the state at preceding stages. The path is of no consequence, only the present stage and state The state variables fully describe the state of the system at each stage and capture all past decisions
Optimal Capacity Expansion: What is the least cost way of building plants?
Cost of $15 million in any year in which a plant is built. At most 3 plants a year can be built
24
Forwards recursion
Start with stage 1 and determine values for larger stages using recursion. In forward recursion f(n) is determined from f(k) where k < n. Determine the value of the other stages using the value of the first stage with the help of forward recursion.
25
Backwards Recursion
Boundary conditions: optimum values for states at the last stage. In backward recursion value of f(k) is determined from f(n) where k<n, i.e. k is the first stage and n is the last stage. Determine optimum values for other stages using backwards recursion
26
TRAVELING SALESMAN
2 Start 1 East 4 3
5 6 7 8 9 End 10 West
1 4 8 3 6 3 9 5 3 3
CONDITIONS
Those that can satisfy Bellmans principle of optimality:
The globally optimum solution includes no suboptimal local
decisions taken to enter a particular state, the remaining decisions made for leaving that stage must constitute an optimal policy.
APPLICATIONS
In numerous multistage decision problems of optimum fit such as:
Error correction coding (Viterbi algorithm). Automatic labelling of speech segments (dynamic time warping). Video coding. Digital watermark detection. Cell library binding (as part of logic optimization). Flight trajectory planning. Genome sequencing (Smith-Waterman and Needleman-Wunsch algorithms). Knapsack problems. Stereo vision.
Consider this LPP as multistage problem with each activity j (j = 1,2, ..n) as individual stage so this is an n- stage problem
SUMMARY
The Dynamic Programming technique is useful for making a sequence of inter-related decisions where the objective is to optimize the overall outcome of the entire sequence of decisions over a period of time. This technique decomposes the original problem into a sequence of stages, which can then be handled more efficiently from the computational point of view. In contrast, most linear and nonlinear programming approaches attempt to solve such problems by considering all the constraints simultaneously. The dynamic programming technique is used in various fields such as inventory control, allocation, Bidding problems etc.