Switching Time Optimization in Discretized Hybrid Dynamical Systems

Similar documents
Lecture 2 Lagrangian formulation of classical mechanics Mechanics

6 General properties of an autonomous system of two first order ODE

Schrödinger s equation.

Lagrangian and Hamiltonian Mechanics

Introduction to the Vlasov-Poisson system

BEYOND THE CONSTRUCTION OF OPTIMAL SWITCHING SURFACES FOR AUTONOMOUS HYBRID SYSTEMS. Mauro Boccadoro Magnus Egerstedt Paolo Valigi Yorai Wardi

II. First variation of functionals

Table of Common Derivatives By David Abraham

Lie symmetry and Mei conservation law of continuum system

Calculus of Variations

The Exact Form and General Integrating Factors

Exponential Tracking Control of Nonlinear Systems with Actuator Nonlinearity

The derivative of a function f(x) is another function, defined in terms of a limiting expression: f(x + δx) f(x)

Linear First-Order Equations

Math Notes on differentials, the Chain Rule, gradients, directional derivative, and normal vectors

u t v t v t c a u t b a v t u t v t b a

The total derivative. Chapter Lagrangian and Eulerian approaches

Calculus of Variations

1 Heisenberg Representation

Lectures - Week 10 Introduction to Ordinary Differential Equations (ODES) First Order Linear ODEs

Implicit Differentiation

05 The Continuum Limit and the Wave Equation

Approximate reduction of dynamic systems

θ x = f ( x,t) could be written as

WUCHEN LI AND STANLEY OSHER

APPROXIMATE SOLUTION FOR TRANSIENT HEAT TRANSFER IN STATIC TURBULENT HE II. B. Baudouy. CEA/Saclay, DSM/DAPNIA/STCM Gif-sur-Yvette Cedex, France

Chapter 6: Energy-Momentum Tensors

Computing Exact Confidence Coefficients of Simultaneous Confidence Intervals for Multinomial Proportions and their Functions

Assignment 1. g i (x 1,..., x n ) dx i = 0. i=1

Adjoint Transient Sensitivity Analysis in Circuit Simulation

Examining Geometric Integration for Propagating Orbit Trajectories with Non-Conservative Forcing

The Ehrenfest Theorems

Multi-agent Systems Reaching Optimal Consensus with Time-varying Communication Graphs

Optimized Schwarz Methods with the Yin-Yang Grid for Shallow Water Equations

Euler equations for multiple integrals

Survey Sampling. 1 Design-based Inference. Kosuke Imai Department of Politics, Princeton University. February 19, 2013

Calculus and optimization

Optimal Control of Spatially Distributed Systems

Physics 505 Electricity and Magnetism Fall 2003 Prof. G. Raithel. Problem Set 3. 2 (x x ) 2 + (y y ) 2 + (z + z ) 2

Energy behaviour of the Boris method for charged-particle dynamics

Perturbation Analysis and Optimization of Stochastic Flow Networks

The Principle of Least Action

Chapter 2 Lagrangian Modeling

JUST THE MATHS UNIT NUMBER DIFFERENTIATION 2 (Rates of change) A.J.Hobson

DISCRETE MECHANICS AND OPTIMAL CONTROL: AN ANALYSIS

4. Important theorems in quantum mechanics

A Note on Exact Solutions to Linear Differential Equations by the Matrix Exponential

Math 342 Partial Differential Equations «Viktor Grigoryan

Further Differentiation and Applications

Quantum Mechanics in Three Dimensions

inflow outflow Part I. Regular tasks for MAE598/494 Task 1

Free rotation of a rigid body 1 D. E. Soper 2 University of Oregon Physics 611, Theoretical Mechanics 5 November 2012

Optimization of a point-mass walking model using direct collocation and sequential quadratic programming

Fractional Geometric Calculus: Toward A Unified Mathematical Language for Physics and Engineering

Separation of Variables

Markov Chains in Continuous Time

On Characterizing the Delay-Performance of Wireless Scheduling Algorithms

Least-Squares Regression on Sparse Spaces

Sturm-Liouville Theory

LATTICE-BASED D-OPTIMUM DESIGN FOR FOURIER REGRESSION

Power Generation and Distribution via Distributed Coordination Control

Approximate Reduction of Dynamical Systems

ON THE OPTIMALITY SYSTEM FOR A 1 D EULER FLOW PROBLEM

Stable and compact finite difference schemes

arxiv: v1 [math.oc] 5 Oct 2016

Harmonic Modelling of Thyristor Bridges using a Simplified Time Domain Method

Systems & Control Letters

Lower Bounds for the Smoothed Number of Pareto optimal Solutions

CONSERVATION PROPERTIES OF SMOOTHED PARTICLE HYDRODYNAMICS APPLIED TO THE SHALLOW WATER EQUATIONS

Dissipative numerical methods for the Hunter-Saxton equation

d dx But have you ever seen a derivation of these results? We ll prove the first result below. cos h 1

ECE 422 Power System Operations & Planning 7 Transient Stability

Distribution Theory for Discontinuous Test Functions and Differential Operators with Generalized Coefficients

Optimal Control of Spatially Distributed Systems

Nonlinear Adaptive Ship Course Tracking Control Based on Backstepping and Nussbaum Gain

NON-SMOOTH DYNAMICS USING DIFFERENTIAL-ALGEBRAIC EQUATIONS PERSPECTIVE: MODELING AND NUMERICAL SOLUTIONS. A Thesis PRIYANKA GOTIKA

TRAJECTORY TRACKING FOR FULLY ACTUATED MECHANICAL SYSTEMS

Generalization of the persistent random walk to dimensions greater than 1

Hyperbolic Moment Equations Using Quadrature-Based Projection Methods

SYMMETRIC KRONECKER PRODUCTS AND SEMICLASSICAL WAVE PACKETS

Lagrangian and Hamiltonian Dynamics

IPA Derivatives for Make-to-Stock Production-Inventory Systems With Backorders Under the (R,r) Policy

Time-of-Arrival Estimation in Non-Line-Of-Sight Environments

Minimum-time constrained velocity planning

Discrete Hamilton Jacobi Theory and Discrete Optimal Control

Thermal conductivity of graded composites: Numerical simulations and an effective medium approximation

Lecture XII. where Φ is called the potential function. Let us introduce spherical coordinates defined through the relations

ANALYSIS OF A GENERAL FAMILY OF REGULARIZED NAVIER-STOKES AND MHD MODELS

Introduction to variational calculus: Lecture notes 1

Adaptive Gain-Scheduled H Control of Linear Parameter-Varying Systems with Time-Delayed Elements

TMA 4195 Matematisk modellering Exam Tuesday December 16, :00 13:00 Problems and solution with additional comments

A Path Planning Method Using Cubic Spiral with Curvature Constraint

Implicit Lyapunov control of closed quantum systems

OPTIMAL CONTROL OF A PRODUCTION SYSTEM WITH INVENTORY-LEVEL-DEPENDENT DEMAND

Tutorial Test 5 2D welding robot

A Novel Decoupled Iterative Method for Deep-Submicron MOSFET RF Circuit Simulation

Designing Information Devices and Systems II Fall 2017 Note Theorem: Existence and Uniqueness of Solutions to Differential Equations

Conservation Laws. Chapter Conservation of Energy

Centrum voor Wiskunde en Informatica

Closed and Open Loop Optimal Control of Buffer and Energy of a Wireless Device

Transcription:

Switching Time Optimization in Discretize Hybri Dynamical Systems Kathrin Flaßkamp, To Murphey, an Sina Ober-Blöbaum Abstract Switching time optimization (STO) arises in systems that have a finite set of control moes, where a particular moe can be chosen to govern the system evolution at any given time. The STO problem has been extensively stuie for switche systems that consists of time continuous orinary ifferential equations with switching laws. However, it is rare that an STO problem can be solve analytically, leaing to the use of numerical approximation using time iscretize approximations of trajectories. Unlike the smooth optimal control problem, where ifferentiability of the iscrete time control problem is inherite from the continuous time problem, in this contribution we show that the STO problem will in general be nonifferentiable in iscrete time. Nevertheless, at times when it is ifferentiable the erivative can be compute using ajoint equations an when it is nonifferentiable the left an right erivatives can be compute using the same ajoint equation. We illustrate the results by a hybri moel of a ouble penulum. I. INTRODUCTION Physical processes as well as the ynamic behavior of technical systems are typically moele by systems of continuous time ifferential equations. However, for an appropriate escription of complex behavior an interactions, iscrete effects have to be aitionally accounte for. Hybri systems provie a general framework to escribe the interaction of continuous ynamics with iscrete events. A great interest lies in the optimal control of hybri systems since this inclues not only the computation of optimal control trajectories for the continuous parts but also an optimization of the iscrete variables. In this contribution, we focus on the switching time optimization (STO) of switche ynamical systems. That means, the time points, when the system instantaneously switches between ifferent continuous subsystems uring an evaluation are treate as esign parameters that can be optimize w.r.t. a cost function. The STO problem has been extensively stuie for switche systems that consists of time continuous orinary ifferential equations with switching laws, e.g. in [1], [], [3], [4], [5], [6], [7], [8] which we iscuss in more etail in Section II. a) Problem setting: For simplicity, we consier a switche ynamical system on state space X R n that is escribe by only two ifferent vector fiels, f 1 an f This contribution was partly evelope an publishe in the course of the Collaborative Research Centre 614 Self-Optimizing Concepts an Structures in Mechanical Engineering fune by the German Research Founation (DFG) uner grant number SFB 614. K. Flaßkamp an S. Ober-Blöbaum are with the Department of Mathematics, University of Paerborn, Warburger Str. 1, 3398 Paerborn, Germany kathrinf, sinaob}@math.upb.e T. Murphey is with the Mechanical Engineering Department, Northwestern University, 145 Sherian R., Evanston, IL 68, Unite States t-murphey@northwestern.eu (autonomous an continuously ifferentiable in x X ). We aim to stuy the effects of one single switch at time, i.e. f1 (x(t)) t < ẋ(t) = (1) f (x(t)) t starting our observation at time t = at the initial state x() = x ini. (An extension to more than one switching times an several vector fiels is straight forwar though.) Then a switching time optimization problem is state as follows Problem 1.1: Let X R n be a state space with x ini X. Let T, R with T, f 1, f C 1 an l C 1 (continuously ifferentiable). We consier the following problem T min J() = l(x(t), t) t () f1 (x(t)) t < w.r.t. ẋ(t) = x() = x f (x(t)) t ini. A necessary conition for being the optimal switching time is J () = J() =. Commonly, escent techniques are employe that are base on the erivative of J (cf. Section II for a formula to calculate J ()). b) Discretization: In most cases, it is not possible to solve Problem 1.1 analytically. Therefore, numerical methos for integration an optimization have to be applie in orer to approximate an optimal solution. They are base on a iscretization of Problem 1.1. Euler integration is a common numerical integration scheme for ifferential equations, while an integral cost function can be approximate e.g. by the trapezoial rule. To iscretize (1), we choose a iscrete time gri t k } N = t, t 1,..., t N } (not necessarily equiistant) with t =, t N = T. A iscretize version of Problem 1.1 is given by Problem 1.: Let t k } N = t, t 1,..., t N } be a iscrete time gri with t =, t N = T an [t i, t i+1 ] for some i,..., N}. Let X R n be a state space with x ini X, f 1, f C 1 an l C 1. Then we consier the following problem T min J () = Ψ(x k ) l(x(t), t) t (3) w.r.t. K ( t k } N,, x k} ) N =, with K being a system of algebraic equations resulting from the iscretization of (1). The iscretize trajectory x k } N is an approximation of the exact solution, i.e. x k x(t k ). For the minimization of J () by escent irections, the erivative is require. If it exists, it is given by J () := J () = DΨ(x k ) x k. (4)

In the following, we will show that J is in general nonifferentiable. Nevertheless, at time points when x k oes exist, we give explicit formulas for it. Unlike the smooth continuous case, nonifferentiable points occur when, which is still allowe to vary continuously, coincies with a iscrete time point. Analogously to the continuous setting, J () can be evaluate by iscrete ajoints, that originate from the necessary optimality conitions of an optimal control problem (cf. Section IV). We exten the iscretization scheme for state-ajoint-equations, as e.g. given in [9] to the hybri case. In our analysis an by illustrating numerical tests we show that the nonifferentiability is less severe for a refine time gri an vanishes when the step size goes to zero. However, our focus oes not lie on time gri refinement but on ealing aequately with relatively large step sizes even for highly nonlinear problems typically arising in mechanics. In the research fiel of iscrete mechanics, a great interest lies in structure preserving methos for simulation an optimization [1], [11]. Here, structure preservation an a goo longtime energy preservation is not primarily achieve by reucing the time steps, but by fining a iscretization that inherits the properties of the continuous time solution. Thus, optimization techniques that allow large step sizes are also of great interest for hybri mechanical systems.while this is still future work, our contribution provies first ieas how to aress this challenge. To emphasize the relevance of our research, we introuce the example of a ouble spherical penulum that switches between a locke an an unlocke moe. Example 1.1 (Hybri locke ouble penulum): Postponing all technical etails to Section V, the optimization problem for the hybri ouble penulum is to approach a given final position. The numerical example is esigne such that this requires one single switch from the locke to the unlocke moe with an optimal switching time =.33. In Fig. 1 the cost function evaluation is given, which is obviously continuous w.r.t.. Approximating the erivative DJ() = J() (cf. (4) an Sections III IV for the corresponing formulas) reveals nonifferentiable points, i.e. jumps in the evaluation. They coincie with the gri points of the iscretize time interval an o not epen on the specifically chosen iscretization scheme for the trajectory, as we will see later. The nonifferentiable points generally lea to problems in graient base STO techniques. One can observe in Fig. 1 that the iscretize objective function in this example is still convex which leas to a uniquely efine though. However, for general applications, our analysis shows that nonifferentiability has to be accounte for, e.g. by proviing subgraients at those points. c) Outline: The remainer of this contribution is organize as follows: in Section II main results in STO for continuous time ynamics are recalle. In Section III, we stuy iscretize STO problems an present general explicit an implicit integration schemes for hybri ynamics. In Section IV corresponing iscrete ajoint equations are introuce. We illustrate our results by the example of a l m m 1 ϕ θ(locking) l 1 ϕ 1 y x J().1.1.8.6.4..3.3.34.36.38 DJ().5.4.3..1.1..3.3.3.34.36.38 Fig. 1. Left: Sketch of the locke ouble penulum: in moe 1, the outer penulum is locke w.r.t. the inner penulum with angle θ. In moe, the system is a normal planar ouble penulum. Right: Cost function evaluations an its erivative for a switche trajectory of the penulum: while J is continuous w.r.t. switching time, nonifferentiable points occur when coincies with a noe of the iscrete time gri (re ots). This is cause by the approx. trajectory, which is nonifferentiable w.r.t. at those points. locke ouble penulum in Section V an conclue with an outlook to future work in Section VI. II. STO FOR CONTINUOUS PROBLEMS Derivatives of the cost function w.r.t. switching times in a continuous setting have been stuie in several works. We recall from [1]: Lemma.1: Let f 1, f an l from Problem 1.1 be continuously ifferentiable. Define the costate by ( ) T ( ) T f l ρ(t) = x (x(t)) ρ(t) x (x(t)) (5) ρ(t ) =. Then, J () has the following form, J () = ρ() T [f 1 (x()) f (x())]. (6) The result is extene to several switching times an vector fiels in [1] an to secon orer erivatives in [7]. Later we will see that the case, when switching times coincie, are of special importance to us when ealing with iscrete approximations of the system ynamics. Further, the iscrete analog of x(t) is require for the erivative of the cost function (cf. (4)). In the continuous setting of Lemma.1, it is given for t (, T ) by (cf. [1]) x(t) = Φ(t, )(f 1 (x()) f (x())), (7) with Φ(t, ) being the state transition matrix of the autonomous linear system ż = f(x(t)) x z (cf. [7]). III. DISCRETIZED STO PROBLEMS In the following, we consier iscretize problems such as Problem 1. for explicit an implicit one-step integration schemes.

