ene 2xx renewable energy systems and control lec 05
play

ENE 2XX: Renewable Energy Systems and Control LEC 05 : Dynamic - PowerPoint PPT Presentation

ENE 2XX: Renewable Energy Systems and Control LEC 05 : Dynamic Programming Professor Scott Moura University of California, Berkeley Summer 2018 Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 04 - Dynamic Programming Slide 1


  1. ENE 2XX: Renewable Energy Systems and Control LEC 05 : Dynamic Programming Professor Scott Moura University of California, Berkeley Summer 2018 Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 04 - Dynamic Programming Slide 1

  2. Motivating Example: Traveling Salesman What is the shortest path to loop through N cities? [http://www.informatik.uni-leipzig.de/ meiler] [http://www.superbasescientific.com/] Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 04 - Dynamic Programming Slide 2

  3. Traveling Salesmen What is the shortest path to loop through N cities? 500 cities, random solution Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 04 - Dynamic Programming Slide 3

  4. Traveling Salesmen What is the shortest path to loop through N cities? 500 cities, a better solution Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 04 - Dynamic Programming Slide 3

  5. Traveling Salesmen What is the shortest path to loop through N cities? 500 cities, best solution Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 04 - Dynamic Programming Slide 3

  6. When to use DP? When decisions are made in stages Sometimes, decisions cannot be made in isolation. One needs to balance immediate cost with future costs. Applications Maps. Robot navigation. Urban traffic planning. Network routing protocols. Optimal trace routing in PCBs. Optimal energy management. HR scheduling and project management. Routing of telecommunications messages. Optimal truck routing through given traffic congestion pattern. Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 04 - Dynamic Programming Slide 4

  7. Richard Bellman, Ph.D. | 1920 - 1984 University of Southern California RAND Corporation Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 04 - Dynamic Programming Slide 5

  8. Coining “Dynamic Programming” “I spent the Fall quarter (of 1950) at RAND. My first task was to find a name for multistage decision processes ... The 1950s were not good years for mathematical research. We had a very interesting gentleman in Washington named [Charles] Wilson. He was Secretary of Defense, and he actually had a pathological fear and hatred of the word research. I’m not using the term lightly; I’m using it precisely. His face would suffuse, he would turn red, and he would get violent if people used the term research in his presence. You can imagine how he felt, then, about the term mathematical. The RAND Corporation was employed by the Air Force, and the Air Force had Wilson as its boss, essentially. Hence, I felt I had to do something to shield Wilson and the Air Force from the fact that I was really doing mathematics inside the RAND Corporation. What title, what name, could I choose? In the first place I was interested in planning, in decision making, in thinking. But planning, is not a good word for various reasons. I decided therefore to use the word “programming”. I wanted to get across the idea that this was dynamic, this was multistage, this was time-varying... Thus, I thought dynamic programming was a good name. It was something not even a Congressman could object to. So I used it as an umbrella for my activities.” Eye of the Hurricane: An Autobiography (1984) Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 04 - Dynamic Programming Slide 6

  9. Formulation Discrete-time system x k + 1 = f ( x k , u k ) , k = 0 , 1 , · · · , N − 1 k : discrete time index x k : state - summarizes current configuration of system at time k u k : control - decision applied at time k N : time horizon - number of times control is applied Additive Cost N − 1 � J = c k ( x k , u k ) + c N ( x N ) k = 0 c k : instantaneous cost - instantaneous cost incurred at time k c N : final cost - incurred at time N Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 04 - Dynamic Programming Slide 7

  10. EX 1: Inventory Control Order items to meet demand, while minimizing costs x k Items in stock, at the beginning of period k u k Items ordered & delivered immediately at the beginning of period k d k Demand of items during period k (assume deterministic) Stock evolves according to x k + 1 = x k + u k − d k where negative stock corresponds to backlogged demand. Three types of cost: (a) r ( x k ) is penalty for positive stock (holding costs) or negative stock (shortage cost) (b) The purchasing cost c k u k , where c k is the cost per unit order at time k . (c) Terminal cost R ( x N ) for excess stock or unfulfilled orders at time N . Total cost: N − 1 � J = [ r ( x k ) + c k u k ] + R ( x N ) k = 0 Minimize cost by proper choice of { u 0 , u 1 , · · · , u N − 1 } subject to u k ≥ 0. Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 04 - Dynamic Programming Slide 8

  11. Principle of Optimality (in words) Break the multistage decision problem into subproblems. At time step k , assume you know optimal decisions for time steps k + 1 , · · · , N − 1. Compute best solution for current time step, and pair with future decisions. Start from end. Work backwards recursively. In the words of French researcher Kaufmann: An optimal policy contains only optimal subpolicies. Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 04 - Dynamic Programming Slide 9

  12. Principle of Optimality (in math) Define V k ( x k ) as the optimal “value” from time step k to the end of the time horizon N , given the current state is x k . Then the principle of optimality (PoO) can be written in recursive form as: V k ( x k ) = min u k { c k ( x k , u k ) + V k + 1 ( x k + 1 ) } [a.k.a. “Bellman Equation”] with the boundary condition V N ( x N ) = c N ( x N ) Admittedly awkward aspects: You solve the problem backward! You solve the problem recursively! Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 04 - Dynamic Programming Slide 10

  13. EX 2: Shortest Path Revisited 6 B F 2 5 2 1 A 5 C 4 7 3 G E 2 1 4 4 5 11 D H Let V ( i ) be the shortest path from node i to node H. Ex: V ( H ) = 0. Let c ( i , j ) denote the cost of traveling from node i to node j . Ex: c ( C , E ) = 7. c ( i , j ) + V ( j ) is cost on path from node i to j , and then from j to H along shortest path. Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 04 - Dynamic Programming Slide 11

  14. EX 2: Shortest Path Revisited - Solution Principle of optimality & boundary condition: V ( i ) = { c ( i , j ) + V ( j ) } min j ∈ N d i V ( H ) = 0 V ( G ) = c ( G , H ) + V ( H ) = 2 + 0 = 2 V ( E ) = min { c ( E , G ) + V ( G ) , c ( E , H ) + V ( H ) } = min { 3 + 2 , 4 + 0 } = 4 V ( F ) = min { c ( F , G ) + V ( G ) , c ( F , H ) + V ( H ) , c ( F , E ) + V ( E ) } = min { 2 + 2 , 5 + 0 , 1 + 4 } = 4 V ( D ) = min { c ( D , E ) + V ( E ) , c ( D , H ) + V ( H ) } = min { 5 + 4 , 11 + 0 } = 9 V ( C ) = min { c ( C , F ) + V ( F ) , c ( C , E ) + V ( E ) , c ( C , D ) + V ( D ) } = min { 5 + 4 , 7 + 4 , 1 + 9 } = 9 V ( B ) = c ( B , F ) + V ( F ) = 6 + 4 = 10 V ( A ) = min { c ( A , B ) + V ( B ) , c ( A , C ) + V ( C ) , c ( A , D ) + V ( D ) } = min { 2 + 10 , 4 + 9 , 4 + 9 } = 12 A → B → F → G → H Optimal Path: Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 04 - Dynamic Programming Slide 12

  15. EX 3: Optimal Consumption & Saving Given: Consumer lives over periods k = 0 , 1 , · · · , N Consumes finite resource. Consumption each period is u k Utility of consuming u k units of resource is ln ( u k ) Let x k represent remaining resources in period k Dynamics: x k + 1 = x k − u k , x 0 is initial resource level Constraints: x k ≥ 0 Total Utility: N − 1 � J = ln ( u k ) k = 0 Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 04 - Dynamic Programming Slide 13

  16. EX 3: Optimal Consumption & Saving Step 1 (Define Value Function): Let V k ( x k ) denote the maximum total utility from time step k to terminal time step N , where the resource level in step k is x k . Step 2 (PoO Equation): V k ( x k ) = 0 ≤ u k ≤ x k { ln ( u k ) + V k ( x k + 1 ) } , k = 0 , 1 , · · · , N − 1 max Step 3 (Boundary Condition): V N ( x N ) = 0 Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 04 - Dynamic Programming Slide 14

  17. EX 3: Optimal Consumption & Saving For k = N − 1: = 0 ≤ u N − 1 ≤ x N − 1 { ln ( u N − 1 ) + V N ( x N ) } max V N − 1 . . . = ln ( x N − 1 ) , u ⋆ N − 1 = x N − 1 V N − 1 For k = N − 2: = 0 ≤ u N − 2 ≤ x N − 2 { ln ( u N − 2 ) + V N − 1 ( x N − 1 ) } V N − 2 max . . . ln ( 1 N − 2 = 1 4 x 2 V N − 2 = N − 2 ) , u ⋆ 2 x N − 2 Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 04 - Dynamic Programming Slide 15

  18. EX 3: Optimal Consumption & Saving For k = N − 3: V N − 3 = 0 ≤ u N − 3 ≤ x N − 3 { ln ( u N − 3 ) + V N ( x N − 2 ) } max . . . � 1 � N − 3 = 1 27 x 3 u ⋆ V N − 3 = ln 3 x N − 3 , N − 3 Pattern emerges. Use mathematical induction to show: 1 u ⋆ k = k = 0 , · · · , N − 1 N − k x k , This is a “state feedback control policy”, in the form u ⋆ k = π ⋆ ( x k ) . Can show policy in open-loop form is: k = 1 u ⋆ k = 0 , · · · , N − 1 Nx 0 , Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 04 - Dynamic Programming Slide 16

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend