Principles of Optimal Control Spring 2008

Similar documents
Calculus of Variations

Robotics. Islam S. M. Khalil. November 15, German University in Cairo

Principles of Optimal Control Spring 2008

Calculus of Variations

Principles of Optimal Control Spring 2008

Functional differentiation

THEODORE VORONOV DIFFERENTIAL GEOMETRY. Spring 2009

D(f/g)(P ) = D(f)(P )g(p ) f(p )D(g)(P ). g 2 (P )

Second order Unit Impulse Response. 1. Effect of a Unit Impulse on a Second order System

Math 234 Final Exam (with answers) Spring 2017

Optimisation and optimal control 1: Tutorial solutions (calculus of variations) t 3

Calculus of Variations Summer Term 2014

NOTES ON CALCULUS OF VARIATIONS. September 13, 2012

EN Applied Optimal Control Lecture 8: Dynamic Programming October 10, 2018

Math 115 ( ) Yum-Tong Siu 1. General Variation Formula and Weierstrass-Erdmann Corner Condition. J = x 1. F (x,y,y )dx.

minimize x subject to (x 2)(x 4) u,

Physics 200 Lecture 4. Integration. Lecture 4. Physics 200 Laboratory

Chapter 4. Adjoint-state methods

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science : Dynamic Systems Spring 2011

18.02 Multivariable Calculus Fall 2007

Topic # Feedback Control Systems

Solutions of Spring 2008 Final Exam

Mathematical Economics. Lecture Notes (in extracts)

Lecture Notes for PHY 405 Classical Mechanics

Problem Set Number 5, j/2.036j MIT (Fall 2014)

1 Lagrange Multiplier Method

Legendre Transforms, Calculus of Varations, and Mechanics Principles

Derivatives and Integrals

x n cos 2x dx. dx = nx n 1 and v = 1 2 sin(2x). Andreas Fring (City University London) AS1051 Lecture Autumn / 36

2tdt 1 y = t2 + C y = which implies C = 1 and the solution is y = 1

Principles of Optimal Control Spring 2008

PHYS 705: Classical Mechanics. Calculus of Variations I

Exercises for Multivariable Differential Calculus XM521

Introduction to Arithmetic Geometry Fall 2013 Problem Set #10 Due: 12/3/2013

Joint work with Nguyen Hoang (Univ. Concepción, Chile) Padova, Italy, May 2018

Introduction and Vectors Lecture 1

Calculus of Variations Summer Term 2016

Physics 6010, Fall 2016 Constraints and Lagrange Multipliers. Relevant Sections in Text:

Quantitative Techniques (Finance) 203. Polynomial Functions

Introduction to the Calculus of Variations

Coordinate systems and vectors in three spatial dimensions

8.323 Relativistic Quantum Field Theory I

for changing independent variables. Most simply for a function f(x) the Legendre transformation f(x) B(s) takes the form B(s) = xs f(x) with s = df

Damped harmonic motion

Lagrange Multipliers

AB.Q103.NOTES: Chapter 2.4, 3.1, 3.2 LESSON 1. Discovering the derivative at x = a: Slopes of secants and tangents to a curve

YURI LEVIN, MIKHAIL NEDIAK, AND ADI BEN-ISRAEL

Existence Theory: Green s Functions

Physics Fall Mechanics, Thermodynamics, Waves, Fluids. Recap: Position and displacement

Tutorial on Control and State Constrained Optimal Control Pro. Control Problems and Applications Part 3 : Pure State Constraints

Analysis II - few selective results

Sec. 1.1: Basics of Vectors

Partial Derivatives. w = f(x, y, z).

The Derivative. Appendix B. B.1 The Derivative of f. Mappings from IR to IR

HOMEWORK 7 SOLUTIONS

SOME PROBLEMS YOU SHOULD BE ABLE TO DO

MATH H53 : Final exam

6.241 Dynamic Systems and Control

(1) Recap of Differential Calculus and Integral Calculus (2) Preview of Calculus in three dimensional space (3) Tools for Calculus 3

Partial Differential Equations Summary

Duality, Dual Variational Principles

Lecture 10: Singular Perturbations and Averaging 1

Taylor Series and stationary points

Numerical Optimization