f 1 f t t 1... t i t i+1... t N x x 1... x i x x i+1... x N ρ ρ 1... ρ i ρ ρ i+1... ρ N Fig.. Notation for iscretization as use in the explicit an implicit integration schemes an for the efinition of iscrete ajoints. A. Explicit One-step Integration Schemes Problem 3.1 (STO with explicit scheme): Base on the setting in Problem 1., we consier the problem min J = Ψ(x k ) w.r.t. x k+1 F 1 (x k, t k, t k+1 ) = k =,..., i 1, x F 1 (x i, t i, ) = an F = x i+1 F (x,, t i+1 ) = for k = i, x k+1 F (x k, t k, t k+1 ) = k = i + 1,..., N 1. (8) F 1 an F enote the schemes for the ifferent vector fiels f 1 an f that switch at (cf. Fig. ). Thus, it hols [t i, t i+1 ] for some i,..., N}. It can be seen that x k } N is continuous w.r.t.. For the erivative of x k} N w.r.t., the following hols x k+1 = for k =,..., i 1, D 1 F (x,, t i+1 ) D 3 F 1 (x i, t i, ) + D F (x,, t i+1 ) for k = i, D 1 F (x k, t k, t k+1 ) x k for k = i + 1,..., N 1. (9) Here, we use the slot erivative notation, i.e. D 1 F (,, ) is the partial erivative of F w.r.t. its first argument, D F (,, ) is the erivative w.r.t. the argument in the secon slot an so forth. For (t i, t i+1 ), x k+1 for k =,..., N 1 is continuous, if F 1 an F are continuously ifferentiable, which is a reasonable requirement on an explicit integration scheme. Now the case when coincies with a gri point, say t i+1 is stuie. Therefore, we look at the left an right limits: while lim ti+1 x i+1 =, >t i+1 because switching happens afterwars, in general, lim t i+1 <t i+1 x i+1 = lim t i+1 <t i+1 D 1 F (x,, t i+1 ) D 3 F 1 (x i, t i, ) + D F (x,, t i+1 ) (1) an thus, x i+1 is nonifferentiable for = t i+1. Although (1) has to be checke for each integration scheme an each system iniviually, most likely the nonifferentiability of x k, (k = i+1,..., N) at time points is existent for a system with arbitrary switching vector fiels. As we saw in (4), x k is part of the iscrete cost function erivative an thus, nonifferentiability of the iscrete trajectory generally leas to nonifferentiability of J. The iterative relation of the erivatives at neighboring trajectory points gives rise to a transition operator Φ(k + 1, k) := D 1 F (x k, t k, t k+1 ) (11) for k i + 1,..., N 1}. Further, we efine Φ(k, k) := 1 an for l > k +1 Φ(l, k) := Φ(l, l 1)... Φ(k +, k +1) Φ(k + 1, k). Thus, for k i + 1,..., N 1} one receives the propagation scheme x k+1 = Φ(k + 1, i + 1) x i+1. Example 3.1 (Explicit Euler): Now we investigate one specific integration scheme, i.e. an explicit Euler approximation to illustrate the general result of the nonifferentiability of x k w.r.t. as state above. The explicit Euler scheme for a switche system is efine for k,..., N 1} as F j (x k, t k, t k+1 ) = x k + (t k+1 t k ) f j (x k ), j = 1, } an on the switching interval with x an in the appropriate arguments. Thus, by using the partial erivatives D 3 F 1 (x k, t k, t k+1 ) = f 1 (x k ), D 1 F (x k, t k, t k+1 ) = 1 + x f (x k )(t k+1 t k ) an D F (x k, t k, t k+1 ) = f (x k ), we verifiy that x i+1 = f 1 (x i ) + x f (x ) (t i+1 ) f 1 (x i ) f (x ) with x = x i + f 1 (x i ) ( t i ). The left han sie limit for = t i+1 is lim t i+1 <t i+1 x i+1 = f 1 (x i ) f (x i+1 ). In general, f 1 (x i ) an f (x i+1 ) will not coincie. Then x k } N is nonifferentiable at = t i+1. For t = t i+1 t i, it hols x = x i = x i+1 an thus, the result matches the continuous case (cf. (7)). For the next noe, x i+ we get the following erivative an limits x i+ = Φ(i +, i + 1) x i+1 = (1 + (t i+ t i+1 ) x f (x i+1 )) x i+1, an hence lim ti+1 x i+ = ( <t i+1 1 + (ti+ t i+1 ) x f (x i+1 ) ) (f 1 (x i ) f (x i+1 )), but x i+ = ( 1 + (t i+ t i+1 ) x f (x i+1 ) ) lim ti+1 >t i+1 f 1 (x i+1 ) f (x i+ ), where the secon limit is receive by the secon case of (8) for an inex shifte by one. Again, only for vanishing time steps these limits will coincie. Remark 3.1: To sum up, x k } N generate by an arbitrary one-step explicit integration scheme is not guarantee to be ifferentiable for t,..., t N }, but everywhere else. This is consistent with the continuous setting escribe in Section II, because we can also interpret the approximate trajectory, e.g. from an explicit Euler scheme as a piecewise linear function given by x k + f 1 (x k )(t t k ) if k < i, an t k t t k+1, x x(t) = i + f 1 (x i )(t t i ) if k = i an t i t, x + f (x )(t ) if k = i an t t i+1, x k + f (x k )(t t k ) if k > i an t k t t k+1.

