Counter-example guided inductive synthesis of controllers

Counter-Example Guided Inductive
Synthesis Approach for Stabilization
Hadi Ravanbakhsh
Mohamed Amin Ben Sassi Sriram Sankaranarayanan
University of Colorado, Boulder
Problem
Dynamical
System
Property
ẋ = f (x)
ẋ = f (x, u)
Stability
Abstraction Vs Constraint based
Approaches
Abstraction-Based
•
•
•
•
•
Concrete
System
Controller
(concrete)
Abstract
System
Controller
(abstract)
PESSOA
CoSyMA
TuLiP
HyNeSs
…
Constraint-Based
Concrete
System
Constrained
Formula
Controller
Constraint Based Techniques
LMI / LI
Verification
Synthesis
Certificate V
Certificate V
+
Control Strategy C
Find V
Find V + C
Prove Stability
Stabilize
BMI / BI
∀∃
Synthesis for Stabilization
Problem Setup
Plant Model
x
u
Controller
u = g(x)
Find a suitable g(x)
Problem Setup
Plant Model
u
Controller
u = g(x)
x
Static Feedback
Plant Model
u
V (x) =
g(x) =
x
Controller
u = g(x)
X
i
X
i
c i xi
✓i x
i
BMI / BI
[Tan & Packard, El Ghaoui & Balakrishnan, Ben Sassi + S]
V-K iterations
Control Lyapunov Function
• Lyapunov function: V(x)
[Artstein; Sontag; …]
• V(x) is positive definite.
• A control input chosen s.t. derivative is negative
definite.
∀
∃
From CLF to controller
Option #1: Extract g from CLF
u = g(x)
[Sontag 1989]
Option #2 : Dynamically choose u
Control affine inside Polytopes: finitely many value for u
Switched Stabilization
Plant Model
Control Mode #1
u = u1
Choose
Appropriate
Control
Control Mode #2
u = u2
Goal: Decrease
value of CLF
Control Mode #k
u = uk
No single
mode
stabilizes
Issue: Zenoness
?
u = u1
u = u2
From u1,…,uk choose
a mode that causes
V(x) to decrease
u = uk
Potentially Switch
Infinitely Often in a
finite time interval
Minimum Dwell Time Switching
?
u = u1
u = u2
u = uk
≥ Tmin
≥ Tmin
g5
g4
≥ Tmin
g7
g10
Contribution*
• Define restrictions on CLF V s.t.
– V(x) allows a switching strategy with a minimal
dwell time.
– Provide a lower bound for the minimal dwell time.
V (x)
2
✏||x||2
V 0 (x)  ✏ˆ'(x)
00
Some relation between V and '
[Ravanbaksh+S’15]
Main Contribution
Discovering CLFs (∀∃)
Counter-Example Guided Inductive
Synthesis.
CLF Conditions for the Switched Case
?
u = u1
u = u2
u = uk
(rV ) f (x, uk ) 
✏ˆ'(x)
V can be made to decrease by some choice of ui
Synthesizing CLFs
• Fix a template (ansatz) for the CLF with
unknown coefficients.
• Enforce CLF constraints on the unknown form.
SOS relaxations
cannot be used.
More Complex
Constraints.
CEGIS Approach
Constraints to be solved:
[Solar-Lezama, Alur,…]
(9c) (8x)
Template
Parameters
(c, x)
System States
Iterative Procedure:
• Finite set Xi : {x1,…,xk}
• Instantiate the ∀ quantifier
Basic CEGIS Loop
(9c) (8x)
(c, x)
1. Check SATisfiability of the formula:
(9c)
(c, x1 ) ^ (c, x2 ) ^ ... ^ (c, xk )
SAT, ck
SAT, xk+1
2. Check SATisfiability of
(9x) ¬ (ck , x)
UNSAT, Success
UNSAT,
Failure
Applying CEGIS to synthesis CLFs
(9c) (8x 6= x⇤ )

V (x) ✏||x||22
Wk
i=1 (rV )f (x, ui ) 
✏ˆ'(x
1.When x is instantiated:
(9c)
(c, x1 ) ^ (c, x2 ) ^ ... ^ (c, xk )
Linear Arithmetic over c.
2. When c is instantiated,
(9x) ¬ (ck , x)
non-linear arithmetic over x.
Integrating SMT solvers
CEGIS-based CLF
synthesis procedure.
instantiate x
Instantiate c
Value
for c
New
value
for x
SMT-solver Z3
Nonlinear solver
dReal.
[De Moura et al.]
[Gao et al.]
CEGIS: novelties
• CEGIS procedure is off-the-shelf. But
– Prove eventual termination of the CEGIS procedure
for our problem.
– Provide heuristics to speedup termination by
choosing the good counter-examples.
RESULTS
Inverted Pendulum: Bang-Bang Control
Synthesis
Control Mode #1: u = +30
Control Mode #2: u = - 30
http://ctms.engin.umich.edu/CTMS/
Discrete Controller
• min-dwell time ẟ
• control sampling time 𝞽
• ẟ ≥ 0.0002s
• 𝞽 = 0.0002s (𝞽 ≤ ẟ)
Derive a lower-bound on ẟ
Controller for Inverted Pendulum
g
sin(✓)
l
✓˙ = !
!˙ =
u
h
1
!
+
cos(✓)u
2
ml
ml
!
✓
function [ur] = fcn(t, u, theta, omega)
if(not (tau | t))
ur = u;
Discrete Controller
return;
end
if (dV(theta, omega, u) < -5*(theta^2+omega^2))
ur = u;
Not Switch if possible
return;
end
ur = min_dV_u(theta, omega);
end
Simulation
2-6 System Variables
2-6 control modes
Overall Results
benchmarks
from
literature
switched or
control affine
systems
ID
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Problem
n
2
2
2
2
2
2
2
2
3
3
3
3
3
3
4
4
4
5
6
9
|Q|
2
2
2
5
2
3
2
2
4
4
3
5
2
2
5
2
2
6
4
4
# itr
15
15
7
1
3
13
6
6
1
8
15
8
17
36
1
4
4
1
2
1
z3 T
0,4
0,5
0,0
0,0
0,0
0,1
0,1
0,1
0,0
4,4
25,3
8,0
61,7
48,1
0,0
0,0
0,5
Results
dReal T Tot. Time
4,6
5,3
5,6
6,6
2,3
2,5
0,8
0,8
3,4
3,6
49,2
50,0
1,6
2,0
3,6
4,0
2,8
2,8
80,0
86,2
59,6
86,3
41,4
50,4
116,1
179,8
57,3
108,4
27,8
27,8
TO
TO
649,7
650,0
2994,0 2995,6
TO
Status
✔
✔ 17 out of 20
✔ benchmarks
✔
up to 3
✔ variables
✔
✔
✔
✔
✔
✔
✔
✔
✔
✔
✘
✘
✔
✔
✘
FUTURE WORK
Future Work
• Moving to Safety + Stability Synthesis.
– Reach While Avoid Properties.
• Handle more general temporal objectives
• Control of Stochastic Systems.
Thank You
Supported in part by US
NSF CAREER Award #
0953941.