LECTURE 25: REVIEW/EPILOGUE LECTURE OUTLINE

Chapter 3 Numerical Methods

3 Parallel transport and geodesics

Predicting the future with Newton s Second Law

Deterministic Dynamic Programming

Lagrange multipliers. Portfolio optimization. The Lagrange multipliers method for finding constrained extrema of multivariable functions.

Chapter 3 Derivatives

LECTURE NOTES IN CALCULUS OF VARIATIONS AND OPTIMAL CONTROL MSc in Systems and Control. Dr George Halikias

Course Notes Math 275 Boise State University. Shari Ultman

Consider a particle in 1D at position x(t), subject to a force F (x), so that mẍ = F (x). Define the kinetic energy to be.

Lecture 1: Pragmatic Introduction to Stochastic Differential Equations

Getting Some Big Air

16 Singular perturbations

How to Use Calculus Like a Physicist

Analytical Dynamics: Lagrange s Equation and its Application A Brief Introduction

Lecture 13 - Wednesday April 29th

Elementary realization of BRST symmetry and gauge fixing

UNIVERSITY OF SOUTHAMPTON. A foreign language dictionary (paper version) is permitted provided it contains no notes, additions or annotations.

Objective. 1 Specification/modeling of the controlled system. 2 Specification of a performance criterion

Sketchy Notes on Lagrangian and Hamiltonian Mechanics

Problem Set Number 2, j/2.036j MIT (Fall 2014)

Math 210, Final Exam, Spring 2012 Problem 1 Solution. (a) Find an equation of the plane passing through the tips of u, v, and w.

Optimization using Calculus. Optimization of Functions of Multiple Variables subject to Equality Constraints

Gradient, Divergence and Curl in Curvilinear Coordinates

UNIVERSITY of LIMERICK

Math and Numerical Methods Review

Physics 411 Lecture 7. Tensors. Lecture 7. Physics 411 Classical Mechanics II

2.098/6.255/ Optimization Methods Practice True/False Questions

Variational Methods & Optimal Control

CHAPTER 6 VECTOR CALCULUS. We ve spent a lot of time so far just looking at all the different ways you can graph

MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.436J/15.085J Fall 2008 Lecture 8 10/1/2008 CONTINUOUS RANDOM VARIABLES

Lecture Note 13:Continuous Time Switched Optimal Control: Embedding Principle and Numerical Algorithms

Time-optimal control of a 3-level quantum system and its generalization to an n-level system

Physics 141 Energy 1 Page 1. Energy 1

10.34: Numerical Methods Applied to Chemical Engineering. Lecture 19: Differential Algebraic Equations

3 Applications of partial differentiation

Transcription:

MIT OpenCourseWare http://ocw.mit.edu 16.323 Principles of Optimal Control Spring 2008 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

16.323 Lecture 5 Calculus of Variations Calculus of Variations Most books cover this material well, but Kirk Chapter 4 does a particularly nice job. See here for online reference. x(t) x* x*+ αδx (1) x*- αδx(1) αδx (1) αδx (1) t f t Figure by MIT OpenCourseWare.

Spr 2008 16.323 5 1 Calculus of Variations Goal: Develop alternative approach to solve general optimization problems for continuous systems variational calculus Formal approach will provide new insights for constrained solutions, and a more direct path to the solution for other problems. Main issue General control problem, the cost is a function of functions x(t) and u(t). min J = h(x(t f )) + g(x(t), u(t), t)) subject to ẋ = f(x, u, t) x( ), given m(x(t f ), t f ) = 0 Call J(x(t), u(t)) a functional. Need to investigate how to find the optimal values of a functional. For a function, we found the gradient, and set it to zero to find the stationary points, and then investigated the higher order derivatives to determine if it is a maximum or minimum. Will investigate something similar for functionals.