This can be seen as the hybri trajectory of a switche linear system with switching points t,..., t N an. For isjoint switching points, the theory presente in Section II can be applie. However, if two switching points coincie, i.e. = t i+1 for some i as stuie above, x is not ifferentiable there. This is in corresponence with [3], in which the nonexistence of a graient in case of coinciing switching points is shown. B. Implicit One-step Integration Schemes When using an implicit integration scheme instea of an explicit, (8) of Problem 3.1 is replace by G = G 1 (x k, x k+1, t k, t k+1 ) = for k =,..., i 1, G 1 (x k, x, t k, ) = an G (x, x k+1,, t k+1 ) = for k = i, G (x k, x k+1, t k, t k+1 ) = for k = i + 1,..., N 1. (1) By computations similar to those in Section III-A, we erive for (t i, t i+1 ) x i+1 = D G (x, x i+1,, t i+1 ) 1 (D 1 G (x, x i+1,, t i+1 ) x + D 3 G (x, x i+1,, t i+1 )) with x = D G 1 (x i, x, t i, ) 1 D 4 G 1 (x i, x, t i, ). Defining the iscrete transition operator as Φ(k + 1, k) := D G (x k, x k+1, t k, t k+1 ) 1 D 1 G (x k, x k+1, t k, t k+1 ) for k i + 1,..., N 1}, the propagation rule can be again written as x k+1 = Φ(k + 1, i + 1) x i+1 for k = i + 1,..., N 1. In this section, we showe that the STO problem in iscrete time is in general not ifferentiable everywhere. The points at which the objective function is generally nonsmooth are the time gri points. However, in between neighboring time points, the iscrete objective function inherits the smoothness of the corresponing continuous problem. Therefore, the erivative of the cost function can be compute using iscrete ajoint equations analogously to the continuous case. At nonifferentiable points the left an right erivatives can be compute using the same ajoint equation, as we will show in the following section. IV. DISCRETE ADJOINTS Optimal solutions of continuous optimal control problems (uner appropriate regularity assumptions) satisfy first-orer optimality conitions, the well known minimum principle (see e.g. [9]). A iscretization leas to a nonlinear constraint optimization problem, where the constraint on (t i, t i+1 ) is epenent on. Here, necessary optimality conitions are calle Kuhn-Tucker equations an give rise to iscrete ajoint multipliers (cf. [9]). The optimality conitions can be either formulate in terms of a Hamiltonian or a Lagrangian function, we choose the latter for our problem settings. The aim is to compute J () in terms of the iscrete ajoints (cf. (6) for the time continuous case). A. Discrete Ajoints for Explicit Schemes Definition 4.1 (Discrete Lagrangian): The iscrete Lagrangian of Problem 3.1 is given by L (x k } N, ρ} N,, x, ρ ) i 1 = Ψ k (x k ) ρ k+1 (x k+1 F 1 (x k, t k, t k+1 )) ρ (x x ini ) ρ (x F 1 (x i, t i, )) ρ i+1 (x i+1 F (x,, t i+1 )) N 1 k=i+1 ρ k+1 (x k+1 F (x k, t k, t k+1 )) with the iscrete ajoints ρ} N an ρ (cf. Fig. ). Note that the iscrete ajoints are treate as row vectors in contrast to the continuous formulation in Section II. Theorem 4.1 (Discrete ajoints for explicit schemes): The backwars ifference equations efining the iscrete ajoints for an explicit integration scheme analogously to the continuous case (cf. Section II) are given by ρ N = DΨ N (x N ) ρ k = DΨ k (x k ) + ρ k+1 D 1 F (x k, t k, t k+1 ) for k = N 1,..., i +, ρ i+1 = DΨ i+1 (x i+1 ) + ρ i+ D 1 F (x i+1, t i+1, t i+ ) ρ = ρ i+1 D 1 F (x,, t i+1 ) ρ i = DΨ i (x i ) + ρ D 1 F 1 (x i, t i, ) ρ k = DΨ k (x k ) + ρ k+1 D 1 F 1 (x k, t k, t k+1 ) for k = i 1,...,. Proof: Taking variations w.r.t. x k, ρ k, x, ρ an leas to the necessary optimality conitions, i.e. the iscrete equations of motions, the bounary conition x = x() = x ini an also the iscrete ajoint equations as given above. It further hols ρ D 3 F 1 (x i, t i, )+ρ i+1 D F (x,, t i+1 ) = which efines. These aoint equations are consistent with the system given in [9]. Using the operator Φ(k + 1, k) from (11), the ifference equation can be written as ρ k = DΨ k (x k ) + ρ k+1 Φ(k + 1, k) for k = N,..., i+1, with bounary value ρ N = DΨ N (x N ), or alternatively, ρ k = N j=k DΨ j(x j ) Φ(j, k), where ρ i+1 is the last ajoint before switching (looking backwars in time). Thus, the ajoints are continuous w.r.t., if the DΨ k an the transition operator are continuous, which is reasonable to assume. This provies an elegant way to write the iscrete cost function erivative (cf. (4)) J () = = k=i+1 DΨ k (x k ) x k DΨ k (x k ) Φ(k, i + 1) x i+1 = ρ i+1 x i+1.

