Nonlinear Optimization for Optimal Control

Slides:



Advertisements
Similar presentations
Engineering Optimization
Advertisements

Introducción a la Optimización de procesos químicos. Curso 2005/2006 BASIC CONCEPTS IN OPTIMIZATION: PART II: Continuous & Unconstrained Important concepts.
Optimization of thermal processes2007/2008 Optimization of thermal processes Maciej Marek Czestochowa University of Technology Institute of Thermal Machinery.
Least Squares example There are 3 mountains u,y,z that from one site have been measured as 2474 ft., 3882 ft., and 4834 ft.. But from u, y looks 1422 ft.
Lecture 8 – Nonlinear Programming Models Topics General formulations Local vs. global solutions Solution characteristics Convexity and convex programming.
Nonlinear Optimization for Optimal Control
Inexact SQP Methods for Equality Constrained Optimization Frank Edward Curtis Department of IE/MS, Northwestern University with Richard Byrd and Jorge.
Iterative methods TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAA A A A A A A A.
Classification and Prediction: Regression Via Gradient Descent Optimization Bamshad Mobasher DePaul University.
Easy Optimization Problems, Relaxation, Local Processing for a single variable.
1cs542g-term Notes  Assignment 1 due tonight ( me by tomorrow morning)
Numerical Optimization
Function Optimization Newton’s Method. Conjugate Gradients
1cs542g-term Notes  Extra class this Friday 1-2pm  If you want to receive s about the course (and are auditing) send me .
Tutorial 12 Unconstrained optimization Conjugate gradients.
Methods For Nonlinear Least-Square Problems
Optimization Methods One-Dimensional Unconstrained Optimization
Approximation Algorithms
MAE 552 – Heuristic Optimization Lecture 3 January 28, 2002.
Optimization Mechanics of the Simplex Method
Tutorial 5-6 Function Optimization. Line Search. Taylor Series for Rn
Optimization Methods One-Dimensional Unconstrained Optimization
Optimization Linear Programming and Simplex Method
Unconstrained Optimization Problem
Maximum Likelihood (ML), Expectation Maximization (EM)
Function Optimization. Newton’s Method Conjugate Gradients Method
Advanced Topics in Optimization
Optimality Conditions for Nonlinear Optimization Ashish Goel Department of Management Science and Engineering Stanford University Stanford, CA 94305, U.S.A.
Why Function Optimization ?
Math for CSLecture 51 Function Optimization. Math for CSLecture 52 There are three main reasons why most problems in robotics, vision, and arguably every.
Easy Optimization Problems, Relaxation, Local Processing for a small subset of variables.
Kalman Filtering Pieter Abbeel UC Berkeley EECS Many slides adapted from Thrun, Burgard and Fox, Probabilistic Robotics TexPoint fonts used in EMF. Read.
Optimization Methods One-Dimensional Unconstrained Optimization
Tier I: Mathematical Methods of Optimization
ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.
Computational Optimization
UNCONSTRAINED MULTIVARIABLE
KKT Practice and Second Order Conditions from Nash and Sofer
C&O 355 Lecture 2 N. Harvey TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A A.
Frank Edward Curtis Northwestern University Joint work with Richard Byrd and Jorge Nocedal February 12, 2007 Inexact Methods for PDE-Constrained Optimization.
ENCI 303 Lecture PS-19 Optimization 2
84 b Unidimensional Search Methods Most algorithms for unconstrained and constrained optimisation use an efficient unidimensional optimisation technique.
Nonlinear programming Unconstrained optimization techniques.
1 Unconstrained Optimization Objective: Find minimum of F(X) where X is a vector of design variables We may know lower and upper bounds for optimum No.
1 Optimization Multi-Dimensional Unconstrained Optimization Part II: Gradient Methods.
296.3Page :Algorithms in the Real World Linear and Integer Programming II – Ellipsoid algorithm – Interior point methods.
Frank Edward Curtis Northwestern University Joint work with Richard Byrd and Jorge Nocedal January 31, 2007 Inexact Methods for PDE-Constrained Optimization.
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Optimization & Constraints Add mention of global techiques Add mention of calculus.
1 Markov Decision Processes Infinite Horizon Problems Alan Fern * * Based in part on slides by Craig Boutilier and Daniel Weld.
1 Markov Decision Processes Infinite Horizon Problems Alan Fern * * Based in part on slides by Craig Boutilier and Daniel Weld.
Exact Differentiable Exterior Penalty for Linear Programming Olvi Mangasarian UW Madison & UCSD La Jolla Edward Wild UW Madison December 20, 2015 TexPoint.
Chapter 4 Sensitivity Analysis, Duality and Interior Point Methods.
CPSC 536N Sparse Approximations Winter 2013 Lecture 1 N. Harvey TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAAAAAAAA.
Inexact SQP methods for equality constrained optimization Frank Edward Curtis Department of IE/MS, Northwestern University with Richard Byrd and Jorge.
METHOD OF STEEPEST DESCENT ELE Adaptive Signal Processing1 Week 5.
INTRO TO OPTIMIZATION MATH-415 Numerical Analysis 1.
Linear & Nonlinear Programming -- Basic Properties of Solutions and Algorithms.
Linear Programming Chapter 9. Interior Point Methods  Three major variants  Affine scaling algorithm - easy concept, good performance  Potential.
Searching a Linear Subspace Lecture VI. Deriving Subspaces There are several ways to derive the nullspace matrix (or kernel matrix). ◦ The methodology.
Approximation Algorithms based on linear programming.
Regularized Least-Squares and Convex Optimization.
Numerical Methods for Inverse Kinematics Kris Hauser ECE 383 / ME 442.
Exact Differentiable Exterior Penalty for Linear Programming
Function Optimization
Computational Optimization
Dr. Arslan Ornek IMPROVING SEARCH
Chapter 3 The Simplex Method and Sensitivity Analysis
~ Least Squares example
~ Least Squares example
Presentation transcript:

Nonlinear Optimization for Optimal Control Pieter Abbeel UC Berkeley EECS Many slides and figures adapted from Stephen Boyd [optional] Boyd and Vandenberghe, Convex Optimization, Chapters 9 – 11 [optional] Betts, Practical Methods for Optimal Control Using Nonlinear Programming TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAAAAAAAAAA

Bellman’s curse of dimensionality n-dimensional state space Number of states grows exponentially in n (assuming some fixed number of discretization levels per coordinate) In practice Discretization is considered only computationally feasible up to 5 or 6 dimensional state spaces even when using Variable resolution discretization Highly optimized implementations

This Lecture: Nonlinear Optimization for Optimal Control Goal: find a sequence of control inputs (and corresponding sequence of states) that solves: Generally hard to do. We will cover methods that allow to find a local minimum of this optimization problem. Note: iteratively applying LQR is one way to solve this problem if there were no constraints on the control inputs and state

Outline Unconstrained minimization Gradient Descent Newton’s Method Equality constrained minimization Inequality and equality constrained minimization

Unconstrained Minimization If x* satisfies: then x* is a local minimum of f. In simple cases we can directly solve the system of n equations given by (2) to find candidate local minima, and then verify (3) for these candidates. In general however, solving (2) is a difficult problem. Going forward we will consider this more general setting and cover numerical solution methods for (1).

Steepest Descent Idea: Start somewhere Repeat: Take a small step in the steepest descent direction Local Figure source: Mathworks

Steep Descent Another example, visualized with contours: Figure source: yihui.name

Steepest Descent Algorithm 1. Initialize x 2. Repeat 1. Determine the steepest descent direction ¢x 2. Line search. Choose a step size t > 0. 3. Update. x := x + t ¢x. 3. Until stopping criterion is satisfied

What is the Steepest Descent Direction?

Stepsize Selection: Exact Line Search Used when the cost of solving the minimization problem with one variable is low compared to the cost of computing the search direction itself.

Stepsize Selection: Backtracking Line Search Inexact: step length is chose to approximately minimize f along the ray {x + t ¢x | t ¸ 0}

Stepsize Selection: Backtracking Line Search Figure source: Boyd and Vandenberghe

Gradient Descent Method Figure source: Boyd and Vandenberghe

Gradient Descent: Example 1 Figure source: Boyd and Vandenberghe

Gradient Descent: Example 2 Figure source: Boyd and Vandenberghe

Gradient Descent: Example 3 Figure source: Boyd and Vandenberghe

Gradient Descent Convergence Condition number = 10 Condition number = 1 For quadratic function, convergence speed depends on ratio of highest second derivative over lowest second derivative (“condition number”) In high dimensions, almost guaranteed to have a high (=bad) condition number Rescaling coordinates (as could happen by simply expressing quantities in different measurement units) results in a different condition number

Outline Unconstrained minimization Gradient Descent Newton’s Method Equality constrained minimization Inequality and equality constrained minimization

Newton’s Method 2nd order Taylor Approximation rather than 1st order: assuming , the minimum of the 2nd order approximation is achieved at: Figure source: Boyd and Vandenberghe

Newton’s Method Figure source: Boyd and Vandenberghe

Affine Invariance Consider the coordinate transformation y = A x If running Newton’s method starting from x(0) on f(x) results in x(0), x(1), x(2), … Then running Newton’s method starting from y(0) = A x(0) on g(y) = f(A-1 y), will result in the sequence y(0) = A x(0), y(1) = A x(1), y(2) = A x(2), … Exercise: try to prove this.

Newton’s method when we don’t have Issue: now ¢ xnt does not lead to the local minimum of the quadratic approximation --- it simply leads to the point where the gradient of the quadratic approximation is zero, this could be a maximum or a saddle point Three possible fixes, let be the eigenvalue decomposition. Fix 1: Fix 2: Fix 3: In my experience Fix 2 works best.