Spr 2008 16.323 5 2 Maximum and Minimum of a Function A function f(x) has a local minimum at x if f(x) f(x ) for all admissible x in x x ɛ Minimum can occur at (i) stationary point, (ii) at a boundary, or (iii) a point of discontinuous derivative. If only consider stationary points of the differentiable function f(x), then statement equivalent to requiring that differential of f satisfy: f df = dx = 0 x for all small dx, which gives the same necessary condition from Lecture 1 f = 0 x Note that this definition used norms to compare two vectors. Can do the same thing with functions distance between two functions where d = x 2 (t) x 1 (t) 1. x(t) 0 for all x(t), and x(t) = 0 only if x(t) = 0 for all t in the interval of definition. 2. ax(t) = a x(t) for all real scalars a. 3. x 1 (t) + x 2 (t) x 1 (t) + x 2 (t) Common function norm: x(t) 2 = ( tf ) 1/2 x(t) T x(t)

Spr 2008 16.323 5 3 Maximum and Minimum of a Functional A functional J(x(t)) has a local minimum at x (t) if J(x(t)) J(x (t)) for all admissible x(t) in x(t) x (t) ɛ Now define something equivalent to the differential of a function called a variation of a functional. An increment of a functional ΔJ(x(t), δx(t)) = J(x(t) + δx(t)) J(x(t)) A variation of the functional is a linear approximation of this increment: ΔJ(x(t), δx(t)) = δj(x(t), δx(t)) + H.O.T. i.e. δj(x(t), δx(t)) is linear in δx(t). Figure by MIT OpenCourseWare. Figure 5.1: Differential df versus increment Δf shown for a function, but the same difference holds for a functional.

Spr 2008 16.323 5 4 x(t) x* x*+ αδx (1) x*- αδx(1) αδx (1) αδx (1) t f t Figure by MIT OpenCourseWare. Figure 5.2: Visualization of perturbations to function x(t) by δx(t) it is a potential change in the value of x over the entire time period of interest. Typically require that if x(t) is in some class (i.e., continuous), that x(t) + δx(t) is also in that class. Fundamental Theorem of the Calculus of Variations Let x be a function of t in the class Ω, and J(x) be a differentiable functional of x. Assume that the functions in Ω are not constrained by any boundaries. If x is an extremal function, then the variation of J must vanish on x, i.e. for all admissible δx, δj(x(t), δx(t)) = 0 Proof is in Kirk, page 121, but it is relatively straightforward. tf How compute the variation? If J(x(t)) = t f(x(t)) where f has 0 cts first and second derivatives with respect to x, then { } f(x(t)) δj(x(t), δx) = δx + f(x(t f ))δt f f(x( ))δ x(t) t f = f x (x(t))δx + f(x(t f ))δt f f(x( ))δ

Spr 2008 16.323 5 5 Variation Examples: Scalar For more general problems, first consider the cost evaluated on a scalar function x(t) with, t f and the curve endpoints fixed. J(x(t)) = g(x(t), ẋ(t), t) δj(x(t), δx) = Note that d δẋ = δx so δx and δẋ are not independent. t f [ g x (x(t), ẋ(t), t)δx + g ẋ (x(t), ẋ(t), t)δẋ] Integrate by parts: udv uv vdu with u = g ẋ and dv = δ ẋ to get: δj(x(t), δx) = g x (x(t), ẋ(t), t)δx + [g ẋ (x(t), ẋ(t), t)δx] t f t0 d g ẋ(x(t), ẋ(t), t)δx t 0 t f d = g x (x(t), ẋ(t), t) g ẋ (x(t), ẋ(t), t) δx(t) tf + [g ẋ (x(t), ẋ(t), t)δx] t 0 Since x( ), x(t f ) given, then δx( ) = δx(t f ) = 0, yielding d δj(x(t), δx) = g x (x(t), ẋ(t), t) g ẋ (x(t), ẋ(t), t) δx(t)

Spr 2008 16.323 5 6 Recall need δj = 0 for all admissible δx(t), which are arbitrary within (, t f ) the (first order) necessary condition for a maximum or minimum is called Euler Equation: g(x(t), ẋ(t), t) x d ( ) g(x(t), ẋ(t), t) ẋ = 0 Example: Find the curve that gives the shortest distance between 2 points in a plane (x 0, y 0 ) and (x f, y f ). Cost function sum of differential arc lengths: xf xf J = ds = (dx) 2 + (dy) 2 x 0 x 0 ( dy ) 2 xf = 1 + dx x 0 dx Take y as dependent variable, and x as independent one dy dx ẏ New form of the cost: x f x f J = 1 + ẏ 2 dx g(ẏ)dx x 0 x 0 Take partials: g/ y = 0, and ( ) ( ) d g d g dẏ = dx ẏ dẏ ẏ dx ( ) d ẏ ÿ = ÿ = = 0 dẏ (1 + ẏ 2 ) 1/2 (1 + ẏ 2 ) 3/2 which implies that ÿ = 0 Most general curve with ÿ = 0 is a line y = c 1 x + c 2