So it can be nicely seen that although the ajoint itself is continuous, its argument, i.e. x i+1 leas to nonifferentiability of J. In fact, if = t i for i =,..., N, x i+1 an therefore J can only be efine by either the left or the right limit as efine in (1). Example 4.1 (Ajoints for explicit Euler): For a specific integration scheme, the formula for the iscrete ajoints can be explicitly compute an analyze. Here, we consier again the explicit Euler as an example. Recall that in the explicit Euler scheme (cf. Example 3.1), it hols Φ(k + 1, k) = D 1 F (x k, t k, t k+1 ) = 1 + (t k+1 t k ) x f (x k ) for k = i + 1,..., N 1 with f the active vector fiel after switch. If we plug this in the ajoint equation, we get ( ρ k = DΨ k (x k ) + ρ k+1 1 + (t k+1 t k ) ) x f (x k ) ( ) DΨk (x k ) = ρ k+1 + + ρ k+1 t k+1 t k x f (x k ) (t k+1 t k ). (13) For choosing Ψ(x k ) = (t k+1 t k ) l(x k ), (13) is a irect iscretization of the continuous formulation in (5). The resulting ajoint scheme itself is explicit, since we are going backwars in time. However, because the computation of ρ k explicitly epens on x k, the iscrete scheme for the system of equations consisting of (1) an (5) is a symplectic or semi implicit Euler scheme (cf. [9], where general Runge-Kutta, but non-hybri schemes are stuie). Example 4. (Switche linear system): We compare the analytic solutions of the commonly use continuous setting to the results we receive for the iscrete time setting. Therefore, consier the following simple one-imensional linear switche system x t ẋ = x t > with linear vector fiels f 1 (x) = x, f = x, x() = 1 an switching time. The corresponing flow, i.e. the solution of the switche ifferential equation is hence given by x exp(t) t x(t, ) = x() exp((t )) t >. The cost function to be minimize is chosen to be J() = T x (t, ) t an epens on through the hybri trajectory x(t, ). The erivative of x(t, ) w.r.t. equals x(t) = x exp(t ) for t with f 1 (x()) f (x()) = x exp() an Φ(t, ) = exp((t )) (cf. Section II). Further, the analytic solution of the ajoint equation is given by ρ(t) = 1 x() exp(t ) + 1 x() exp(4t t). Thus, J () can be exactly etermine by equation (6). In general applications, analytical solutions cannot be foun an one therefore has to approximate x(t, ) as well as ρ(t) an also the evaluation of the cost function integral. For this example, we approximate x(t, ) by an explicit Euler scheme with x = x() an for k = 1,..., N Fig. 3. Left: The erivative of the approximate trajectory x k (black) on the iscrete time gri t k } N with t k = k. an (, ) approximates the analytically compute exact solution (gray). Non-ifferentiable points occur when t,..., t N }. Right: The corresponing iscrete ajoints (black) are continuous w.r.t. an they approximate the ajoints (gray) from the analytic solution of the continuous problem. Fig. 4. Left: The iscrete cost function erivative (black) shows nonifferentiability at iscrete time points. The ashe lines illustrate the iscrete time gri (same as in Fig. 3, t =.). Right: Reucing the gri with to t k = k.4, the jumps at the nonifferentiable points of the iscrete erivative J () = J get smaller an the iscrete erivative approaches the continuous solution. x k + f 1 (x k )(t k+1 t k ) if k + 1 < i x i + f 1 (x i )( t i ) x k+1 = +(t i+1 ) f (x ) if k = i, x k + f (x k )(t k+1 t k ) if k + 1 > i, with the approximate switching state x = x i + f 1 (x i )( t i ) an the switching interval [t i, t i+1 ] as epicte in Fig.. The trapezoial rule for a quarature of the cost function is chosen, i.e. J() N Ψ(x k) = N 1 k=1 l(x k) tk+1 t k 1 + l(x ) t1 t + l(x N ) tn t N 1 (cf. (3)). In Fig. 3 (left) we compare x k} N to the exact values of x(t) evaluate on t k} N. It can be observe that the erivative of the approximation is not well efine if = t k for k 1,..., N 1} (time gri marke as ashe lines) since left an right han sie limits are not equal (cf. Section III-A). The iscrete ajoints (see Fig. 3 (right), cf. Section IV for their efinition) are continuous w.r.t.. Thus, since J () = N DΨ(x k) x k (cf. (4)), J () is nonifferentiable for t k } N (cf. Fig. 4) as the results of Section III state. However, this nonifferentiability vanishes when the gri with tens to zero, as Fig. 4 (right) illustrates. Here, the step size is reuce from t =. to t =.4.

