Nonlinear Optimization for Optimal Control

Similar documents
Bellman s Curse of Dimensionality

Convex Optimization. Newton s method. ENSAE: Optimisation 1/44

Line Search Methods for Unconstrained Optimisation

Lecture 15 Newton Method and Self-Concordance. October 23, 2008

Homework 4. Convex Optimization /36-725

Interior Point Algorithms for Constrained Convex Optimization

Newton s Method. Ryan Tibshirani Convex Optimization /36-725

10. Unconstrained minimization

Barrier Method. Javier Peña Convex Optimization /36-725

Newton s Method. Javier Peña Convex Optimization /36-725

Nonlinear Optimization for Optimal Control Part 2. Pieter Abbeel UC Berkeley EECS. From linear to nonlinear Model-predictive control (MPC) POMDPs

Numerical Optimization Professor Horst Cerjak, Horst Bischof, Thomas Pock Mat Vis-Gra SS09

More First-Order Optimization Algorithms

Selected Topics in Optimization. Some slides borrowed from

Numerical optimization

Lecture 16: October 22

Written Examination

Lecture 14: October 17

11. Equality constrained minimization

Convex Optimization. Problem set 2. Due Monday April 26th

Optimization Tutorial 1. Basic Gradient Descent

Constrained Optimization and Lagrangian Duality

CHAPTER 2: QUADRATIC PROGRAMMING

Interior Point Methods. We ll discuss linear programming first, followed by three nonlinear problems. Algorithms for Linear Programming Problems

3E4: Modelling Choice. Introduction to nonlinear programming. Announcements

Constrained Optimization

Analytic Center Cutting-Plane Method

ORIE 6326: Convex Optimization. Quasi-Newton Methods

Numerical optimization. Numerical optimization. Longest Shortest where Maximal Minimal. Fastest. Largest. Optimization problems

Lecture Notes: Geometric Considerations in Unconstrained Optimization

Lecture 5: Gradient Descent. 5.1 Unconstrained minimization problems and Gradient descent

Convex Optimization and l 1 -minimization

Conditional Gradient (Frank-Wolfe) Method

Lecture 14: Newton s Method

1 Computing with constraints

12. Interior-point methods

4TE3/6TE3. Algorithms for. Continuous Optimization

Gradient Descent. Ryan Tibshirani Convex Optimization /36-725

Computational Finance

An Iterative Descent Method

2.098/6.255/ Optimization Methods Practice True/False Questions

CSCI 1951-G Optimization Methods in Finance Part 09: Interior Point Methods

Penalty and Barrier Methods. So we again build on our unconstrained algorithms, but in a different way.

Course Outline. FRTN10 Multivariable Control, Lecture 13. General idea for Lectures Lecture 13 Outline. Example 1 (Doyle Stein, 1979)

1. Gradient method. gradient method, first-order methods. quadratic bounds on convex functions. analysis of gradient method

Convex Optimization. Lecture 12 - Equality Constrained Optimization. Instructor: Yuanzhang Xiao. Fall University of Hawaii at Manoa

LINEAR AND NONLINEAR PROGRAMMING

Equality constrained minimization

CS711008Z Algorithm Design and Analysis

Gradient descent. Barnabas Poczos & Ryan Tibshirani Convex Optimization /36-725

Primal-Dual Interior-Point Methods for Linear Programming based on Newton s Method

8 Numerical methods for unconstrained problems

Lecture 24: August 28

CPSC 540: Machine Learning

Optimization and Root Finding. Kurt Hornik

Convex Optimization. Prof. Nati Srebro. Lecture 12: Infeasible-Start Newton s Method Interior Point Methods

Lecture 3. Optimization Problems and Iterative Algorithms

6.252 NONLINEAR PROGRAMMING LECTURE 10 ALTERNATIVES TO GRADIENT PROJECTION LECTURE OUTLINE. Three Alternatives/Remedies for Gradient Projection

A Second-Order Path-Following Algorithm for Unconstrained Convex Optimization

Optimization Methods. Lecture 18: Optimality Conditions and. Gradient Methods. for Unconstrained Optimization

Gradient Descent. Dr. Xiaowei Huang

AM 205: lecture 18. Last time: optimization methods Today: conditions for optimality

Optimization. Escuela de Ingeniería Informática de Oviedo. (Dpto. de Matemáticas-UniOvi) Numerical Computation Optimization 1 / 30

Lecture 14 Barrier method