Spr 2008 16.323 5 7 Vector Functions Can generalize the problem by including several (N) functions x i (t) and possibly free endpoints J(x(t)) = g(x(t), ẋ(t), t) with, t f, x( ) fixed. Then (drop the arguments for brevity) δj(x(t), δx) = [ g x δx(t) + g ẋ δẋ(t)] Integrate by parts to get: d δj(x(t), δx) = g x g ẋ δx(t) + g ẋ (x(t f ), ẋ(t f ), t f )δx(t f ) The requirement then is that for t (, t f ), x(t) must satisfy g d g x ẋ = 0 where x( ) = x 0 which are the given N boundary conditions, and the remaining N more BC follow from: x(t f ) = x f if x f is given as fixed, If x(t f ) are free, then g(x(t), ẋ(t), t) = 0 ẋ(t f ) Note that we could also have a mixture, where parts of x(t f ) are given as fixed, and other parts are free just use the rules above on each component of x i (t f )

Spr 2008 16.323 5 8 Free Terminal Time Now consider a slight variation: the goal is to minimize J(x(t)) = g(x(t), ẋ(t), t) with, x( ) fixed, t f free, and various constraints on x(t f ) Compute variation of the functional considering 2 candidate solutions: x(t), which we consider to be a perturbation of the optimal x (t) (that we need to find) δj(x (t), δx) = [ g x δx(t) + g ẋ δẋ(t)] + g(x (t f ), ẋ (t f ), t f )δt f Integrate by parts to get: d δj(x (t), δx) = g x g ẋ δx(t) + g ẋ (x (t f ), ẋ (t f ), t f )δx(t f ) + g(x (t f ), ẋ (t f ), t f )δt f Looks standard so far, but we have to be careful how we handle the terminal conditions

Spr 2008 16.323 5 9 Figure by MIT OpenCourseWare. Figure 5.3: Comparison of possible changes to function at end time when t f is free. By definition, δx(t f ) is the difference between two admissible functions at time t f (in this case the optimal solution x and another candidate x). But in this case, must also account for possible changes to δt f. Define δx f as being the difference between the ends of the two possible functions total possible change in the final state: so δx(t f ) = δx f in general. δx f δx(t f ) + ẋ (t f )δt f Substitute to get d δj(x (t), δx) = g x g ẋ δx(t) + g ẋ (x (t f ), ẋ (t f ), t f )δx f + [g(x (t f ), ẋ (t f ), t f ) g ẋ (x (t f ), ẋ (t f ), t f )ẋ (t f )] δt f

Spr 2008 16.323 5 10 Independent of the terminal constraint, the conditions on the solution x (t) to be an extremal for this case are that it satisfy the Euler equations g x (x (t), ẋ (t), t) d g ẋ(x (t), ẋ (t), t) = 0 Now consider the additional constraints on the individual elements of x (t f ) and t f to find the other boundary conditions Type of terminal constraints determines how we treat δx f and δt f 1. Unrelated 2. Related by a simple function x(t f ) = Θ(t f ) 3. Specified by a more complex constraint m(x(t f ), t f ) = 0 Type 1: If t f and x(t f ) are free but unrelated, then δx f and δt f are independent and arbitrary their coefficients must both be zero. g x (x (t), ẋ (t), t) d g ẋ(x (t), ẋ (t), t) = 0 g(x (t f ), ẋ (t f ), t f ) gẋ(x (t f ), ẋ (t f ), t f ) ẋ (t f ) = 0 gẋ(x (t f ), ẋ (t f ), t f ) = 0 Which makes it clear that this is a two-point boundary value problem, as we now have conditions at both and t f

