Priced Timed Automata - Aalborg Universitetpeople.cs.aau.dk/~kgl/China2011/Slides/L4 Scheduling...
Transcript of Priced Timed Automata - Aalborg Universitetpeople.cs.aau.dk/~kgl/China2011/Slides/L4 Scheduling...
Priced Timed AutomataPriced Timed AutomataOptimal Scheduling
Kim G. LarsenA lb U i it– Aalborg UniversityDENMARK
Overview
Timed Automata Scheduling Scheduling
Priced Timed Automata CLASSICCLASSICCLASSICCLASSICPriced Timed Automata Optimal Reachability Optimal Infinite Scheduling
CLASSICCLASSICCLASSICCLASSIC
CORACORACORACORAp g Multi Objectives TIGATIGATIGATIGA
ECDARECDARECDARECDAR Energy Automata
TRONTRON
ECDARECDARECDARECDAR
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [2]
SMCSMC
Real Time Scheduling
UNSAFE• Only 1 “Pass”• Cheat is possible• Only 1 “Pass”• Cheat is possible
5(drive close to car with “Pass”)(drive close to car with “Pass”)
10
20Pass
25
SAFE The Car & Bridge ProblemCAN THEY MAKE IT TO SAFEWITHIN 70 MINUTES ???WITHIN 70 MINUTES ???
Kim Larsen [3]ARTIST Design PhD School, Beijing, 2011
Let us play!
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [4]
Real Time Scheduling
5
UNSAFESolve
Scheduling ProblemSolve
Scheduling Problem
SAFE
10
Scheduling Problemusing UPPAAL
Scheduling Problemusing UPPAAL
SAFE 20
25
Kim Larsen [5]ARTIST Design PhD School, Beijing, 2011
Resources & Tasks
Resource
Synchronization
TaskTask
Shared variable
Kim Larsen [6]ARTIST Design PhD School, Beijing, 2011
Task Graph Scheduling – Example
+ *21
Compute : (D * ( C * ( A + B )) + (( A + B ) + ( C * D ))
using 2 processorsA
B C D
4
*
+
+3 4
using 2 processors
P1 (fast) P2 (slow) C * +
*3ps*
2ps+7ps*
5ps+
65
C
+*
P15 10 15 20 25
65
2 3 65
D
P1P2 1
2 3 65
4
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [7]time
Task Graph Scheduling – Example
+ *21
Compute : (D * ( C * ( A + B )) + (( A + B ) + ( C * D ))
using 2 processorsA
B C D
*
+
+3 4
using 2 processors
P1 (fast) P2 (slow) C * +
*3ps*
2ps+7ps*
5ps+
65
C
+*
P15 10 15 20 25
65D
1 3 65 4P1P2
1
2
3 65 4
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [8]time
Task Graph Scheduling – Example
+ *21
Compute : (D * ( C * ( A + B )) + (( A + B ) + ( C * D ))
using 2 processorsA
B C D
*
+
+3 4
using 2 processors
P1 (fast) P2 (slow) C * +
*3ps*
2ps+7ps*
5ps+
65
C
+*
P15 10 15 20 25
65D
1 3 65 4P1P2
1
2
3 65 4
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [9]time
Task Graph Scheduling – Example
+ *21
Compute : (D * ( C * ( A + B )) + (( A + B ) + ( C * D ))
using 2 processorsA
B C D
*
+
+3 4
using 2 processors
P1 (fast) P2 (slow) C * +
*3ps*
2ps+7ps*
5ps+
65
C
+*
P15 10 15 20 25
65D
1 3 65 4P1P2
1
2
3 65 4
E<> (Task1 End and and Task6 End)
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [10]time
E<> (Task1.End and … and Task6.End)
Experimental Results
Symbolic A*Branch-&-Bound
60 sec60 sec
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [11]
Abdeddaïm, Kerbaa, Maler
Priced TimedPriced Timed AutomataAutomata
EXAMPLE: Optimal rescue plan for cars withdifferent subscription rates for city driving !
SAFEGolf Citroen5
9 210
20
BMW Datsun
25
BMW Datsun
3 10
OPTIMAL PLAN HAS ACCUMULATED COST=195 and TOTAL TIME=65!
Kim Larsen [13]ARTIST Design PhD School, Beijing, 2011
ExperimentsCOST-rates
SCHEDULE COST TIME #Expl #Pop’d
G C B DG C B D
Min Time CG> G< BD> C< CG> 60 1762
15382638
CG> G< BG> G< 1 1 1 1 CG> G< BG> G< GD> 55 65 252 378
9 2 3 10 GD> G< CG> G< BG> 195 65 149 233
1 2 3 4 CG> G< BD> C< CG> 140 60 232 350
1 2 3 10 CD> C< CB> C< CG> 170 65 263 4081 2 3 10 CG> 170 65 263 408
1 20 30 40 BD> B< CB> C< CG>
9751085
85time<85
- -
0 0 0 0 0 406 4470 0 0 0 - 0 - 406 447
Kim Larsen [14]ARTIST Design PhD School, Beijing, 2011
Task Graph Scheduling – Revisited
+ *21
Compute : (D * ( C * ( A + B )) + (( A + B ) + ( C * D ))
using 2 processorsA
B C D
*
+
+3 4
using 2 processors
P1 (fast) P2 (slow)C * +
*3ps*
2ps+7ps*
5ps+
65
C
1oWIdle 20WIdle+*
P15 10 15 20 25
65D
1 3 65 4
90WIn use
1oWIdle
30WIn use
20WIdleENERGY:
P1P2
1
2
3 65 4
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [15]time
Task Graph Scheduling – Revisited
+ *21
Compute : (D * ( C * ( A + B )) + (( A + B ) + ( C * D ))
using 2 processorsA
B C D
*
+
+3 4
using 2 processors
P1 (fast) P2 (slow) C * +
*3ps*
2ps+7ps*
5ps+
65
C
10WIdle 20WIdle+*
P15 10 15 20 25
65D
90WIn use
10WIdle
30WIn use
20WIdleENERGY:
1 3 4P1P2
1
2
3
65
4
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [16]time
Task Graph Scheduling – Revisited
+ *21
Compute : (D * ( C * ( A + B )) + (( A + B ) + ( C * D ))
using 2 processorsA
B C D
*
+
+3 4
using 2 processors
P1 (fast) P2 (slow) C * +
*3ps*
2ps+7ps*
5ps+
65
C
10WIdle 20WIdle+*
P15 10 15 20 25
65D
90WIn use
10WIdle
30WIn use
20WIdleENERGY:
1 3 4P1P2
1
2
3
65
4
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [17]time
A simple example
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [18]
A simple example
Q: What is cheapest cost for reaching ?
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [19]
Corner Point Regions
THM [Behrmann, Fehnker ..01] [Alur,Torre,Pappas 01]Optimal reachability is decidable for PTA
3
THM [Bouyer, Brojaue, Briuere, Raskin 07]Optimal reachability is PSPACE-completefor PTA
03 0 0
3for PTA
0
0 00
0
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [20]
Priced Zones [CAV01]
A zone Z: 1≤ x ≤ 2 Æ 0≤ y ≤ 2 Æ x - y ≥ 0
A cost function C
x - y ≥ 0
A cost function CC(x,y)=
2·x - 1·y + 3
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [21]
Priced Zones – Reset [CAV01]
A zone Z: 1≤ x ≤ 2 Æ 0≤ y ≤ 2 Æ x - y ≥ 0
Z[x=0]:x=0 Æ
A cost function C
x - y ≥ 0x 0 Æ0≤ y ≤ 2
C = 1·y + 3 A cost function CC(x,y) =
2·x - 1·y + 3
C 1 y + 3
C= -1·y + 5
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [22]
Symbolic Branch & Bound Algorithm
Z’ is bigger & cheaper than Z
ZZ '
cheaper than Z
≤ is a well-quasi≤ is a well quasiordering which
guaranteestermination!
Kim Larsen [23]ARTIST Design PhD School, Beijing, 2011
Example: Aircraft Landing
tcost E earliest landing timeT target timeL latest timee*(T-t)
d+l*(t-T)
tE
e cost rate for being earlyl cost rate for being lated fixed cost for being late
E LT
Planes have to keep separation distance to avoid turbulences caused by preceding planes
RunwayKim Larsen [24]ARTIST Design PhD School, Beijing, 2011
Example: Aircraft Landing
x <= 5
land!x >= 4 x=5
x <= 5 x <= 9cost+=2
4 earliest landing time5 target time9 latest time
x=5
x 5
land!
x <= 9cost’=3 cost’=1 3 cost rate for being early1 cost rate for being late2 fixed cost for being late
Planes have to keep separation distance to avoid turbulences caused by preceding planes
RunwayKim Larsen [25]ARTIST Design PhD School, Beijing, 2011
Aircraft Landing Source of examples:Baesley et al’2000
Kim Larsen [26]ARTIST Design PhD School, Beijing, 2011
Symbolic Branch & Bound Algorithm
Zone basedLinear ProgrammingLinear ProgrammingProblems(dualize)Min Cost FlowMin Cost Flow
Kim Larsen [27]ARTIST Design PhD School, Beijing, 2011
Aircraft Landing (revisited) Using MCF/Netsimplex
[TACAS04]
g / p
Kim Larsen [28]ARTIST Design PhD School, Beijing, 2011
Optimal Infinite Schedule
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [29]
EXAMPLE: Optimal WORK plan for cars withdifferent subscription rates for city driving !
gi
different subscription rates for city driving !
Golf Citroen5
maximal 100 min. at each location
knolo
g
9 210
onst
ek 20
25
rmat
io
BMW Datsun
3 10
Info
r 3 10
UCb
Workplan I gi
pGolf
UCitroen
UGolf
UCitroen
UGolf
UCitroen
U(25) (25)
knolo
g BMW
UDatsun
UBMW
SDatsun
SBMW
UDatsun
U
(25)
275 275
300
onst
ek Golf
SCitroen
UBMW Datsun
Golf
UCitroen
UBMW Datsun
Golf
UCitroen
SBMW Datsun
(25)(20)
300
rmat
io S U U U U S
(20) (25)
300300
300 300
Info
r
Golf
UCitroen
UBMW
UDatsun
U
Golf
UCitroen
SBMW
UDatsun
S
(25)
300Value of workplan:
UCb
U U U S300(4 x 300) / 90 = 13.33
Workplan IIgi
pGolf Citroen
BMW Dats n
Golf Citroen
BMW Dats n
Golf Citroen
BMW Dats n
Golf Citroen
BMW Dats n
25/1255/25 20/180
knolo
g BMW Datsun BMW Datsun BMW Datsun BMW Datsun
Golf CitroenGolf CitroenGolf CitroenGolf Citroen
10/90
onst
ek
Golf Citroen
BMW Datsun
Golf Citroen
BMW Datsun
Golf Citroen
BMW Datsun
Golf Citroen
BMW Datsun
5/1025/12510/130
rmat
io
Golf Citroen
BMW Datsun
Golf Citroen Golf Citroen Golf Citroen
5/65
25/225 10/90 10/0
Info
r BMW DatsunBMW Datsun BMW Datsun BMW Datsun
Golf CitroenGolf Citroen
10/0
5/1025/50
V l f k l
UCb
BMW DatsunBMW Datsun
5/10Value of workplan:
560 / 100 = 5.6
Optimal Infinite Scheduling
Maximize throughput:i.e. maximize Reward / Time in the long run!
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [33]
Optimal Infinite Scheduling
Minimize Energy Consumption:i.e. minimize Cost / Time in the long run
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [34]
Optimal Infinite Scheduling
Maximize throughput:i.e. maximize Reward / Cost in the long run
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [35]
Mean Pay-Off Optimality
Bouyer, Brinksma, Larsen: HSCC04,FMSD07
Bouyer, Brinksma, Larsen: HSCC04,FMSD07
Accumulated cost
c cc3 cn
c1 c2
r1 r2r3 rn
Accumulated reward¬ BAD
Value of path : val() = limn→∞ cn/rn
Optimal Schedule *: val(*) = inf val()
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [36]
Optimal Schedule : val( ) inf val()
Discount Optimality 1 : discounting factor
Larsen, Fahrenberg:INFINITY’08Larsen, Fahrenberg:INFINITY’08
Cost of time tn
(t ) c(t )c(t3) c(tn)
c(t1) c(t2)
t1 t2t3 tn
Time of step n¬ BAD
Value of path : val() =
Optimal Schedule *: val( *) inf val( )ARTIST Design PhD School, Beijing, 2011 Kim Larsen [37]
Optimal Schedule : val( ) = inf val()
Soundness of Corner Point Abstraction
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [38]
Application Dynamic Voltage Scaling
gi
y g gkn
olo
gonst
ekrm
atio
Info
r
UCb
Multiple Objective Scheduling
P2 P116,10
2,3
P6 P3 P42,36,6 10,16
cost1’==4 cost2’==3
cost2
Pareto Frontier
P P2 2
1
P7 P52,2 8,2
4W 3W cost1
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [40]
1
”Experimental” Results
WarehouseiTunes
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [41]
”Experimental” Results
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [42]
Energy Automata
Managing Resources
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [44]
Consuming & Harvesting Energy
Maximize throughputwhile respecting: 0 ≤ E ≤ MAX
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [45]
Energy Constrains
Energy is not only consumed but may also be regained The aim is to continously satisfy some energy constriants
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [46]
Results (so far) Bouyer, Fahrenberg,Larsen, Markey, Srba:
FORMATS 2008
Bouyer, Fahrenberg,Larsen, Markey, Srba:
FORMATS 2008FORMATS 2008FORMATS 2008
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [47]
Discrete Updates on Edges
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [48]
New Approach: Energy Functions
Maximize energyalong paths
Use this information to solvegeneral problem
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [49]
Energy Function
General StrategySpend just enough timeto survive the next negativeto survive the next negativeupdate
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [50]
Exponential PTA
General StrategyGeneral StrategySpend just enough timeto survive the next negativeupdateupdateso that after next negative update there is a certain positive amount !
Minimal Fixpoint:
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [51]
Exponential PTA
Thm [HSCC10]: Lower-bound problem is decidable
Energy Function
Lower-bound problem is decidablefor linear and exponential 1-clock PTAs withnegative discrete updates.
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [52]
Conclusion
Priced Timed Automata a uniform frameworkfor modeling and solving dynamic ressourcefor modeling and solving dynamic ressource allocation problems!
Not mentioned here: Model Checking Issues (ext. of CTL and LTL).
Future work:Z b d l i h f i l i fi i Zone-based algorithm for optimal infinite runs.
Approximate solutions for priced timed games to circumvent undecidablity issues.y
Open problems for Energy Automata. Approximate algorithms for optimal reachability
ARTIST Design PhD School, Beijing, 2011 Kim Larsen [53]