48
ULB, November 2004 As cheap as possible: Linearly Priced Timed Automata Gerd Behrmann, Ed Brinksma, Ansgar Fehnker, Thomas Hune, Kim Larsen, Paul Pettersson, Judi Romijn, Frits Vaandrager Brics Aalborg, Nijmegen, Twente, Uppsala, CMU, TERMA, TUE

ULB, November 2004 As cheap as possible: Linearly Priced Timed Automata Gerd Behrmann, Ed Brinksma, Ansgar Fehnker, Thomas Hune, Kim Larsen, Paul Pettersson,

Embed Size (px)

Citation preview

ULB, November 2004

As cheap as possible:

Linearly Priced Timed Automata

Gerd Behrmann, Ed Brinksma, Ansgar Fehnker, Thomas Hune, Kim Larsen, Paul Pettersson,

Judi Romijn, Frits Vaandrager

Brics Aalborg, Nijmegen, Twente, Uppsala,CMU, TERMA, TUE

ULB, November 2004

Observation (VHS project)

Many scheduling problems can be phrased in a natural way as reachability problems for timed automata.

Unsafe Safe

25min 20min10min 5min

Can they makeit within 60 minutes ?

Motivation

ULB, November 2004

unsafe

L==0

take!y:=0

y>=25

release!

L==1

take!y:=0

y>=25

release!

safe

Unsafe Safe

25min 20min10min 5min

Can they makeit within 60 minutes ?

What is the fastest schedule?

unsafeL==0take!y:=0

y>=20

release!

L==1

take!y:=0

y>=25

release!

safeunsafe

L==0take!y:=0

y>=5

release!

L==1

take!y:=0

y>=25

release!

safe

unsafeL==0take!y:=0

y>=10

release!

L==1

take!y:=0

y>=25

release!

safe

take?

release?

take?

release?

Motivation

What schedule minmizes unsafe

time?

What schedule minimizes bridge

crossings?

ULB, November 2004

Outline• Timed Automata (A review)• Linearly Priced Timed Automata

– A basic Algorithm– Efficient Data Structures

• Uniformly Priced Timed Automata– More efficient Data Structures

• Improved State-Space Exploration– Minimum-Cost Order Search, Estimates of Remaining Cost,

Heuristics

• Results– Bridge Problem– Job-Shop Problems– Aircraft Landing– others

• Conclusion

ULB, November 2004

• Network of Automata– Synchronization (CCS-like)

a! a?

Timed Automata(UPPAAL)

ULB, November 2004

a?y = 4

y:=0a!

3 < x < 7

x < 7

Timed Automata(UPPAAL)

• Network of Automata– Synchronization (CCS-like)

• Clocks in description– Time passes uniformly– Guard/reset on action- Invariants on location

• Infinitely many states!

ULB, November 2004

Regions (review)

An equivalence class (i.e. a region). In fact there is only a finite number of regions!!

x

y

1 2

3

1

2

Alur & Dill

x<3

y>2a b c

3x

y

3

1

2

x

3

1

2

y

1 2 3 1 2 3

{x:=0}

x<3

ULB, November 2004

x

3

1

2

Regions (review)

Transitions with and w/o reset and delay can be considered as transitions on regions!

y

1 2

Alur & Dill

x<3

y>2a b c

3x

3

1

2

y

x

3

1

2

y

1 2 3 1 2 3

x<3

{x:=0}

ULB, November 2004

Data Structures like DBMs, CDDs efficiency!

x

3

1

2

Zones (review)

Convex unions of regions are called zones.Delay, reset, transition in terms of zones

y

1 2

x<3

y>2

x<3

a b c

3x

3

1

2

y

x

3

1

2

y

1 2 3 1 2 3

{x:=0}

ULB, November 2004

Problem: Finding the minimum cost of reaching location c

Linearly Priced Timed Automata

• Timed Automata + Costs on transitions and locations– Cost of performing transition: Transition cost– Cost of performing delay d: ( d x location cost )