Spr 2008 16.323 5 11 Type 2: If t f and x(t f ) are free but related as x(t f ) = Θ(t f ), then dθ δx f = (t f )δt f Substitute and collect terms gives [ d dθ δj = g x g ẋ δx + g ẋ (x (t f ), ẋ (t f ), t f ) (t f ) ] + g(x (t f ), ẋ (t f ), t f ) g ẋ (x (t f ), ẋ (t f ), t f )ẋ (t f ) δt f Set coefficient of δt f to zero (it is arbitrary) full conditions gẋ(x (t f ), ẋ (t f ), t f ) g x (x (t), ẋ (t), t) d g ẋ(x (t), ẋ (t), t) = 0 dθ (t f ) ẋ (t f ) + g(x (t f ), ẋ (t f ), t f ) = 0 Last equation called the Transversality Condition To handle third type of terminal condition, must address solution of constrained problems.

Spr 2008 16.323 5 12 Image removed due to copyright restrictions. Figure 5.4: Summary of possible terminal constraints (Kirk, page 151)

Spr 2008 16.323 5 13 Example: 5 1 Find the shortest curve from the origin to a specified line. Goal: minimize the cost functional (See page 5 6) J = 1 + ẋ 2 (t) given that = 0, x(0) = 0, and t f and x(t f ) are free, but x(t f ) must line on the line θ(t) = 5t + 15 Since g(x, x, t) is only a function of x, Euler equation reduces to d ẋ (t) = 0 [1 + ẋ (t) 2 ] 1/2 which after differentiating and simplifying, gives ẍ (t) = 0 is a straight line x (t) = c 1 t + c 0 but since x(0) = 0, then c 0 = 0 Transversality condition gives x ( tf) [ 5 ẋ (t [1 + x ( t ) 2 ] 1/2 f )] + [1 + ẋ (t f ) 2 ] 1/2 = 0 that simplifies to f [ẋ (t f )] [ 5 ẋ (t f )] + [1 + ẋ (t f ) 2 ] = 5ẋ (t f ) + 1 = 0 so that ẋ (t f ) = c 1 = 1/5 answer Not a surprise, as this gives the slope of a line orthogonal to the constraint line. To find final time: x(t f ) = 5t f + 15 = t f /5 which gives t f 2.88

Spr 2008 16.323 5 14 Example: 5 2 Had the terminal constraint been a bit more challenging, such as 1 dθ Θ(t) = 2 ([t 5] 2 1) = t 5 Then the transversality condition gives ẋ (t f ) [t f 5 ẋ (t f )] + [1 + ẋ (t f ) 2 ] 1/2 = 0 [1 + ẋ (t f ) 2 ] 1/2 Now look at x (t) and Θ(t) at t f [ẋ (t f )] [t f 5 ẋ (t f )] + [1 + ẋ (t f ) 2 ] = 0 c 1 [t f 5] + 1 = 0 x tf (t f ) = (tf 5) = 1 2 ([t f 5] 2 1) which gives t f = 3, c 1 = 1/2 and x (t f ) = t/2 Figure 5.5: Quadratic terminal constraint.

Spr 2008 16.323 5 15 Corner Conditions Key generalization of the preceding is to allow the possibility that the solutions not be as smooth Assume that x(t) cts, but allow discontinuities in ẋ(t), which occur at corners. Naturally occur when intermediate state constraints imposed, or with jumps in the control signal. Goal: with, t f, x( ), and x(t f ) fixed, minimize cost functional J(x(t), t) = g(x(t), ẋ(t), t) Assume g has cts first/second derivatives wrt all arguments Even so, ẋ discontinuity could lead to a discontinuity in g. Assume that ẋ has a discontinuity at some time t 1 (, t f ), which is not fixed (or typically known). Divide cost into 2 regions: t 1 J(x(t), t) = g(x(t), ẋ(t), t) + g(x(t), ẋ(t), t) t 1 Expand as before note that t 1 is not fixed t 1 g g δj = δx + δẋ + g(t1 )δt 1 x ẋ g g + + δx + δẋ g(t 1 )δt 1 x ẋ t 1

