enclosing temporal evolution of dynamical systems us ......enclosing temporal evolution of dynamical...
TRANSCRIPT
Enclosing Temporal Evolution of Dynamical Systems Us-ing Numerical Methods.
Olivier Bouissou (CEA LIST)Alexandre Chapoutot and Adel Djoudi (ENSTA Paristech)
NFM 2013May 14-16, 2013
Problem motivationHybrid systems verification
I We consider Hybrid Systems given as a state space system:
x = fx(t, x) Problem dynamic
x = fz(t, x) when z(t, x) Reset function
I Note that fx is not necessarily continuous but piecewise continuous.
I We want to compute bounds on the system trajectory, i.e. a piecewisecontinuous function x∞ such that:
∀t ∈ R+, x ′∞(t) = fx(t, x∞(t)) and x+∞(t) = fz(t, x−∞(t)) if z(t, x−∞(t)) .
with x ′ the right-derivative, x+ the right-limit and x− the left-limit.
I Two main issues:1.2. detecting and solving the discrete jumps
2 / 27NFM 2013, May 14-16, 2013
Problem motivationHybrid systems verification
I We consider Hybrid Systems given as a state space system:
x = fx(t, x) Problem dynamic
x = fz(t, x) when z(t, x) Reset function
I Note that fx is not necessarily continuous but piecewise continuous.
I We want to compute bounds on the system trajectory, i.e. a piecewisecontinuous function x∞ such that:
∀t ∈ R+, x ′∞(t) = fx(t, x∞(t)) and x+∞(t) = fz(t, x−∞(t)) if z(t, x−∞(t)) .
with x ′ the right-derivative, x+ the right-limit and x− the left-limit.
I Two main issues:1. solving the differential equations2. detecting and solving the discrete jumps
2 / 27NFM 2013, May 14-16, 2013
Problem motivationHybrid systems verification
I We consider Hybrid Systems given as a state space system:
x = fx(t, x) Problem dynamic
x = fz(t, x) when z(t, x) Reset function
I Note that fx is not necessarily continuous but piecewise continuous.
I We want to compute bounds on the system trajectory, i.e. a piecewisecontinuous function x∞ such that:
∀t ∈ R+, x ′∞(t) = fx(t, x∞(t)) and x+∞(t) = fz(t, x−∞(t)) if z(t, x−∞(t)) .
with x ′ the right-derivative, x+ the right-limit and x− the left-limit.
I Two main issues:1. solving the differential equations2. detecting and solving the discrete jumps
2 / 27NFM 2013, May 14-16, 2013
Problem motivationTime ellapse operator
Definition: given an ODE x = f (x), an initial state x0 ⊆ Rn and a duration h,compute the set
Rf (x0, h) ={x(t) | t ∈ [0, h], x = f (x) and x(0) ∈ x0
}I Basis for hybrid systems reachability algorithm.
I Generally not exactly computable, depending on the nature of f and therepresentation for x0:
1. if f is linear and x0 is a convex polyhedra, Rf (x0, h) can be exactlycomputed using matrix exponential.
2. if f is not linear, over-approximation must be performed.
3 / 27NFM 2013, May 14-16, 2013
Problem motivationLinear case
The problem is:
x = Ax x(0) ∈ x0
with A ∈ Rn×n and x0 ⊆ Rn.
I Can be resolved exactly.
I x(t) = x0 · eAt .I Solution from SpaceEx [Frehse et al. 2011]:
1. Get an eclosure R0 of x on [0, h] using an Euler like extrapolation.
2. Compute Ri = Ri−1 · eAh.
3. Ri is an enclosure of x on [ih, (i + 1)h].
4. Must compute the matrix exponential eAh.
4 / 27NFM 2013, May 14-16, 2013
The GRKLib method[Bouissou Martel 2007]
I More general method to compute over-approximations of Rf (x0, h).
I Depends on interval arithmetics: x0 must be given as an interval.
I Modifies the numerical method RK4 that computes approximations ofx∞(h):
k1 = f (0, x0)k2 = f
(h2, x0 + h
2k1
)k3 = f
(h2, x0 + h
2k2
)k4 = f (h, x0 + hk3)x = x0 + h
6
(k1 + 2k2 + 2k3 + k4
)
h
I Picard iteration
I Taylor expansion
5 / 27NFM 2013, May 14-16, 2013
The GRKLib method[Bouissou Martel 2007]
I More general method to compute over-approximations of Rf (x0, h).
I Depends on interval arithmetics: x0 must be given as an interval.
I Modifies the numerical method RK4 that computes approximations ofx∞(h):
k1 = f (0, x0)k2 = f
(h2, x0 + h
2k1
)k3 = f
(h2, x0 + h
2k2
)k4 = f (h, x0 + hk3)x = x0 + h
6
(k1 + 2k2 + 2k3 + k4
)
h
I Picard iteration
I Taylor expansion
5 / 27NFM 2013, May 14-16, 2013
The GRKLib method[Bouissou Martel 2007]
I More general method to compute over-approximations of Rf (x0, h).
I Depends on interval arithmetics: x0 must be given as an interval.
I Modifies the numerical method RK4 that computes approximations ofx∞(h):
k1 = f (0, x0)k2 = f
(h2, x0 + h
2k1
)k3 = f
(h2, x0 + h
2k2
)k4 = f (h, x0 + hk3)x = x0 + h
6
(k1 + 2k2 + 2k3 + k4
)
h
I Picard iteration∀t ∈ [0, h], x∞(t) ∈ R
I Taylor expansion
5 / 27NFM 2013, May 14-16, 2013
The GRKLib method[Bouissou Martel 2007]
I More general method to compute over-approximations of Rf (x0, h).
I Depends on interval arithmetics: x0 must be given as an interval.
I Modifies the numerical method RK4 that computes approximations ofx∞(h):
k1 = f (0, x0)k2 = f
(h2, x0 + h
2k1
)k3 = f
(h2, x0 + h
2k2
)k4 = f (h, x0 + hk3)x = x0 + h
6
(k1 + 2k2 + 2k3 + k4
)
h
I Picard iteration
I Taylor expansionx∞(t) ∈ x + e
5 / 27NFM 2013, May 14-16, 2013
The GRKLib methodPicard operator
I Given an interval x0 such that x(0) ∈ x0, we look for R such that∀t ∈ [0, h], x(t) ∈ R.
I Iterative algorithm:1. Set R0 = x0 t x where x is the result of RK4 method using interval
arithmetic.2. n = 03. while(true)4. Rn+1 = x0 + [0, h]f (Rn)5. if Rn+1 ⊆ Rn break;6. else n = n + 1
I This process ends if f is globally Lipschitz.
I The post fixpoint R can be used as an over-approximation of Rf (t, x0).
6 / 27NFM 2013, May 14-16, 2013
The GRKLib methodEnclosure at h
I The enclosure R obtained previously is generally too large to continue theintegration on [h, 2h].
I We use a different method to compute a tight approximation xh at h, fromwhich we start the same process to reach 2h.
I Computation of xh: xh = Φ(x0) + e where
Φ(x0, h) = x0 + h6
(k1 + 2k2 + 2k3 + k4)
e = h5
120
(dΦ5
dt5 (x0, [0, h])− df 4
dt4 ([0, h],R))
7 / 27NFM 2013, May 14-16, 2013
The GRKLib methodLimitations of GRKLib
xh = x0 +h
6(k1 + 2k2 + 2k3 + k4) +
h5
120
(dΦ5
dt5(x0, [0, h])− df 4
dt4([0, h],R)
)1. Use of interval arithmetics
I This formula makes the width of x increase.I Solution: use of interval center-ray form and computation of the Jacobian
of Φ (same as for VNODE).
I Wrapping effect that makes the error increase.
I One solution: use Lohner QR decomposition, but complexity is n3 where nis the dimension of the ODE.
8 / 27NFM 2013, May 14-16, 2013
The GRKLib methodLimitations of GRKLib
xh = x0 +h
6(k1 + 2k2 + 2k3 + k4) +
h5
120
(dΦ5
dt5(x0, [0, h])− df 4
dt4([0, h],R)
)1. Use of interval arithmetics
2. Use of only RK4 method
I There exists many other numerical methods.I In Simulink, more than 6 Runge-Kutta like methods.
I Each performs well on different problemsI See experimentations.
I We can bound the error for each method, using a method similar toGRKLib.
I More on that later.
8 / 27NFM 2013, May 14-16, 2013
Main contribution of this work
Solution to these problems1. Use of affine arithmetics.
2. Use of a generic guaranteed solver.
9 / 27NFM 2013, May 14-16, 2013
Main contribution of this work
Solution to these problems1. Use of affine arithmetics.
2. Use of a generic guaranteed solver.
10 / 27NFM 2013, May 14-16, 2013
Affine sets
I Extension of interval arithmetics to reduce the dependency issue.
[a, a] + [b, b] = [a + b, a + b]
x = [0, 1] ⇒ x − x = [−1, 1]
I Main idea: parametrize variables w.r.t. a set of noise symbols εi withεi ∈ [−1, 1].
x = x0 + x1ε1 + x3ε3
y = y0 + y1ε1 + y2ε2
I This representation encodes the linear relation between noise symbols andvariables and allows for precise linear transformation.
I What is a noise symbol ?I Initial uncertainty: [a, b]→ a+b
2+ b−a
2ε
I Non-linear operations
11 / 27NFM 2013, May 14-16, 2013
Affine setsGeometric representation
Given m variables x1, x2, . . . , xm, an affine set
x j = x j0 +
n∑i=1
x ji εi
is a zonotope Z = γ(x1, . . . , xm).
Example: x = 20− 4ε1 + 2ε3 + 3ε4 y = 10− 2ε1 + ε2 − ε4
x
y
12 / 27NFM 2013, May 14-16, 2013
Affine setsArithmetics
Given two affine sets
x = x0 +n∑
i=1
xiεi y = y0 +n∑
i=1
yiεi
I Addition, subtraction and scalar multiplication (κ ∈ R)
κ · x ± y = κ · x0 ± y0 +n∑
i=1
(κ · xi ± yi )εi
I Multiplication
x × y = x0y0 +n∑
i=1
(y0xi + x0yi )εi +n∑
i=1
xiεi
n∑i=1
yiεi
= x0y0 +n∑
i=1
(y0xi + x0yi )εi + rn+1εn+1
I Other operations (sin, cos, . . . ) are computed using Taylor series.
Remark: each non-linear operation generates a new noise symbol.
13 / 27NFM 2013, May 14-16, 2013
Main contribution of this work
Solution to these problems1. Use of affine arithmetics.
2. Use of a generic guaranteed solver.
14 / 27NFM 2013, May 14-16, 2013
Runge-Kutta numerical scheme
Any explicit Runge-Kutta method can be described by a “Butcher table”:
, e.g.ODE23 method :
d2 a21
d3 a31 a32
......
. . .
ds as1 as2 · · · as,s−1
w1 w2 · · · ws
w ′1 w ′2 · · · w ′s
For some metods, the second extrapolation zn+1 allows for an approximation ofthe integration error and thus a step-size control.
15 / 27NFM 2013, May 14-16, 2013
Runge-Kutta numerical scheme
Any explicit Runge-Kutta method can be described by a “Butcher table”, e.g.ODE23 method :
012
12
34
0 34
1 29
13
49
29
13
49
724
14
13
18
k1 = f (tn, xn)
k2 = f (tn +1
2hn, xn +
1
2hk1)
k3 = f (tn +3
4hn, xn +
3
4hk2)
xn+1 = xn + h
(2
9k1 +
1
3k2 +
4
9k3
)k4 = f (tn + 1hn, xn+1)
zn+1 = xn + h
(7
24k1 +
1
4k2 +
1
3k3 +
1
8k4
)
For some metods, the second extrapolation zn+1 allows for an approximation ofthe integration error and thus a step-size control.
15 / 27NFM 2013, May 14-16, 2013
(Non-guaranteed) Set-based integration usingaffine arithmetics
[Bouissou et al., RSP 2012]
We consider a numerical integration scheme, e.g. ODE23:
k1 = f (tn, xn) k2 = f (tn +1
2hn, xn +
1
2hk1) k3 = f (tn +
3
4hn, xn +
3
4hk2)
xn+1 = xn + h
(2
9k1 +
1
3k2 +
4
9k3
)I Write x = Φ(x0, h).
I Suppose x0 ∈ x0 where x0 is an affine set.
I Suppose we evaluate all above equations using affine arithmetics,computing an affine set x .
I Then clearly x ∈ x and x is a tight enclosure of {Φ(x0, h) | x0 ∈ x0}.
16 / 27NFM 2013, May 14-16, 2013
(Non-guaranteed) Set-based integration usingaffine arithmetics
Example: car.ode
init x = [0,1];init y = [0,1];init theta = [0,0.1];init v = 7;init delta = 0.0;
u1 = 0;u2 = 0.2;
x’ = v*cos(delta)*cos(theta);y’ = v*cos(delta)*sin(theta);theta’ = v*sin(delta)/5;v’ = u1;delta’ = u2;
17 / 27NFM 2013, May 14-16, 2013
Runge-Kutta numerical schemeComputing the error
x0
Φ(x0, h)
I How can we perturb Φ(x0, h) so that itcontains x∞(x0, h) for all x0 ∈ x0 ?
I We use the order condition ofRunge-Kutta methods.
Order condition: a method is of order p iff
∀k ∈ [1, p]dkΦ
dtk(x0, 0) =
dkx∞dtk
(0)
Example:
I Euler method is of order 1
I ODE23 method is of order 2
I RK4 method is of order 4
I ODE78 method is of order 7
18 / 27NFM 2013, May 14-16, 2013
Runge-Kutta numerical schemeComputing the error
x0
Φ(x0, h)
I How can we perturb Φ(x0, h) so that itcontains x∞(x0, h) for all x0 ∈ x0 ?
I We use the order condition ofRunge-Kutta methods.
Order condition: a method is of order p iff
∀k ∈ [1, p]dkΦ
dtk(x0, 0) =
dkx∞dtk
(0)
Consequence: the error e = x∞(x0, h)− Φ(x0, h) is
e =hp+1
(p + 1)!
(f (p) (ξ, x∞(ξ))− dp+1Φ
dtp+1(x0, η)
)with ξ, η ∈ [0, h].
18 / 27NFM 2013, May 14-16, 2013
Guaranteed integration using affine arithmeticsComputing the error
e =hp+1
(p + 1)!
(f (p) (ξ, x∞(ξ))− dp+1Φ
dtp+1(x0, η)
)We need to evaluate this.
Two steps:
1. compute the apriori enclosure R such that ∀ξ ∈ [0, h], x∞(ξ) ∈ R.
2. compute the error e.
19 / 27NFM 2013, May 14-16, 2013
Guaranteed integration using affine arithmeticsComputing the error
e =hp+1
(p + 1)!
(f (p)
([0, h], R
)− dp+1Φ
dtp+1(x0, η)
)We need to evaluate this. Two steps:
1. compute the apriori enclosure R such that ∀ξ ∈ [0, h], x∞(ξ) ∈ R.
2. compute the error e.
19 / 27NFM 2013, May 14-16, 2013
Guaranteed integration using affine arithmeticsComputing the error
e =hp+1
(p + 1)!
(f (p)
([0, h], R
)− dp+1Φ
dtp+1(x0, [0, h])
)We need to evaluate this. Two steps:
1. compute the apriori enclosure R such that ∀ξ ∈ [0, h], x∞(ξ) ∈ R.
2. compute the error e.
19 / 27NFM 2013, May 14-16, 2013
Guaranteed integration using affine arithmeticsComputing the error
e =hp+1
(p + 1)!
(f (p)
([0, h], R
)− dp+1Φ
dtp+1(x0, [0, h])
)We need to evaluate this. Two steps:
1. compute the apriori enclosure R such that ∀ξ ∈ [0, h], x∞(ξ) ∈ R.
2. compute the error e.
Step 1.
I we use again the Picard operator, except this time with affine arithmetic.
I comparison of affine form: we can use the order relation as in [Goubault,Putot, 2011].
19 / 27NFM 2013, May 14-16, 2013
Guaranteed integration using affine arithmeticsComputing the error
e =hp+1
(p + 1)!
(f (p)
([0, h], R
)− dp+1Φ
dtp+1(x0, [0, h])
)We need to evaluate this. Two steps:
1. compute the apriori enclosure R such that ∀ξ ∈ [0, h], x∞(ξ) ∈ R.
2. compute the error e.
Step 2.
I a direct evaluation of the formula in affine arithmetics gives anover-approximation of the error.
I no need to perform QR decomposition as for intervals as affine arithmeticsdoes not suffer from wrapping effect.
19 / 27NFM 2013, May 14-16, 2013
Guaranteed integration using affine arithmeticsControlling the step-size
From the Picard iteration:
I it may happen that h is too large for Picard iteration to terminate.
I after a fixed number of iterations, we reject the step-size and start againfrom h/2.
Next we can adapt the step-size to reach a user-defined tolerance.Two ways to define the error:
I from the embedded numerical scheme (ODE23 for instance);
I from the guaranteed error.
The second option is more efficient as it reduces the number of rejected Picarditeration
20 / 27NFM 2013, May 14-16, 2013
Implementation
We developped a tool named RKN:
I contains 12 methods;
I parses a simple language for defining ODEs;
I uses a formal differentiation tool to compute the derivatives.
We compared the results of RKN with VNODE:
I VNODE is the state of the art tool for guaranteed integration;
I it is based on interval arithmetics and Taylor series expansion;
I results show that RKN is more “adaptable” than VNODE.
21 / 27NFM 2013, May 14-16, 2013
Implementation issues
Problem with affine arithmetics: creation of one noise symbol per non-linearoperation.
I Even an addition creates a noise symbol when computing with floatingpoint numbers !
I Use a sparse representation for the list of noise symbols.
I Truncate the list of noise symbols by keeping only the ones bigger than auser-defined threshold.
Avoiding the creation of noise symbols:
I we compute the error term using interval arithmetics.
I we convert it to affine arithmetics and add it to the current value.
I similar to following the numerical scheme and perturbing it by intervalerror terms.
22 / 27NFM 2013, May 14-16, 2013
Experimental results1. Oil-reservoir problem
init y = 10
init z = 0
y’ = z
z’ = (z * z) - (3 / (0.001 + (y * y)))
I Non-linear ODE with a very stiff behaviour around t = 35.I Different numerical methods give very different approximations.
30 32 34 36 38 40
−5
0
5
10Euler method
Fixed step ODE23
Variable step ODE23
23 / 27NFM 2013, May 14-16, 2013
Experimental results1. Oil-reservoir problem
init y = 10
init z = 0
y’ = z
z’ = (z * z) - (3 / (0.001 + (y * y)))
I Non-linear ODE with a very stiff behaviour around t = 35.I Different numerical methods give very different approximations.
Results with RKN:
34.6 34.8 35 35.2 35.4
−20
−10
23 / 27NFM 2013, May 14-16, 2013
Experimental results1. Oil-reservoir problem
init y = 10
init z = 0
y’ = z
z’ = (z * z) - (3 / (0.001 + (y * y)))
I Non-linear ODE with a very stiff behaviour around t = 35.I Different numerical methods give very different approximations.
Results with RKN:
I using the guaranteed Heun method, we could enclose the solution.
I computation time is ∼10s.
I the step-size adaptation is necessary to reduce h when the problembecomes stiff.
I VNODE could not compute enclosures of it (problem with the Taylorseries expansion of 1/(0.001 + y 2)).
23 / 27NFM 2013, May 14-16, 2013
Experimental results2. High dimensional problems
y1
y2
y3
...yn
=
−2 1 0 0 · · · 01 −2 1 0 · · · 00 1 −2 1 · · · 0
. . .0 0 · · · 0 1 −2
y1
y2
y3
...yn
with y(0) =
100...0
.
I C3 problem from the DETEST suite.
I We study the computation time of RKN with increasing dimension.
I We use the RK4 numerical scheme and a tolerance of 10−6.
RKN VNODEDim T Prec T Prec
40 1.064 1.284 · 10−5 7.46 2.175 · 10−07
80 2.551 1.432 · 10−5 58.89 2.175 · 10−07
120 4.297 1.386 · 10−5 196.56 2.175 · 10−07
140 5.285 1.440 · 10−5 334.08 2.175 · 10−07
24 / 27NFM 2013, May 14-16, 2013
Experimental results3. Stiff problem
init y1 = 2
init y2 = 0
y1’ = y2
y2’ = 5 * (1 - (y1 * y1)) * y2 - y1
25 / 27NFM 2013, May 14-16, 2013
Experimental results3. Stiff problem
init y1 = 2
init y2 = 0
y1’ = y2
y2’ = 5 * (1 - (y1 * y1)) * y2 - y1
I We compute over-approximations of the trajectories.
I Computation time: 0.12s with ODE23
I On this example, VNODE cannot reach t = 8 with order 4, requires atleast order 8
I Computation time for VNODE, order 10: 0.08s
25 / 27NFM 2013, May 14-16, 2013
Experimental results4. Some pictures
init x = [0,1];
init theta = [0,0.1];
init y = [0,1];
init v = 7;
init delta = 0.0;
x’ = v*cos(delta)*cos(theta);
theta’ = v*sin(delta)/5;
y’ = v*cos(delta)*sin(theta);
delta’ = 0.2;
26 / 27NFM 2013, May 14-16, 2013
Experimental results4. Some pictures
init x1 = [0.8,1]
init x2 = 0
tmp = x1*x1-1
x1’ = x2
x2’ = -0.2 * tmp * x2 - x1
26 / 27NFM 2013, May 14-16, 2013
Experimental results4. Some pictures
init u = [0.95,1.05];
init v = [-1.05,-0.95];
u’ = v;
v’ = (u^2);
26 / 27NFM 2013, May 14-16, 2013
Conclusion
We presented:
I a generic framework for making explicit numerical methods guaranteedODE solvers.
I an interesting use of affine arithmetics which shows to be a good tradeoffbetween complexity and accuracy for problems with many numericalcomputations.
I our method compares very well to VNODE and scales well tohigh-dimensional problems. It even outperforms VNODE on stiff problems.
Perspectives:
I study implicit ODE solvers which are known to work better for stiffproblems.
I extend this work to handle DAEs (basic equation in Modelica) and PDEs.
27 / 27NFM 2013, May 14-16, 2013