(a,x=y=0) (b,x=y=0) (b,x=y=2.5)(2.5)

(a,x=0,y=2.5)4 2.5 x 2 0

• Cost of Execution Trace: Sum of costs: 4 + 5 + 0 = 9

• Trace:

b

x<3

y>2

x<3

{x:=0}a c

cost’=1

cost+=4cost’=0

cost’=2

ULB, November 2004

Example: Aircraft Landing

cost

tE LT

E earliest landing timeT target timeL latest timee cost rate for being earlyl cost rate for being lated 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

ULB, November 2004

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 <= 9cost+=2

cost’=3 cost’=1

4 earliest landing time5 target time9 latest time3 cost rate for being early1 cost rate for being late2 fixed cost for being late

ULB, November 2004

Priced Regions

cost

1

2

3

4

5

ULB, November 2004

Priced Regions

cost

1

2

3

4

5

ULB, November 2004

x

y

1 2 3

1

2

costs

5

2

3

Priced Regions

cost

1

2

3

4

5

ULB, November 2004

An Algorithm• State-Space Exploration + Use of global variable

Cost• Updated Cost whenever goal state with min( C )

<Cost is found:

• Terminates when entire state-space is explored

80Cost=80Cost=80

60 Cost=60Cost=60

Cost=Cost=

ULB, November 2004

An AlgorithmCost:=, Pass := {}, Wait := {(l0,C0)}, Goal=

while Wait {} do select (l,C) from Wait

if (l,C) = and mincost(C)<Cost then Cost:=mincost(C) if forall (l,C’) in Pass: C’ C then

add (l,C) to Pass

forall (m,D) such that (l,C) (m,D):

add (m,D) to Wait

Return Cost

ULB, November 2004

An Algorithm

Performs: symbolic operations Delay, Conjun-ction, and Reset of clocks.

Cost:=, Pass := {}, Wait := {(l0,C0)}, Goal=

while Wait {} do select (l,C) from Wait

if (l,C) = and mincost(C)<Cost then Cost:=mincost(C) if forall (l’,C’) in Pass: C’ C then

add (l,C) to Pass

forall (m,D) such that (l,C) (m,D):

add (m,D) to Wait

Return Cost

ULB, November 2004

Cost:=, Pass := {}, Wait := {(l0,C0)}, Goal=

while Wait {} do select (l,C) from Wait

if (l,C) = and mincost(C)<Cost then Cost:=mincost(C) if forall (l’,C’) in Pass: C’ C then

add (l,C) to Pass

forall (m,D) such that (l,C) (m,D):

add (m,D) to Wait

Return Cost

: preorder that defines

“better” cost zones.

An Algorithm

3

2

5 4

3

5 3

2

6

ULB, November 2004

An AlgorithmCost:=, Pass := {}, Wait := {(l0,C0)}, Goal=

while Wait {} do select (l,C) from Wait

if (l,C) = and mincost(C)<Cost then Cost:=mincost(C) if forall (l’,C’) in Pass: C’ C then

add (l,C) to Pass

forall (m,D) such that (l,C) (m,D):

add (m,D) to Wait

Return Cost

ULB, November 2004

An Algorithm

Theorem

When the algorithm terminates, the value of COST equals mincost()

Theorem

The algorithm terminates

Can it be done efficiently?

ULB, November 2004

Outline• Timed Automata. (A review}• Linearly Priced Timed Automata

– A basic Algorithm– Efficient Data Structures

• Uniformly Priced timed Automata– More efficient Data Structures

• Improved State-Space Exploration– Minimum-Cost Order Search, Estimates of Remaining Cost,

Heuristics

• Results– Bridge Problem– Job-Shop Problems– Aircraft Landing– others

• Conclusion

ULB, November 2004

Priced ZonesBasic idea: Define a linear cost function on zones

cost=c+a x + a yx yx

y

BUT: Priced zones are not closed under delay, transitions, resets

ULB, November 2004

Priced ZonesBasic idea: Define a linear cost function on zones