Primal-Dual Interior-Point Methods. Ryan Tibshirani Convex Optimization /36-725

On the interior of the simplex, we have the Hessian of d(x), Hd(x) is diagonal with ith. µd(w) + w T c. minimize. subject to w T 1 = 1,

Lecture 9 Sequential unconstrained minimization

Constrained optimization. Unconstrained optimization. One-dimensional. Multi-dimensional. Newton with equality constraints. Active-set method.

Chapter 3 Numerical Methods

Lecture 5: September 12

Review of Optimization Methods

Unconstrained minimization

Unconstrained optimization

Unconstrained minimization of smooth functions

The Q-parametrization (Youla) Lecture 13: Synthesis by Convex Optimization. Lecture 13: Synthesis by Convex Optimization. Example: Spring-mass System

Optimization. Yuh-Jye Lee. March 21, Data Science and Machine Intelligence Lab National Chiao Tung University 1 / 29

Convex Optimization Overview (cnt d)

Unconstrained minimization: assumptions

1 Newton s Method. Suppose we want to solve: x R. At x = x, f (x) can be approximated by:

Appendix A Taylor Approximations and Definite Matrices

Multidisciplinary System Design Optimization (MSDO)

Why should you care about the solution strategies?

5 Handling Constraints

CS 542G: Robustifying Newton, Constraints, Nonlinear Least Squares

FRTN10 Multivariable Control, Lecture 13. Course outline. The Q-parametrization (Youla) Example: Spring-mass System

12. Interior-point methods

ISM206 Lecture Optimization of Nonlinear Objective with Linear Constraints

Lagrange Duality. Daniel P. Palomar. Hong Kong University of Science and Technology (HKUST)

Interior Point Methods in Mathematical Programming

Homework 5. Convex Optimization /36-725

Interior-Point Methods for Linear Optimization

Scientific Computing: Optimization

Primal-Dual Interior-Point Methods. Ryan Tibshirani Convex Optimization

Nonlinear Optimization: What s important?

Descent methods. min x. f(x)

Lecture 13: Constrained optimization

Agenda. Fast proximal gradient methods. 1 Accelerated first-order methods. 2 Auxiliary sequences. 3 Convergence analysis. 4 Numerical examples

Motivation. Lecture 2 Topics from Optimization and Duality. network utility maximization (NUM) problem:

CLASS NOTES Computational Methods for Engineering Applications I Spring 2015

Nonlinear Programming

Transcription:

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

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. In principle (though not in our examples), u could be parameters of a control policy rather than the raw control inputs.

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? à Steepest Descent = Gradient Descent

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

Steepest Descent = Gradient Descent 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 (assume f convex for now) 2 nd order Taylor Approximation rather than 1 st order: assuming, the minimum of the 2 nd 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 -1 x (x = Ay) 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 -1 x (0) on g(y) = f(ay), will result in the sequence y (0) = A -1 x (0), y (1) = A -1 x (1), y (2) = A -1 x (2), Exercise: try to prove this!

Affine Invariance --- Proof

Newton s method when f not convex (i.e. not ) Example 1: Example 2: 2 nd order approximation 2 nd order approximation à ended up at max rather than min! à ended up at inflection point rather than min!

Newton s method when f not convex (i.e. not ) Issue: now x nt 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 Possible fixes, let be the eigenvalue decomposition. Fix 1: Fix 2: Fix 3: ( proximal method ) Fix 4: In my experience Fix 3 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: Gradient: Hessian: Natural gradient: only keeps the 2 nd term in the Hessian. Benefits: (1) faster to compute (only gradients needed); (2) guaranteed to be negative definite; (3) found to be superior in some experiments; (4) invariant to re-parametrization

Natural Gradient Property: Natural gradient is invariant to parameterization of the family of probability distributions p( x ; µ) Hence the name. Note this property is stronger than the property of Newton s method, which is invariant to affine reparameterizations only. Exercise: Try to prove this property!

Natural Gradient Invariant to Reparametrization --- Proof Natural gradient for parametrization with µ: Let Á = f(µ), and let i.e., à the natural gradient direction is the same independent of the (invertible, but otherwise not constrained) reparametrization f

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 2 nd order approximation of f: à Optimality condition for 2 nd 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 1 st 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 u k 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: Reformulation via indicator function à No inequality constraints anymore, but very poorly conditioned objective function 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

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 = max i f i (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 s i = max(0, f i (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