B. Discrete Ajoints for Implicit Schemes For an implicit integration scheme as in (1), a Lagrangian can be efine an ajoints can be erive analogously to the explicit scheme (etails have to be postpone to a future publication). Although the ajoints are continuous uner x i+1 normal smoothness conitions, (cf. Section III-B) may generally be not well efine on time gri points, as in explicit schemes. Thus, for the cost function erivative the same problem of nonifferentiability occurs. V. NUMERICAL EXAMPLE: THE HYBRID LOCKED DOUBLE PENDULUM As an illustrating example for nonifferentiable points of a cost function for iscretize switche systems, we consier the ouble penulum. The moel consists of two mass points m 1, m on massless ros of length l 1, l. The motion of the penula are escribe by two angles, ϕ 1 an ϕ (cf. Fig. 1). The stanar ouble penulum is turne into a hybri system by introucing two ifferent moes: M1: The outer penulum is locke w.r.t. the inner penulum with angle θ, i.e. the system behaves like a single penulum with a special inertia tensor. M: Both penula can move freely as in the stanar case. In M1, the following energy terms are vali K 1(ϕ 1, ϕ 1) = 1 (m1l 1 + m r ) ϕ 1 V 1(ϕ 1) = (m 1 + m )gl 1 cos(ϕ 1) + m gl cos(ϕ 1 + θ π) with istance of outer mass to origin r = l1 + l l 1 l cos(θ). The position of the outer mass can be upate accoring to ϕ = ϕ 1 + θ π an it naturally follows that ϕ 1 = ϕ. In M, the system is efine by K (ϕ 1, ϕ, ϕ 1, ϕ ) = 1 «T ϕ1 ϕ ««(m 1 + m )l1 m l 1l cos(ϕ 1 ϕ ) ϕ1 m l 1l cos(ϕ 1 ϕ ) m l ϕ V (ϕ 1, ϕ ) = m 1gl 1 cos(ϕ 1) + m g(l 1 cos(ϕ 1) + l cos(ϕ )). In both cases, the equations of motion are erive by the Euler-Lagrange equations L i t q Li q = for L i (q, q) = K i (q, q) V i (q, q) (i = 1, ) with q = (ϕ 1, ϕ ) being the configurations an q = ( ϕ 1, ϕ ) the corresponing velocities. We focus on the scenario, when the system switches a single time from M1 to M. One can check that the energies of M1 an M coincies in a switching point x = (ϕ 1, ϕ 1 + θ π, ϕ 1, ϕ 1 ) an thus we will have energy conservation along the entire hybri trajectory. We assume that the velocities irectly before an after the switch are the same, i.e. ϕ 1 = ϕ + 1 = ϕ +. As a cost function we ( ) choose J() = Ψ(x(T )) = ϕ1 q ϕ final to minimize the istance to a given final point. This is an algebraic cost function as consiere in Problem 1.. The final point q final = ( 1.5487, 1.9733) is chosen such that the optimal value is =.33. We approximate the switching time erivative J () by evaluating the corresponing formula for x i+1 an the appropriate iscrete ajoints. In Fig. 1 (right) the nonifferentiable points of J (), i.e. points in which the left han right han sie erivatives o not coincie, can be clearly seen. VI. CONCLUSION AND FUTURE WORK In this contribution, we show that in contrast to time continuous STO, in iscretize problems the ifferentiability of a cost function w.r.t. the switching time is not guarantee if the switching time matches gri points of the time gri. Consequently, smaller time steps actually make the neighborhoo in which a smooth optimality conition may be use smaller. This inicates the nee for application of optimality conitions appropriate for nonsmooth systems. So far, we restrict our numerical test to implicit an explicit Euler methos. Thus it is straight forwar to exten to other integration methos, e.g. multi step methos, higher orer Runge Kutta schemes or geometric integrators. The latter are of special importance for structure preserving integration, e.g. energy or momentum preservation in mechanical systems (cf. [1]). Therefore, our future work will focus on STO of iscrete hybri mechanics (cf. [1] for a iscrete variational moeling of hybri mechanical systems). From a numerical point of view, the information of nonifferentiable points shoul be use to improve STO algorithms by proviing e.g. subgraients in those cases. Applications to more complex examples will then be of great interest. REFERENCES [1] M. Egerstet, Y. Wari, an F. Delmotte, Optimal control of switching times in switche ynamical systems, in IEEE Conference on Decision an Control, 3, pp. 138 143. [] M. Alamir an S. A. Attia, On solving optimal control problems for switche hybri nonlinear systems by strong variations algorithms, in Proceeings of 6th IFAC Symposium on Nonlinear Control Systems, 4, pp. 558 563. [3] M. Egerstet, Y. Wari, an H. Axelsson, Transition-time optimization for switche-moe ynamical systems, IEEE Transactions on Automatic Control, vol. 51, no. 1, pp. 11 115, 6. [4] A. Schil, X. C. Ding, M. Egerstet, an J. Lunze, Design of optimal switching surfaces for switche autonomous systems, in IEEE Conference on Decision an Control, 9, pp. 593 598. [5] X. Xu an P. Antsaklis, Optimal control of switche autonomous systems, in IEEE Conference on Decision an Control,, pp. 441 446. [6], Optimal control of switche systems base on parameterization of the switching instants, IEEE Transactions on Automatic Control, vol. 49, no. 1, pp. 16, 4. [7] T. Calwell an T. Murphey, Switching moe generation an optimal estimation with application to ski-steering, Automatica, vol. 47, no. 1, pp. 5 64, 11. [8] E. Johnson an T. Murphey, Secon-orer switching time optimization for nonlinear time-varying ynamic systems, IEEE Transactions on Automatic Control, vol. 56, no. 8, pp. 1953 1957, 11. [9] W. W. Hager, Runge-Kutta methos in optimal control an the transforme ajoint system, Numerische Mathematik, vol. 87, pp. 47 8, 1999. [1] J. E. Marsen an M. West, Discrete mechanics an variational integrators, Acta Numerica, vol. 1, pp. 357 514, 1. [11] S. Ober-Blöbaum, O. Junge, an J. E. Marsen, Discrete mechanics an optimal control: an analysis, Control, Optimisation an Calculus of Variations, vol. 17, no., pp. 3 35, 11. [1] K. Flaßkamp an S. Ober-Blöbaum, Variational formulation an optimal control of hybri Lagrangian systems, in Proceeings of the 14th International Conference on Hybri Systems: Computation an Control, 11, pp. 41 5.