cost=c+2 x – 1 y

x<3

y>2

x<3

{x:=0}a c

cost’=1

cost+=4cost’=0

cost’=2

b

x

y

BUT: Priced zones are not closed under delay, transitions, resets

cost=c’+2 x – 0 y

cost=c’’+3 x – 1 y

ULB, November 2004

Priced ZonesBasic idea: Define a linear cost function on zones

cost=c+2 x – 1 y

x<3

y>2

x<3

{x:=0}a c

cost’=1

cost+=4cost’=0

cost’=2

b

x

y

BUT: Priced zones are not closed under delay, transitions, resets

ULB, November 2004

Priced ZonesBasic idea: Define a linear cost function on zones

cost=c’+2 x – 2 y

x<3

y>2

x<3

{x:=0}a c

cost’=1

cost+=4cost’=0

cost’=2

b

x

y

BUT: Priced zones are not closed under delay, transitions, resets

cost=c’’+1 x – 1 y

ULB, November 2004

Priced ZonesBasic idea: Define a linear cost function on zones

x

y

BUT: Priced zones are not closed under delay, transitions, resets

cost=c+2 x – 1 y

x<3

y>2

x<3

{x:=0}a c

cost’=1

cost+=4cost’=0

cost’=2

b

cost=c’ – 1 y

cost=c’’ + 1 y

ULB, November 2004

Outline• Timed Automata. (A review}• Linearly Priced Timed Automata

– A basic Algorithm– Efficient Data Structures

• Uniformly Priced Timed Automata– More efficient Data Structures

• Improved State-Space Exploration– Minimum-Cost Order Search, Estimates of Remaining Cost,

Heuristics

• Results– Bridge Problem– Job-Shop Problems– Aircraft Landing– others

• Conclusion

ULB, November 2004

Unsafe Safe

25min 20min10min 5min

What is the fastest schedule ?

Uniformly Priced Timed Automata

UPTA are LPTA where all locations

have the same rate

ULB, November 2004

Uniformly Priced Timed Automata

UPTA are LPTA where all locations

have the same rate

Result

A small modification of the DBM-operations for ordinary timed automata is sufficient to solve cost (time) optimality

problems

ULB, November 2004

Outline• Timed Automata. (A review}• Linearly Priced Timed Automata

– A basic Algorithm– Efficient Data Structures

• Uniformly Priced Timed Automata– More efficient Data Structures

• Improved State-Space Exploration– Minimum-Cost Order Search, Estimates of Remaining Cost,

Heuristics

• Results– Bridge Problem– Job-Shop Problems– Aircraft Landing– others

• Conclusion

ULB, November 2004

Verification vs. Optimization• Verification Algorithms:

– Check a logical property of the entire state-space of a model

– Efficient blind search• Optimization Algorithms:

– Find (near) optimal solutions– Use techniques to avoid non-

optimal parts of the state-space (e.g. Branch and Bound)

• Objective: – Bridge the gap between these

two– New techniques and

applications in UPPAAL

80

60

Safe side reachable?Safe side reachable?

Min time of reaching safe side?Min time of reaching safe side?

ULB, November 2004

Minimum-Cost Order• The basic algorithm finds

the minimum cost trace• Breadth or Depth-first

search-order• Problem: Searches the

entirestate-space

• Minimum-Cost Search Order: Always explore state with smallest minimum cost first

ULB, November 2004

Minimum-Cost Order

Fact 1: First goal state found is optimal

• Cost grows along all paths• The search can terminate when first goal state

found• Like Dijkstra’s shortest path algorithm

Fact 2: No other search order explores fewer states

• Simpler algorithm: variable Cost no longer needed

ULB, November 2004

Estimates of Remaining Cost

• Often a conservative estimate of the remaining cost can be found

• REM( l, C ) = conservative estimate of remaining cost

• Bridge example: REM( l, C ) = time of slowest person on Unsafe side

At least 25 mins needed to complete schedule

ULB, November 2004

Estimates of Remaining Cost