Spr 2008 16.323 5 16 Now IBP t 1 d δj = g x (g x) δx + g(t1 )δt 1 + g ẋ (t1 )δx(t 1 ) d + + + + g x (g ẋ ) δx g(t 1 )δt 1 g ẋ (t 1 )δx(t 1 ) t 1 As on 5 9, must constrain δx 1, which is the total variation in the solution at time t 1 from lefthand side δx 1 = δx(t 1 ) + ẋ(t 1 )δt 1 from righthand side + + δx 1 = δx(t 1 ) + ẋ(t 1 )δt 1 Continuity requires that these two expressions for δx 1 be equal Already know that it is possible that ẋ(t 1 ) = that δx(t 1 ) = δx(t+ 1 ) as well. ẋ(t+ 1 ), so possible Substitute: t 1 d δj = g x (g ẋ ) δx + g(t 1 ) g ẋ(t 1 )ẋ(t 1 ) δt 1 + g ẋ (t 1 )δx 1 t f d + + + + + g x (g ẋ ) δx g(t 1 ) g ẋ (t 1 )ẋ(t 1 ) δt 1 g ẋ (t 1 )δx 1 t 1 Necessary conditions are then: g x d (g ẋ) = 0 t (, t f ) gẋ(t 1 ) = g ẋ(t + 1 ) g(t 1 ) g ẋ(t 1 ) ẋ(t 1 ) = g(t+ 1 ) gẋ(t + 1 ) ẋ(t + 1 ) Last two are the Weierstrass-Erdmann conditions

Spr 2008 16.323 5 17 Necessary conditions given for a special set of the terminal conditions, but the form of the internal conditions unchanged by different terminal constraints With several corners, there are a set of constraints for each Can be used to demonstrate that there isn t a corner Typical instance that induces corners is intermediate time constraints of the form x(t 1 ) = θ(t 1 ). i.e., the solution must touch a specified curve at some point in time during the solution. Slightly complicated in this case, because the constraint couples the allowable variations in δx 1 and δt since δx 1 = dθ δt 1 = θ δt 1 But can eliminate δx 1 in favor of δt 1 in the expression for δj to get new corner condition: + + + + g(t 1 )+g ẋ(t 1 ) θ (t 1 ) ẋ(t 1 ) = g(t 1 )+g ẋ (t 1 ) θ (t 1 ) ẋ(t 1 ) So now g (t + ẋ (t 1 ) = g ẋ 1 ) no longer needed, but have x(t 1) = θ(t 1 )

Spr 2008 16.323 5 18 Corner Example Find shortest length path joining the points x = 0, t = 2 and x = 0, t = 1 that touches the curve x = t 2 + 3 at some point In this case, J = 1 1 + ẋ2 with x(1) = x( 2) = 0 and x(t 1 ) = t 2 1 + 3 2 Note that since g is only a function of ẋ, then solution x(t) will only be linear in each segment (see 5 13) segment 1 x(t) = a + bt segment 2 x(t) = c + Terminal conditions: x( 2) = a 2b = 0 and x(1) = c + d = 0 Apply corner condition: 1 + ẋ(t 1 )2 + ẋ(t 1 ) [ 2t 1 ẋ(t 1 ) ] 1 + ẋ(t 1 )2 1 + 2t = 1 ẋ(t + 1 ) 1 + 2t = 1 ẋ(t + 1 ) 1 + ẋ(t 1 )2 1 + ẋ(t + 1 )2 which gives: 1 + 2bt 1 1 + 2 1 = 1 + b 2 1 + d 2 Solve using fsolve to get: a = 3.0947, b = 1.5474, c = 2.8362, d = 2.8362, t 1 = 0.0590 function F=myfunc(x); % % x=[a b c d t1]; % F=[x(1)-2*x(2); x(3)+x(4); (1+2*x(2)*x(5))/(1+x(2)^2)^(1/2) - (1+2*x(4)*x(5))/(1+x(4)^2)^(1/2); x(1)+x(2)*x(5) - (x(5)^2+3); x(3)+x(4)*x(5) - (x(5)^2+3)]; return % x = fsolve( myfunc,[2 1 2-2 0] )

