jagomart
digital resources
picture1_Programming Pdf 185393 | Ch10 Item Download 2023-02-01 15-12-02


 130x       Filetype PDF       File size 0.13 MB       Source: www2.latech.edu


File: Programming Pdf 185393 | Ch10 Item Download 2023-02-01 15-12-02
dynamic programming a framework to solve optimization problems 4an algorithm design technique for each current choice 4a framework to solve optimization problems 4determine what subproblem s would remain if this ...

icon picture PDF Filetype PDF | Posted on 01 Feb 2023 | 2 years ago
Partial capture of text on file.
                                 Dynamic Programming                                                                                         A framework to solve Optimization problems
                                     4An Algorithm Design Technique                                                                          • For each current choice:
                                     4A framework to solve Optimization problems                                                                 4Determine what subproblem(s) would remain if this 
                                 • Elements of Dynamic Programming                                                                                  choice were made.
                                 • Dynamic programming version of a recursive                                                                    4Recursively find the optimal costs of those subproblems.
                                   algorithm                                                                                                     4Combine those costs with the cost of the current choice 
                                                                                                                                                    itself to obtain an overall cost for this choice
                                 • Developing a Dynamic Programming Algorithm                                                                • Select a current choice that produced the minimum 
                                     4Multiplying a Sequence of Matrices                                                                        overall cost.
                                                                                           TECH
                                                                                       Computer Science
                                                                                                                                             Memoizationfor Dynamic programming 
                                 Elements of Dynamic Programming                                                                             version of a recursive algorithm e.g.
                                 •  Constructing solution to a problem by building it up                                                     • Trade space for speed by storing solutions to sub-
                                    dynamically from solutions to smaller (or simpler) sub-                                                     problems rather than re-computing them. 
                                    problems                                                                                                 • As solutions are found for suproblems, they are 
                                     4sub-instances are combined to obtain sub-instances of increasing 
                                        size, until finally arriving at the solution of the original instance.                                  recorded in a dictionary, say soln. 
                                     4make a choice at each step, but the choice may depend on the                                               4Before any recursive call, say on subproblem Q, check 
                                        solutions to sub-problems                                                                                   the dictionary soln to see if a solution for Q has been 
                                 •  Principle of optimality                                                                                         stored.
                                     4the optimal solution to any nontrivial instance of a problem is a                                               f If no solution has been stored, go ahead with recursive call.
                                        combination of optimal solutions to some of its sub-instances.                                                f If a solution has been stored for Q, retrieve the stored solution, and 
                                 •  Memoization (for overlapping sub-problems)                                                                          do not make the recursive call.
                                     4avoid calculating the same thing twice,                                                                    4Just before returning the solution, store it in the 
                                     4usually by keeping a table of know results that fills up as sub-                                              dictionary soln. 
                                        instances are solved. 
                                                                                                                                             Development of 
                                 Dynamic programming version of the fib.                                                                     a dynamic programming algorithm
                                                                                                                                             • Characterize the structure of an optimal solution
                                                                                                                                                 4Breaking a problem into sub-problem
                                                                                                                                                 4whether principle of optimality apply
                                                                                                                                             • Recursively define the value of an optimal solution
                                                                                                                                                 4define the value of an optimal solution based on value of 
                                                                                                                                                    solutions to sub-problems
                                                                                                                                             • Compute the value of an optimal solution in a bottom-
                                                                                                                                                up fashion
                                                                                                                                                 4compute in a bottom-up fashion and save the values 
                                                                                                                                                    along the way
                                                                                                                                                 4later steps use the save values of pervious steps
                                                                                                                                             • Construct an optimal solution from computed 
                                                                                                                                                information
                                                                                                                                                                                                                                                  1
                                          Dynamic programming, e.g.                                                                                                                    bottom-up approach
                                          • Problem: Matrix-chain multiplication                                                                                                       • MatricChainOrder(n)
                                                4a chain of  of n matrices                                                                                                    4for i= 1 to n
                                                4find a way that minimizes the number of scalar                                                                                                    f m[i,i] = 0
                                                    multiplications to computer the produce A1A2…An                                                                                          4for l = 2 to n
                                          • Strategy:                                                                                                                                              f for i = 1 to n-l+1
                                          • Breaking a problem into sub-problem                                                                                                                          • j=i+l-1
                                                                                                                                                                                                         • m[i,j] = inf. 
                                                4A1A2...Ak,   Ak+1Ak+2…An                                                                                                                                • for k=i to j-1
                                          • Recursively define the value of an optimal solution                                                                                                                – q=m[i,k] + m[k+1,j] + pi-1pkpj
                                                                                                                                                                                                               – if q < m[i,j]
                                                4m[i,j] = 0 if i = j                                                                                                                                           –       m[i,j] = q
                                                4m[i,j]= min{i<=ki
                                                      f x = MatricChainMult(A, s, i, s[i,j])
                                                      f y = MatrixChainMult(A, s, s[i,j]+1, j)
                                                      f return matrixMult(x, y)
                                                4else return Ai
                                          • Analysis:
                                                                     3                  2
                                                4Time Ω(n ) space θ(n )
                                                                                             n    3/2
                                                4Comparing to Time Ω(4 /n ) by brute-force exhaustive 
                                                    search. 
                                          • >> see Introduction to Algorithms
                                                                                                                                                                                                                                                                                                                           2
The words contained in this file might help you see if this file matches what you are looking for:

...Dynamic programming a framework to solve optimization problems an algorithm design technique for each current choice determine what subproblem s would remain if this elements of were made version recursive recursively find the optimal costs those subproblems combine with cost itself obtain overall developing select that produced minimum multiplying sequence matrices tech computer science memoizationfor e g constructing solution problem by building it up trade space speed storing solutions sub dynamically from smaller or simpler rather than re computing them as are found suproblems they instances combined increasing size until finally arriving at original instance recorded in dictionary say soln make step but may depend on before any call q check see has been principle optimality stored nontrivial is f no go ahead combination some its retrieve and memoization overlapping do not avoid calculating same thing twice just returning store usually keeping table know results fills solved develo...

no reviews yet
Please Login to review.