• Basic Algorithm + Estimate of remaining cost:Only states with (min(C) + REM(l, C)) < Cost are further explored

Cost=80Cost=80

+ REM( l, C ) 80

min( C )

ULB, November 2004

Estimates of Remaining Cost

• Minimum Cost + Estimate of remaining cost:Explore states with smallest ( min(C) + REM( l, C ) ) first

Cost=80Cost=80

+ REM( l, C ) 80

min( C )

• Basic Algorithm + Estimate of remaining cost:Only states with (min(C) + REM(l, C)) < Cost are further explored

ULB, November 2004

Using Heuristics

• Allows the users to control the search order according to heuristics

• Symbolic states extended to (l, C, h), whereh is the priority of a state

• Transitions are annotated with assignments to h• Flexible!

Basic Algorithm + Heuristics: State with highest h is explored first

ULB, November 2004

Using Heuristics

Try to schedule planes in the order of their preferred landing times

ULB, November 2004

Outline• Timed Automata. (A review}• Linearly Priced Timed Automata

– A basic Algorithm– Efficient Data Structures

• Uniformly Priced Timed Automata– More efficient Data Structures

• Improved State-Space Exploration– Minimum-Cost Order Search, Estimates of Remaining Cost,

Heuristics

• Results– Bridge Problem– Sidmar– Aircraft Landing– others

• Conclusion

ULB, November 2004

Example: Bridge Problem

• Number of symbolic states generated with cost-extended version of UPPAAL

• Minimum Cost Order + Estimate of Remaining cost<10% of Breadth-First Search

BF = Breadth-First, DF = Depth-First, MC = Minimum Cost Order, MC+ = MC + REM

What is the fastest schedule?

ULB, November 2004

Machine 1 Machine 2 Machine 3

Machine 4 Machine 5

Buffer

Continuos Casting Machine

Storage Place

Crane B

Crane A

• A. Fehnker [RTCSA99], T. Hune, K. G. Larsen, P. Pettersson [DSV00]• Case study of Esprit-LTR

project 26270 VHS• Physical plant of SIDMAR

located in Gent, Belgium• Part between blast furnace and

hot rolling mill

Objective: model the plant, obtain schedule and control program for plant

Lane 1

Lane 2

SIDMAR Steel Production Plant

ULB, November 2004

Machine 1 Machine 2 Machine 3

Machine 4 Machine 5

Buffer

Continuos Casting Machine

Storage Place

Crane B

Crane A

Input: sequence of steel loads (“pigs”) @10 @20 @10

@10

@40

Load follows Recipe to

obtain certain quality, e.g:

start; T1@10; T2@20;

T3@10; T2@10;

end within 120

Output: sequence of higher quality steel.

Lane 1

Lane 2

2 2 2

15

16

=127

SIDMAR Steel Production Plant

Optimal schedules for ten batches using guiding with priorities. Only for two batches without

ULB, November 2004

Aircraft Landing Problem

runways

Bench

mark

by B

easl

ey e

t al 2

00

0

ULB, November 2004

Advantages• Easy and flexible modeling of systems• Whole range of verification techniques becomes available• Controller/Program synthesis

Disadvantages• Existing scheduling approaches (still) perform somewhat better

Our goal• See how far we get• Integrate model checking and scheduling theory• New discipline of Timing Technology?

EU IST project Ametist

Conclusion

ULB, November 2004

Conclusion• Papers:

– Efficient Guiding Towards Cost-Optimality in UPPAAL [TACAS’01]– Minimum Cost-Reachability for Priced Timed Automata [HSCC’01]– As Cheap as Possible: Efficient Cost-Optimal Reachability for

Priced Timed Automata [CAV’01]– Citius, Vilius, Melius: Guiding and Cost-Optimality in Model

Checking of Timed and Hybrid Systems, PhD Thesis Ansgar Fehnker, University of Nijmegen, April 2002

•Tool:

–UPPAAL CORA!!

ULB, November 2004

End of slide show

ULB, November 2004

THE END