Spr 2008 16.323 5 19 Constrained Solutions Now consider variations of the basic problem that include constraints. For example, if the goal is to find the extremal function x that minimizes tf J(x(t), t) = g(x(t), ẋ(t), t) subject to the constraint that a given set of n differential equations be satisfied f(x(t), ẋ(t), t) = 0 where we assume that x R n+m (take t f and x(t f ) to be fixed) As with the basic optimization problems in Lecture 2, proceed by augmenting cost with the constraints using Lagrange multipliers Since the constraints must be satisfied at all time, these multipliers are also assumed to be functions of time. { } J a (x(t), t) = g(x, ẋ, t) + p(t) T f(x, ẋ, t) Does not change the cost if the constraints are satisfied. Time varying Lagrange multipliers give more degrees of freedom in specifying how the constraints are added. Take variation of augmented functional considering perturbations to both x(t) and p(t) δj(x(t), δx(t), p(t), δp(t)) { } = g x + p T f x δx(t) + g ẋ + p T f ẋ δẋ(t) + f T δp(t)

Spr 2008 16.323 5 20 As before, integrate by parts to get: δj(x(t), δx(t), p(t), δp(t)) ({ } ) d = g x + p T f x g ẋ + p T f ẋ δx(t) + f T δp(t) To simplify things a bit, define g a (x(t), ẋ(t), t) g(x(t), ẋ(t), t) + p(t) T f(x(t), ẋ(t), t) On the extremal, the variation must be zero, but since δx(t) and δp(t) can be arbitrary, can only occur if g a (x(t), ẋ(t), t) d ( ) ga (x(t), ẋ(t), t) = 0 x ẋ f(x(t), ẋ(t), t) = 0 which are obviously a generalized version of the Euler equations obtained before. Note similarity of the definition of g a here with the Hamiltonian on page 4 4. Will find that this generalization carries over to future optimizations as well.

Spr 2008 16.323 5 21 General Terminal Conditions Now consider Type 3 constraints on 5 10, which are a very general form with t f free and x(t f ) given by a condition: m(x(t f ), t f ) = 0 Constrained optimization, so as before, augment the cost functional J(x(t), t) = h(x(t f ), t f ) + g(x(t), ẋ(t), t) with the constraint using Lagrange multipliers: J a (x(t), ν, t) = h(x(t f ), t f )+ν T m(x(t f ), t f )+ g(x(t), ẋ(t), t) Considering changes to x(t), t f, x(t f ) and ν, the variation for J a is ( ) δj a = h x (t f )δx f + h tf δt f + m T (t f )δν + ν T m x (t f )δx f + m tf (t f )δt f + [g x δx + g ẋ δẋ] + g(t f )δt f = h x (t f ) + ν T m x (t f ) δx f + h tf + ν T m tf (t f ) + g(t f ) δt f d +m T (t f )δν + g x g ẋ δx + g ẋ (t f )δx(t f ) Now use that δx f = δx(t f ) + ẋ(t f )δt f as before to get δj a = h [ x (t f ) + ν T m x (t f ) + g ẋ (t f ) δx f ] + h tf + ν T m tf (t f ) + g(t f ) g ẋ (t f )ẋ(t f ) δt f + m T (t f )δν d + g x g ẋ δx

Spr 2008 16.323 5 22 Looks like a bit of a mess, but we can clean it up a bit using to get δj a w(x(t f ), ν, t f ) = h(x(t f ), t f ) + ν T m(x(t f ), t f ) = [w x (t f ) + gx (t f )] δx [ f ] + w tf + g(t f ) g ẋ (t f )ẋ(t f ) δt f + m T (t f )δν d + g x g ẋ δx Given the extra degrees of freedom in the multipliers, can treat all of the variations as independent all coefficients must be zero to achieve δj a = 0 So the necessary conditions are g x d g ẋ = 0 (dim n) w x (t f ) + gẋ(t f ) = 0 (dim n) w tf + g(t f ) gẋ(t f ) ẋ(t f ) = 0 (dim 1) With x( ) = x 0 (dim n) and m(x(t f ), t f ) = 0 (dim m) combined with last 2 conditions 2n + m + 1 constraints Solution of Eulers equation has 2n constants of integration for x(t), and must find ν (dim m) and t f 2n + m + 1 unknowns Some special cases: If t f is fixed, h = h(x(t f )), m m(x(t f )) and we lose the last condition in box others remain unchanged If t f is fixed, x(t f ) free, then there is no m, no ν and w reduces to h. Kirk s book also considers several other type of constraints.