Example 1 gradient descent with Newton’s method with backtracking line search Figure source: Boyd and Vandenberghe

Example 2 gradient descent Newton’s method Figure source: Boyd and Vandenberghe

Larger Version of Example 2

Gradient Descent: Example 3 Figure source: Boyd and Vandenberghe

Example 3 Gradient descent Newton’s method (converges in one step if f convex quadratic)

Quasi-Newton Methods Quasi-Newton methods use an approximation of the Hessian Example 1: Only compute diagonal entries of Hessian, set others equal to zero. Note this also simplfies computations done with the Hessian. Example 2: natural gradient --- see next slide

Natural Gradient Consider a standard maximum likelihood problem: Hessian: Natural gradient only keeps the 2nd term 1: faster to compute (only gradients needed); 2: guaranteed to be negative definite; 3: found to be superior in some experiments

Outline Unconstrained minimization Gradient Descent Newton’s Method Equality constrained minimization Inequality and equality constrained minimization

Equality Constrained Minimization Problem to be solved: We will cover three solution methods: Elimination Newton’s method Infeasible start Newton method

Method 1: Elimination From linear algebra we know that there exist a matrix F (in fact infinitely many) such that: can be any solution to Ax = b F spans the nullspace of A A way to find an F: compute SVD of A, A = U S V’, for A having k nonzero singular values, set F = U(:, k+1:end) So we can solve the equality constrained minimization problem by solving an unconstrained minimization problem over a new variable z: Potential cons: (i) need to first find a solution to Ax=b, (ii) need to find F, (iii) elimination might destroy sparsity in original problem structure

Methods 2 and 3 Require Us to First Understand the Optimality Condition Recall the problem to be solved:

Method 2: Newton’s Method Problem to be solved: Assume x is feasible, i.e., satisfies Ax = b, now use 2nd order approximation of f:  Optimality condition for 2nd order approximation:

Method 2: Newton’s Method With Newton step obtained by solving a linear system of equations: Feasible descent method:

Method 3: Infeasible Start Newton Method Problem to be solved: Use 1st order approximation of the optimality conditions at current x:

Methods 2 and 3 Require Us to First Understand the Optimality Condition Recall the problem to be solved:

Optimal Control We can now solve: And often one can efficiently solve by iterating over (i) linearizing the constraints, and (ii) solving the resulting problem.

Optimal Control: A Complete Algorithm Given: For k=0, 1, 2, …, T Solve Execute uk Observe resulting state, = an instantiation of Model Predictive Control. Initialization with solution from iteration k-1 can make solver very fast (and would be done most conveniently with infeasible start Newton method)

Outline Unconstrained minimization Equality constrained minimization Inequality and equality constrained minimization

Equality and Inequality Constrained Minimization Recall the problem to be solved:

Equality and Inequality Constrained Minimization Problem to be solved: Reformulation via indicator function,  No inequality constraints anymore, but very poorly conditioned objective function

Equality and Inequality Constrained Minimization Problem to be solved: Approximation via logarithmic barrier: for t>0, -(1/t) log(-u) is a smooth approximation of I_(u) approximation improves for t  1, better conditioned for smaller t Reformulation via indicator function  No inequality constraints anymore, but very poorly conditioned objective function

Barrier Method Given: strictly feasible x, t=t(0) > 0, ¹ > 1, tolerance ² > 0 Repeat 1. Centering Step. Compute x*(t) by solving starting from x 2. Update. x := x*(t). 3. Stopping Criterion. Quit if m/t < ² 4. Increase t. t := ¹ t

Example 1: Inequality Form LP

Example 2: Geometric Program

Example 3: Standard LPs

Initalization Basic phase I method: Initialize by first solving: Easy to initialize above problem, pick some x such that Ax = b, and then simply set s = maxi fi(x) Can stop early---whenever s < 0

Initalization Sum of infeasibilities phase I method: Initialize by first solving: Easy to initialize above problem, pick some x such that Ax = b, and then simply set si = max(0, fi(x)) For infeasible problems, produces a solution that satisfies many more inequalities than basic phase I method

Other methods We have covered a primal interior point method one of several optimization approaches Examples of others: Primal-dual interior point methods Primal-dual infeasible interior point methods

Optimal Control We can now solve: And often one can efficiently solve by iterating over (i) linearizing the equality constraints, convexly approximating the inequality constraints with convex inequality constraints, and (ii) solving the resulting problem.

CVX Disciplined convex programming = convex optimization problems of forms that it can easily verify to be convex Convenient high-level expressions Excellent for fast implementation Designed by Michael Grant and Stephen Boyd, with input from Yinyu Ye. Current webpage: http://cvxr.com/cvx/

CVX Matlab Example for Optimal Control, see course webpage

Example of SQP Potential exercises: Recover (2nd order approximation to) cost-to-go from open-loop optimal control formulation