Scheduling Optim al & Real Tim e using CORA CORA CORA - - PDF document
Scheduling Optim al & Real Tim e using CORA CORA CORA - - PDF document
Model Checking Technology Scheduling Optim al & Real Tim e using CORA CORA CORA Overview Timed Automata & Scheduling Informationsteknologi Priced Timed Automata and Optimal Scheduling Optimal Infinite Scheduling
Informationsteknologi
UC UCb
Overview
Timed Automata & Scheduling Priced Timed Automata and Optimal
Scheduling
Optimal Infinite Scheduling Optimal Conditional Scheduling
Optimal Scheduling Using Priced Timed Automata.
- G. Behrmann, K. G. Larsen, J. I. Rasmussen,
ACM SIGMETRICS Performance Evaluation Review
Informationsteknologi
UC UCb
Real Tim e Model Checking
sensors actuators
a c b 1 2 4 3 a c b 1 2 4 3 1 2 4 3 1 2 4 3 a c b
UPPAAL Model
Model
- f
environment (user-supplied / non-determinism) Model
- f
tasks (automatic?)
Plant
Continuous
Controller Program
Discrete
SAT φ ?? SAT φ ??
Informationsteknologi
UC UCb
??
Real Tim e Scheduling & Control Synthesis Plant
Continuous
Controller Program
Discrete
sensors actuators
a c b 1 2 4 3 a c b 1 2 4 3 1 2 4 3 1 2 4 3 a c b
Partial UPPAAL Model
Model
- f
environment (user-supplied)
Synthesis
- f
tasks/scheduler (automatic)
SAT φ !! SAT φ !!
Informationsteknologi
UC UCb
Rush Hour
OBJECTI VE: Get your CAR out OBJECTI VE: Get your CAR out Your CAR EXI T
Informationsteknologi
UC UCb
Rush Hour
Informationsteknologi
UC UCb
Real Tim e Scheduling
5 10 20 25
UNSAFE SAFE
- Only 1 “Pass”
- Cheat is possible
(drive close to car with “Pass”)
- Only 1 “Pass”
- Cheat is possible
(drive close to car with “Pass”)
The Car & Bridge Problem CAN THEY MAKE I T TO SAFE WI THI N 70 MI NUTES ???
Crossing Times
Pass
Informationsteknologi
UC UCb
Real Tim e Scheduling
SAFE
5 10 20 25
UNSAFE
Solve Scheduling Problem using UPPAAL Solve Scheduling Problem using UPPAAL
Informationsteknologi
UC UCb
Tim ed Autom ata
Synchronization Guard Invariant Reset
[ Alur & Dill’89]
Resource Transitions: ( Idle , x= 0 ) d(2.5) ( Idle , x= 2.5) use? ( InUse , x= 0 ) d(5) ( InUse , x= 5) done! ( Idle , x= 5) d(3) ( Idle , x= 8) use? ( InUse , x= 0 ) Transitions: ( Idle , x= 0 ) d(2.5) ( Idle , x= 2.5) use? ( InUse , x= 0 ) d(5) ( InUse , x= 5) done! ( Idle , x= 5) d(3) ( Idle , x= 8) use? ( InUse , x= 0 ) States: ( location , x= v) where v∈R States: ( location , x= v) where v∈R
Informationsteknologi
UC UCb
Com position
Resource Task Shared variable Synchronization Transitions: ( Idle , Init , B= 0, x= 0) d(3.1415) ( Idle , Init , B= 0 , x= 3.1415 ) use ( InUse , Using , B= 6, x= 0 ) d(6) ( InUse , Using , B= 6, x= 6 done ( Idle , Done , B= 6 , x= 6 Transitions: ( Idle , Init , B= 0, x= 0) d(3.1415) ( Idle , Init , B= 0 , x= 3.1415 ) use ( InUse , Using , B= 6, x= 0 ) d(6) ( InUse , Using , B= 6, x= 6 done ( Idle , Done , B= 6 , x= 6
Informationsteknologi
UC UCb
Task Graph Scheduling
Optim al Static Task Scheduling
Task P= { P1,.., Pm} Machines M= { M1,..,Mn} Duration Δ : ( P×M) → N ∞ < : p.o. on P (pred.) A task can be executed only
if all predecessors have completed
Each machine can process
at most one task at a time
Task cannot be preempted. Compute schedule with
minimum completion-time!
P2 P1 P6 P3 P4 P7 P5
1 6 ,1 0 2 ,3 2 ,3 6 ,6 1 0 ,1 6 2 ,2 8 ,2
M = { M1,M2}
Informationsteknologi
UC UCb
Task Graph Scheduling
Optim al Static Task Scheduling
Task P= { P1,.., Pm} Machines M= { M1,..,Mn} Duration Δ : ( P×M) → N ∞ < : p.o. on P (pred.)
P2 P1 P6 P3 P4 P7 P5
1 6 ,1 0 2 ,3 2 ,3 6 ,6 1 0 ,1 6 2 ,2 8 ,2
M = { M1,M2}
E<> (Task1.End and … and Task7.End)
Informationsteknologi
UC UCb
Experim ental Results
Abdeddaïm, Kerbaa, Maler
Symbolic A* Brand-&-Bound 60 sec
Informationsteknologi
UC UCb
Optim al Task Graph Scheduling
Pow er-Optim ality
Energy-rates:
C : M → N
Compute schedule with
minimum completion-cost!
P2 P1 P6 P3 P4 P7 P5
1 6 ,1 0 2 ,3 2 ,3 6 ,6 1 0 ,1 6 2 ,2 8 ,2
4 W 3 W
Priced Tim ed Autom ata
Optim al Scheduling
with Paul Pettersson, Thomas Hune, Judi Romijn, Ansgar Fehnker, Ed Brinksma, Frits Vaandrager, Patricia Bouyer, Franck Cassez, Henning Dierks Emmanuel Fleury, Jacob Rasmussen,..
Informationsteknologi
UC UCb EXAMPLE: Optimal rescue plan for cars with
different subscription rates for city driving !
SAFE
Golf Citroen BMW Datsun
9 2 3 10 OPTI MAL PLAN HAS ACCUMULATED COST= 195 and TOTAL TI ME= 65!
5 10 20 25
Informationsteknologi
UC UCb
Experim ents
447 406
- 85
time< 85
975
1085
BD> B< CB> C< CG>
40 30 20 1 378 252 65 55
CG> G< BG> G< GD>
1 1 1 1
# Pop’d # Expl
TI ME COST
SCHEDULE
COST-rates 408 263 65 170
CD> C< CB> C< CG>
10 3 2 1 350 232 60 140
CG> G< BD> C< CG>
4 3 2 1 233 149 65 195
GD> G< CG> G< BG>
10 3 2 9 2638 1762
1538
60
CG> G< BD> C< CG>
Min Tim e
D B C G
Informationsteknologi
UC UCb
Priced Tim ed Autom ata
Alur, Torre, Pappas (HSCC’01) Behrmann, Fehnker, et all (HSCC’01)
l1 l2 l3 x: = 0 c+ = 1 x · 2 3 · y c+ = 4 c’= 4 c’= 2
☺
0 · y · 4 y · 4 x: = 0
Timed Automata + COST variable
cost rate cost update
Informationsteknologi
UC UCb
Priced Tim ed Autom ata
Alur, Torre, Pappas (HSCC’01) Behrmann, Fehnker, et all (HSCC’01)
l1 l2 l3 x: = 0 c+ = 1 x · 2 3 · y c+ = 4 c’= 4 c’= 2
☺
0 · y · 4 y · 4 x: = 0
Timed Automata + COST variable
cost rate cost update
(l1,x= y= 0) (l1,x= y= 3) (l2,x= 0,y= 3) (l3,_,_)
ε(3) 12 1 4
∑ c= 1 7
TRACES
Informationsteknologi
UC UCb
TRACES
Priced Tim ed Autom ata
Alur, Torre, Pappas (HSCC’01) Behrmann, Fehnker, et all (HSCC’01)
l1 l2 l3 x: = 0 c+ = 1 x · 2 3 · y c+ = 4 c’= 4 c’= 2
☺
0 · y · 4 y · 4 x: = 0
Timed Automata + COST variable
cost rate cost update
(l1,x= y= 0) (l1,x= y= 3) (l2,x= 0,y= 3) (l3,_,_) (l1,x= y= 0) (l1,x= y= 2.5) (l2,x= 0,y= 2.5) (l2,x= 0.5,y= 3) (l3,_,_) (l1,x= y= 0) (l2,x= 0,y= 0) (l2,x= 3,y= 3) (l2,x= 0,y= 3) (l3,_,_)
ε(3) ε(2.5) ε(.5) ε(3) 12 1 4 10 1 1 4 1 6 4
∑ c= 1 7 ∑ c= 1 6 ∑ c= 1 1
P r
- b
l e m :
F i n d t h e m i n i m u m c
- s
t
- f
r e a c h i n g l
- c
a t i
- n
l
3
P r
- b
l e m :
F i n d t h e m i n i m u m c
- s
t
- f
r e a c h i n g l
- c
a t i
- n
l
3
Efficient Implementation: CAV’0 1 and TACAS’0 4 Efficient Implementation: CAV’0 1 and TACAS’0 4
Informationsteknologi
UC UCb
Aircraft Landing Problem
cost t E L T E earliest landing time T target time L latest time e cost rate for being early l
cost rate for being late
d fixed cost for being late e*(T-t) d+l*(t-T)
Planes have to keep separation distance to avoid turbulences caused by preceding planes
Runway
Informationsteknologi
UC UCb
Planes have to keep separation distance to avoid turbulences caused by preceding planes
Runway 129: Earliest landing time 153: Target landing time 559: Latest landing time 10: Cost rate for early 20: Cost rate for late Runway handles 2 types of planes
Modeling ALP with PTA
Sym bolic ”A* ”
Informationsteknologi
UC UCb
Zones
Operations
x y Z
Informationsteknologi
UC UCb
Priced Zone
x y
Δ4
2
- 1
Z
2 2 + − = x y y x Cost ) , (
CAV’01
Informationsteknologi
UC UCb
Reset
x y
Δ4
2
- 1
Z
y:= 0 2
Informationsteknologi
UC UCb
Reset
x y
Δ4
2
- 1
Z
{ y} Z y:= 0 2
Informationsteknologi
UC UCb
Reset
x y
Δ4
2
- 1
Z
{ y} Z 6 y:= 0 2
Informationsteknologi
UC UCb
Reset
x y
Δ4
2
- 1
Z
{ y} Z 6
- 1
1
4 A split of { y} Z y:= 0 2
Informationsteknologi
UC UCb
Delay
x y
Δ4
3
- 1
Z
Informationsteknologi
UC UCb
Delay
x y
Δ4
3
- 1
Z
↑ Z
Informationsteknologi
UC UCb
Delay
x y
Δ4
3
- 1
Z
↑ Z
3 2
3
Informationsteknologi
UC UCb
Delay
x y
Δ4
3
- 1
Z
3 4
- 1
A split of
↑ Z
↑ Z
3
Informationsteknologi
UC UCb
Branch & Bound Algorithm
Informationsteknologi
UC UCb
Branch & Bound Algorithm
Informationsteknologi
UC UCb
Branch & Bound Algorithm
Informationsteknologi
UC UCb
Branch & Bound Algorithm
Informationsteknologi
UC UCb
Branch & Bound Algorithm
Informationsteknologi
UC UCb
Branch & Bound Algorithm
Z’ is bigger & cheaper than Z Z’ is bigger & cheaper than Z
Z Z ≤ '
≤
· is a well-quasi
- rdering which
guarantees termination! · is a well-quasi
- rdering which
guarantees termination!
Experim ental Results
Informationsteknologi
UC UCb
Experim ents
MC Order
447 406
- 85
time< 85
975
1085
BD> B< CB> C< CG>
40 30 20 1 378 252 65 55
CG> G< BG> G< GD>
1 1 1 1
# Pop’d # Expl
TI ME COST
SCHEDULE
COST-rates 408 263 65 170
CD> C< CB> C< CG>
10 3 2 1 350 232 60 140
CG> G< BD> C< CG>
4 3 2 1 233 149 65 195
GD> G< CG> G< BG>
10 3 2 9 2638 1762
1538
60
CG> G< BD> C< CG>
Min Tim e
D2
5
B2 C1 G5
Informationsteknologi
UC UCb
Example: Aircraft Landing
cost t E L T E earliest landing time T target time L latest time e cost rate for being early l
cost rate for being late
d fixed cost for being late e*(T-t) d+l*(t-T)
Planes have to keep separation distance to avoid turbulences caused by preceding planes
Runway
Informationsteknologi
UC UCb
Example: Aircraft Landing
Planes have to keep separation distance to avoid turbulences caused by preceding planes
land! x >= 4 x=5 x <= 5 x=5 x <= 5 land! x <= 9 cost+=2 cost’=3 cost’=1 4 earliest landing time 5 target time 9 latest time 3 cost rate for being early 1 cost rate for being late 2 fixed cost for being late
Runway
Informationsteknologi
UC UCb
Aircraft Landing
Source of examples: Baesley et al’2000
CAV’01
Informationsteknologi
UC UCb
Branch & Bound Algorithm
Zone based Linear Program m ing Problem s
Informationsteknologi
UC UCb
Zone LP Min Cost Flow
Exploiting duality
minimize 3 x 1-2 x 2+ 7 when x1-x2· 1 1· x2 · 3 x2≥ 1 minimize 3 y2 ,0-y0 ,2+ y1 ,2 – y0 ,1 when y2,0-y0,1-y0,2= 1 y0,2+ y1,2= 2 y0,1-y1,2= -3
Informationsteknologi
UC UCb
Zone LP Min Cost Flow
Exploiting duality
minimize 3 x 1-2 x 2+ 7 when x1-x2· 1 1· x2 · 3 x2≥ 1 minimize 3 y2 ,0-y0 ,2+ y1 ,2 – y0 ,1 when y2,0-y0,1-y0,2= 1 y0,2+ y1,2= 2 y0,1-y1,2= -3
Informationsteknologi
UC UCb
Aircraft Landing
Using MCF/ Netsim plex
Rasm ussen, Larsen, Subram ani TACAS0 4
Optim al Conditional Reachability
with Jacob I. Rasmussen
Informationsteknologi
UC UCb EXAMPLE: Optimal rescue plan for cars with
different subscription rates for city driving !
SAFE
Golf Citroen BMW Datsun
9 2 3 10
5 10 20 25
UNSAFE
My CAR!
Minimizes Cost MYCAR subject to
Cost Citroen · 6 0 Cost BMW · 9 0 Cost Datsun · 1 0
min Cost MYCAR= 2 7 0 tim e = 70
CONDI TI ONAL
Informationsteknologi
UC UCb
Optim al Conditional Reachability
c’ = 1 d’ = 4 c’ = 2 d’ = 1
☺
l1 l2 l3 x · 2 y: = 0 d+ = 1 x ≥ 2 y ≥ 1 x · 3 y · 2 y: = 0
PROBLEM: Reach l3 in a way which minimizes c subject to d · 4 PROBLEM: Reach l3 in a way which minimizes c subject to d · 4
SOLUTI ON: c = 11/ 3 wait 1/ 3 in l1; goto l2; wait 5/ 3 in l2; goto l3 SOLUTI ON: c = 11/ 3 wait 1/ 3 in l1; goto l2; wait 5/ 3 in l2; goto l3
Dual-priced TA
Informationsteknologi
UC UCb
Discrete Trajectories
c’ = 1 d’ = 4 c’ = 2 d’ = 1 ☺ l1 l2 l3 x · 2 y: = 0 d+ = 1 x ≥ 2 y ≥ 1 x · 3 y · 2 y: = 0
l1,0,0 l1,1,1 l1,2,2 l2,0,0 l2,1,0 l2,2,0 l2,1,1 l2,2,2 l2,2,1 l2,3,2 l2,3,1
☺
1,4 1,4 2,1 2,1 2,1 2,1 2,1 0,1 0,1 0,1 0,0 0,0 0,0 0,0
Informationsteknologi
UC UCb
Discrete Trajectories
c’ = 1 d’ = 4 c’ = 2 d’ = 1 ☺ l1 l2 l3 x · 2 y: = 0 d+ = 1 x ≥ 2 y ≥ 1 x · 3 y · 2 y: = 0
l1,0,0 l1,1,1 l1,2,2 l2,0,0 l2,1,0 l2,2,0 l2,1,1 l2,2,2 l2,2,1 l2,3,2 l2,3,1
☺
1,4 1,4 2,1 2,1 2,1 2,1 2,1 0,1 0,1 0,1 0,0 0,0 0,0 0,0
4 2 6 10 8 6 4 2 4
d c
Informationsteknologi
UC UCb
54
Multiple Objective Scheduling
P2 P1 P6 P3 P4 P7 P5
1 6 ,1 0 2 ,3 2 ,3 6 ,6 1 0 ,1 6 2 ,2 8 ,2
4 W 3 W
cost1’==4 cost2’==3
3 W
Informationsteknologi
UC UCb
55
Multiple Objective Scheduling
P2 P1 P6 P3 P4 P7 P5
1 6 ,1 0 2 ,3 2 ,3 6 ,6 1 0 ,1 6 2 ,2 8 ,2
4 W 3 W
cost1’==4 cost2’==3 cost1 cost2
Pareto Frontier
T h e P a r e t
- F
r
- n
t i e r f
- r
R e a c h a b i l i t y i n M u l t i P r i c e d T i m e d A u t
- m
a t a i s c
- m
p u t a b l e
[Illum, Larsen FoSSaCS05]
Informationsteknologi
UC UCb
Dual Priced Zones
Informationsteknologi
UC UCb
Dual Priced Zones
Informationsteknologi
UC UCb
Reset
Informationsteknologi
UC UCb
Reset
Informationsteknologi
UC UCb
Reset
Informationsteknologi
UC UCb
Reset
Informationsteknologi
UC UCb
Exploration
c’ = 1 d’ = 4 c’ = 2 d’ = 1 ☺ l1 l2 l3 x · 2 y: = 0 d+ = 1 x ≥ 2 y ≥ 1 x · 3 y · 2 y: = 0
Informationsteknologi
UC UCb
Exploration
c’ = 1 d’ = 4 c’ = 2 d’ = 1 ☺ l1 l2 l3 x · 2 y: = 0 d+ = 1 x ≥ 2 y ≥ 1 x · 3 y · 2 y: = 0
Informationsteknologi
UC UCb
Exploration
c’ = 1 d’ = 4 c’ = 2 d’ = 1 ☺ l1 l2 l3 x · 2 y: = 0 d+ = 1 x ≥ 2 y ≥ 1 x · 3 y · 2 y: = 0
Informationsteknologi
UC UCb
Term ination
T H E O R E M O p t i m a l c
- n
d i t i
- n
a l r e a c h a b i l i t y f
- r
m u l t i
- p
r i c e d T A i s c
- m
p u t a b l e . T H E O R E M O p t i m a l c
- n
d i t i
- n
a l r e a c h a b i l i t y f
- r
m u l t i
- p
r i c e d T A i s c
- m
p u t a b l e .
BRI CS@Aalborg FMT@Tw ente
Optimal Infinite Scheduling
w ith Ed Brinksm a Patricia Bouyer Arne Skou
Informationsteknologi
UC UCb
68
Optim al I nfinite Scheduling
Maximize throughput: i.e. maximize Reward / Time in the long run!
Informationsteknologi
UC UCb
69
Optim al I nfinite Scheduling
Minimize Energy Consumption: i.e. minimize Cost / Time in the long run
Informationsteknologi
UC UCb
70
Optim al I nfinite Scheduling
Maximize throughput: i.e. maximize Reward / Cost in the long run
Informationsteknologi
UC UCb
EXAMPLE: Optimal WORK plan for cars with different subscription rates for city driving !
Golf Citroen BMW Datsun
9 2 3 10
5 10 20 25
maximal 100 min. at each location
Informationsteknologi
UC UCb
W orkplan I
Datsun
U
BMW
U
Citroen
U
Golf
U
Datsun
S
BMW
S
Citroen
U
Golf
U
Datsun
U
BMW
U
Citroen
U
Golf
U
Datsun
U
BMW
S
Citroen
U
Golf
S
Datsun
U
BMW
U
Citroen
U
Golf
U
Datsun
S
BMW
U
Citroen
S
Golf
U
Datsun
U
BMW
U
Citroen
U
Golf
U
Datsun
S
BMW
U
Citroen
S
Golf
U ε(25) ε(25) ε(25) ε(25) ε(20) ε(20) ε(25) ε(25)
275 275 300 300 300 300 300 300 Value of workplan: (4 x 3 0 0 ) / 90 = 1 3 .3 3
Informationsteknologi
UC UCb
W orkplan I I
Datsun BMW Citroen Golf Datsun BMW Citroen Golf Datsun BMW Citroen Golf Datsun BMW Citroen Golf Datsun BMW Citroen Golf Datsun BMW Citroen Golf Datsun BMW Citroen Golf Datsun BMW Citroen Golf Datsun BMW Citroen Golf Datsun BMW Citroen Golf Datsun BMW Citroen Golf Datsun BMW Citroen Golf Datsun BMW Citroen Golf Datsun BMW Citroen Golf
25/ 125 5/ 25 20/ 180 10/ 90 5/ 10 25/ 125 10/ 130 5/ 65 25/ 225 10/ 90 10/ 0 10/ 0 5/ 10 25/ 50
Value of workplan: 5 6 0 / 100 = 5 .6
Informationsteknologi
UC UCb
Cost Optim al Scheduling = Optim al I nfinite Path
c1 c2 c3 cn t1 t2 t3 tn
σ
Value of path σ: val(σ) = limn→∞ cn/tn Optimal Schedule σ* : val(σ* ) = infσ val(σ)
Accumulated cost Accumulated time
¬(Car0.Err or Car1.Err or …)
Informationsteknologi
UC UCb
Cost Optim al Scheduling = Optim al I nfinite Path
c1 c2 c3 cn t1 t2 t3 tn
σ
Value of path σ: val(σ) = limn→∞ cn/tn Optimal Schedule σ* : val(σ* ) = infσ val(σ)
Accumulated cost Accumulated time
¬(Car0.Err or Car1.Err or …)
THEOREM: σ* is computable THEOREM: σ* is computable
Bouyer, Brinksma, Larsen HSCC’04
Informationsteknologi
UC UCb
Application
Dynam ic Voltage Scaling
UC UCb
Approxim ate Optim al Schedule
E[] (not (Golf.Err or Datsun.Err or BMW.Err or Citroen.Err) and (cost> = M imply time > = N)) = E[] φ(M ,N)
σ ² [] φ(M,N) imply val(σ)· M/ N
C= M C= M C= M
T> = N T< N X
X X
Optimal infinite schedule modulo cost-horizon C= M
T< N T< N T> = N