Priced Timed Automata - people.cs.aau.dkpeople.cs.aau.dk/~kgl/RIO12/Slides/L4 Scheduling PTA.pdf ·...

Post on 19-Mar-2018

212 views 0 download

transcript

Priced Timed AutomataPriced Timed AutomataOptimal Scheduling

Kim G. LarsenA lb U i it– Aalborg UniversityDENMARK

Embedded Systems

Tasks:Computation timesDeadlines

ResourcesExecution platform

DependenciesArrival patternsuncertainties

pPE, MemoryNetworksDrivers

Scheduling Principles (OS)EDF, FPS, RMS, DVS, ..

Summer School on Informatics RIO 2012 Kim Guldstrand Larsen [2]

uncertainties

Timing AnalysesModel checking is fixpoint Abstract Interpretation is

WCET analysis:the execution time of

g piteration without dynamic

abstraction and usingset union to collect states.

fixpoint iteration with dynamic abstraction using lattice join to combine abstract states.an isolated task.

Schedulability analysis: Schedulability analysis:Verify no deadlines violated in higher level system for given schedTasks Res system for given sched. princinple

Tasks

SP

Res.

Scheduling:Assign resources to tasks

Summer School on Informatics RIO 2012 Kim Guldstrand Larsen [3]

Overview

Scheduling Timed AutomataTimed Automata

Optimal Scheduling Priced Timed Automata

CLASSICCLASSICCLASSICCLASSIC Energy Automata

S h d l bilit A l i

CLASSICCLASSICCLASSICCLASSIC

CORACORACORACORA Schedulability Analysis Single Processor Multi Processor

TIGATIGATIGATIGA

ECDARECDARECDARECDARMulti Processor

WCET Analysis TRONTRON

ECDARECDARECDARECDAR

y

Summer School on Informatics RIO 2012 Kim Larsen [4]

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 [5]Summer School on Informatics RIO 2012

Let us play!

Summer School on Informatics RIO 2012 Kim Larsen [6]

Real Time Scheduling

5

UNSAFESolve

Scheduling ProblemSolve

Scheduling Problem

SAFE

10

Scheduling Problemusing UPPAAL

Scheduling Problemusing UPPAAL

SAFE 20

25

Kim Larsen [7]Summer School on Informatics RIO 2012

Resources & Tasks

Resource

Synchronization

TaskTask

Shared variable

Kim Larsen [8]Summer School on Informatics RIO 2012

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

Summer School on Informatics RIO 2012 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

Summer School on Informatics RIO 2012 Kim Larsen [10]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

Summer School on Informatics RIO 2012 Kim Larsen [11]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)

Summer School on Informatics RIO 2012 Kim Larsen [12]time

E<> (Task1.End and … and Task6.End)

Experimental Results

Symbolic A*Branch-&-Bound

60 sec60 sec

Summer School on Informatics RIO 2012 Kim Larsen [13]

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 [15]Summer School on Informatics RIO 2012

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 [16]Summer School on Informatics RIO 2012

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

Summer School on Informatics RIO 2012 Kim Larsen [17]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

Summer School on Informatics RIO 2012 Kim Larsen [18]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

Summer School on Informatics RIO 2012 Kim Larsen [19]time

A simple example

Summer School on Informatics RIO 2012 Kim Larsen [20]

A simple example

Q: What is cheapest cost for reaching ?

Summer School on Informatics RIO 2012 Kim Larsen [21]

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

Summer School on Informatics RIO 2012 Kim Larsen [22]

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

Summer School on Informatics RIO 2012 Kim Larsen [23]

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

Summer School on Informatics RIO 2012 Kim Larsen [24]

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 [25]Summer School on Informatics RIO 2012

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 [26]Summer School on Informatics RIO 2012

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 [27]Summer School on Informatics RIO 2012

Aircraft Landing (revisited) Using MCF/Netsimplex

[TACAS04]

g / p

Kim Larsen [28]Summer School on Informatics RIO 2012

Aircraft Landing Source of examples:Baesley et al’2000

Kim Larsen [29]Summer School on Informatics RIO 2012

Symbolic Branch & Bound Algorithm

Zone basedLinear ProgrammingLinear ProgrammingProblems(dualize)Min Cost FlowMin Cost Flow

Kim Larsen [30]Summer School on Informatics RIO 2012

Optimal Infinite Schedule

Summer School on Informatics RIO 2012 Kim Larsen [31]

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!

Summer School on Informatics RIO 2012 Kim Larsen [35]

Optimal Infinite Scheduling

Minimize Energy Consumption:i.e. minimize Cost / Time in the long run

Summer School on Informatics RIO 2012 Kim Larsen [36]

Optimal Infinite Scheduling

Maximize throughput:i.e. maximize Reward / Cost in the long run

Summer School on Informatics RIO 2012 Kim Larsen [37]

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()

Summer School on Informatics RIO 2012 Kim Larsen [38]

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( )Summer School on Informatics RIO 2012 Kim Larsen [39]

Optimal Schedule : val( ) = inf val()

Soundness of Corner Point Abstraction

Summer School on Informatics RIO 2012 Kim Larsen [40]

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

Summer School on Informatics RIO 2012 Kim Larsen [41]

1

”Experimental” Results

COP15

Summer School on Informatics RIO 2012 Kim Larsen [42]

Energy Automata

Managing Resources

Summer School on Informatics RIO 2012 Kim Larsen [44]

Consuming & Harvesting Energy

Maximize throughputwhile respecting: 0 ≤ E ≤ MAX

Summer School on Informatics RIO 2012 Kim Larsen [45]

Energy Constrains

Energy is not only consumed but may also be regained The aim is to continously satisfy some energy constriants

Summer School on Informatics RIO 2012 Kim Larsen [46]

Results (early) Bouyer, Fahrenberg,Larsen, Markey, Srba:

FORMATS 2008

Bouyer, Fahrenberg,Larsen, Markey, Srba:

FORMATS 2008FORMATS 2008FORMATS 2008

Summer School on Informatics RIO 2012 Kim Larsen [47]

Discrete Updates on Edges

Thm [HSCC10]: Lower-bound problem is decidablefor linear and exponential 1-clock PTAs with

ti di t d tnegative discrete updates.

Summer School on Informatics RIO 2012 Kim Larsen [48]

Results (new) Fahrenberg,Juhl, Larsen, Legay, Srba:

ICTAC 2011

Fahrenberg,Juhl, Larsen, Legay, Srba:

ICTAC 2011ICTAC 2011ICTAC 2011

Summer School on Informatics RIO 2012 Kim Larsen [49]

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

Summer School on Informatics RIO 2012 Kim Larsen [50]

Summer School on Informatics RIO 2012 Kim Larsen [51]

New Approach: Energy Functions

Maximize energyalong paths

Use this information to solvegeneral problem

Summer School on Informatics RIO 2012 Kim Larsen [52]

Energy Function

General StrategySpend just enough timeto survive the next negativeto survive the next negativeupdate

Summer School on Informatics RIO 2012 Kim Larsen [53]

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:

Summer School on Informatics RIO 2012 Kim Larsen [54]

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.

Summer School on Informatics RIO 2012 Kim Larsen [55]