Download presentation
Presentation is loading. Please wait.
1
Scheduling Using Timed Automata Borzoo Bonakdarpour Wednesday, April 13, 2005 Selected Topics in Algorithms and Complexity (CSE960)
2
Based on 1.Y. Abdeddaim, O. Maler, Job-shop scheduling using timed automata, 2001 2.Y. Abdeddaim, O. Maler, Scheduling under uncertainty using timed automata, 2003 3.Y. Abdeddaim, O. Maler, Task graph scheduling using timed automata, 2002 4.Krac, Wi, Decidable and undecidable problem in scheduling analysis using timed automata, 2004
3
Outline Preliminaries: –Timed automata –Job-Shop Scheduling Job-Shop Scheduling Using Timed Automata Scheduling under Uncertainty Task Graph Scheduling Decidable and Undecidable Problems Discussion & Future Work
4
TIMED AUTOMATA PART I
5
Preliminaries Timed automata is traditional finite state automata equipped with clock variables and timing constraints. It has been accepted as the standard formalism to model real- time programs. Initially, it was introduced for model checking and verification, but has been recently used for program synthesis and scheduling.
6
Clock Variables For a set X of clocks, the set (X) of clock constraints g is defined by the grammar: g := x c | c x | x < c | c < x | g g where x X and c Q is a rational number. A clock valuation is a function v : X R v(x) is the value of clock variable x. All clock values increase with the same speed. u = v[Y := 0] for Y X is a clock valuation for X such that x Y: v(x) = 0 Agrees with v over the rest of the clocks.
7
Timed Automata Formally, a timed automaton is a tuple where – V : set of locations, – V 0 : set of initial locations, – V F : set of final locations, – X : set of clocks, – E (V (X) 2 X V ) is a set of transitions. s0s0 g, [ ] s1s1 The state of a real-time program is a pair (s, v) such that s is a location and v is a clock valuation for X. :
8
Timed Automata (cont.) Types of transitions: – Elapse of time: (s, v) (s, v + t1) s 0 x = 3 y = 1 s 0 x = 4 y = 2 t = 1 s 0 x = 3 y = 1 s 1 x = 0 y = 1.2 [ x := 0 ] – Location switch: (s, v) (s', v ' ) where v ' = v[ :=0] 0 t A run of the automaton is a finite sequence of transitions: = (s 0, v 0 ) (s 1, v 1 ) … (s n, v n ) t1t1 tntn t2t2
9
Example s2s2 s3s3 s1s1 s0s0 y := 0 (y = 1)?(x < 1)? (x > 1)? (x < 1)? Question: is s 3 reachable via s 2 ?
10
JOB-SHOP SCHEDULING PART II
11
Job-Shop Scheduling M is a set of machines Each job J is a triple (k, , d) where –k N, the number of tasks – : {1..k} M, assignment of machines to tasks –d : {1..k} N, duration of every task A job-shop specification is a set J = {J 1, J 2, …, J n } of jobs J i = (k i, i, d i ) Assumptions: –A job can wait arbitrary amount of time between two tasks –No preemption
12
Schedules A feasible schedule for J is a relation S J K T so that (i, j, t) S indicates that job J i is busy doing jth task at time t, which satisfies: –Ordering: (i, j, t) S and (i, j ', t ' ) S then j < j ' implies t < t ' –Covering & No preemption: For all i, j the set {t: (i, j, t) S} is nonempty and in the form [r, r + d] and d d i (j) –Mutual exclusion: (i, j, t) S and (i ', j ', t) S then i (j) i’ (j ' ) The length of a schedule is the maximal t over all (i, j, t) S The optimal job-shop scheduling problem is to find a minimal length. It is known to be NP-hard.
13
Example M = {m 1, m 2 } J 1 = (m 1, 4), (m 2, 5) J 2 = (m 1, 3) 12 m1m1 m2m2 J1J1 J2J2 J1J1 (b) 9 m1m1 m2m2 J1J1 J2J2 J1J1 (a)
14
Laziness A schedule S is lazy at task j of job i if immediately before starting that task there an interval in which both the job and the corresponding machine are idle. J1J1 J2J2 m1m1 m2m2 m1m1 m2m2 J3J3 m1m1 (a) J1J1 J2J2 m1m1 m2m2 m1m1 m2m2 J3J3 m1m1 (b)
15
Job-shop Timed Automata 1.Constructing Job Timed Automaton ( A i ) for each job J i : One clock that represents the elapse of time for each task. Two states for each task j such that (j) = m m: indicates that the task is waiting to start on machine m m: indicates that the task is executing on machine m Timing constraints is based on the duration of tasks
16
Example m1m1 M = {m 1, m 2 } J 1 = (m 1, 4), (m 2, 5) J 2 = (m 1, 3) m1m1 c 1 := 0 m2m2 c 1 4 m2m2 c 1 := 0 f c 1 5 J1J1 m1m1 m1m1 c 2 := 0 f c 2 3 J2J2
17
2.Constructing mutual exclusion composition ( A ) of the job timed automata An n-tuple q = (q 1, …, q n ) (M M {f}) n is conflicting if it contains two components q a = q b = m M We compose the individual job timed automata such that in the final timed automaton Does not contain conflicting states Every transition of A satisfies the properties of A i for all i Job-shop Timed Automata (cont.)
18
Example m1m1 m1m1 c 1 := 0 m2m2 c 1 4 m2m2 c 1 := 0 f c 1 5 J1J1 m1m1 m1m1 c 2 := 0 f c 2 3 J2J2 m1,m1,m1m1 m1,m1,m1m1 m1,m1,f m1m1 m1,m1,m 1, m 1 m 1, f m2,m2,m1m1 m2,m2,m1m1 m2,m2,f m1m1 m2,m2,m 2, m 1 m 2, f m1m1 f,f, f, f c 2 := 0 c 2 3 c 1 := 0 c 1 4 c 1 := 0 c 1 5 c 2 := 0 c 2 3 c 1 4 c 1 := 0 c 1 5 c 2 := 0 c 2 3 c 2 := 0 c 1 5 c 1 := 0
19
Schedules and Runs A run is complete if it starts at (s, 0) and ends in f. Theorem1: If A is a job-shop timed automaton for J then: For every complete run of A, its associated schedule S corresponds to a feasible schedule for J. For every feasible schedule S for J, there is a run of A such that S = S and if S is non-lazy so is . Theorem2: The optimal job-shop scheduling problem can be reduced to the problem of finding the shortest non-lazy path in a timed automata
20
3.Finding the shortest non-lazy path The job-shop timed automaton is acyclic Reachability problem for cyclic timed automata is PSPACE-complete. Reachability problem for acyclic timed automata is NP-complete. There exist efficient algorithms that find the shortest path in a timed automaton. Job-shop Timed Automata (cont.)
21
Example m1m1 m1m1 c 1 := 0 m2m2 c 1 4 m2m2 c 1 := 0 f c 1 5 J1J1 m1m1 m1m1 c 2 := 0 f c 2 3 J2J2 m1,m1,m1m1 m1,m1,m1m1 m1,m1,f m1m1 m1,m1,m 1, f m2,m2,m1m1 m2,m2,m1m1 m2,m2,f m1m1 m2,m2,m 2, m 1 m 2, f m1m1 f,f,f, m 1 f, f c 2 := 0 c 2 3 c 1 := 0 c 1 4 c 1 := 0 c 1 5 c 2 := 0 c 2 3 c 1 4 c 1 := 0 c 1 5 c 2 := 0 c 2 3 c 2 := 0 c 1 5 c 1 := 0 L(S 1 ) = 9 L(S 2 ) = 12
22
SCHEDULING UNDER UNCERTAINTY PART III
23
Scheduling Under Uncertainty The duration of tasks is within an interval [l, u] Example: J 1 = (m 1, 10), (m 3, [2, 4]), (m 4, 5) J 2 = (m 2, [2, 8]), (m 3, 7) How can we design a scheduling policy? –Follow the worst case schedule in both time and ordering –Follow only the ordering of tasks as soon as a machine is available. –Design a scheduling strategy.
24
Example J 1 = (m 1, 10), (m 3, [2, 4]), (m 4, 5) J 2 = (m 2, [2, 8]), (m 3, 7) 21 m1m1 m3m3 J1J1 J2J2 (b) m4m4 m2m2 m3m3 10 (2, 8) 21 m1m1 m3m3 J1J1 J2J2 (a) m4m4 m2m2 m3m3 1014 8 (4, 8) 19 m1m1 m3m3 J1J1 J2J2 (c) m4m4 m2m2 m3m3 10
25
Example J 1 = (m 1, 10), (m 3, [2, 4]), (m 4, 5) J 2 = (m 2, [2, 8]), (m 3, 7) (4, 4) 20 m1m1 m3m3 J2J2 J1J1 (c) m4m4 m2m2 m3m3 10 21 m1m1 m3m3 J2J2 J1J1 (b) m4m4 m2m2 m3m3 10
26
Dynamic Scheduling What was the problem?! Instead of following a static schedule, whenever a task terminates, we reschedule the residual problem. Example (4, 8):J 1 = (m 1, 10), (m 3, [2, 4]), (m 4, 5) J 2 = (m 2, [2, 8], 7) After terminations of m 2 in J 2 after 4 time: J 1 ' = (m 1, 6), (m 3, [2, 4]), (m 4, 5) J 2 ' = (m 3, 7)
27
Uncertain Job-shop Automata 1.Generate job automata 2.Construct mutual exclusion composition 3.In the beginning of a run reset a global clock 4.Upon termination of a task formulate the residual problem by calculating the length of runs from the current state (q, v) to (f, v) using backward reachability. This can be done in polynomial time: h(f, v) = 0 h(q, v) = min {t + h(q ', v ' ): (q, v) (q, v+t1) (q ', v ' ) t0
28
Optimal Strategies for Timed Automata h(f, f, , ) = 0 h(m 4, f, c 1, ) = 5 – c 1 h(m 3, f, , c 2 ) = 7 – c 2 h(m 4, m 3, c 1, c 2 ) = min { 7-c 2 +h(m 4, f, c 1 +7- c 2, ) 5-c 1 +h(f, m 3, , c 2 +5- c 1 ) min { 7 c 1 if c 2 c 1 2 5 c 1 if c 2 c 1 2
29
Final Analysis Question: Is this a game?! Theorem: The problem of finding optimal strategies for job- shop scheduling under uncertainty is solvable using timed automata reachability algorithms.
30
TASK GRAPH SCHEDULING PART VI
31
Task Graph Scheduling In task graph scheduling, we need to schedule tasks on a limited number of machines, while respecting the precedence constraints. P1P1 P6P6 P4P4 P3P3 P7P7 P5P5 P2P2 162 2 2 8 6
32
TGS Using Timed Automata 1.Generating the automata for each task p1p1 p1p1 c 1 := 0 p1p1 c 1 = 1 p3p3 p1p1 c 3 := 0 p 1 p1p1 c 3 = 6 p2p2 p2p2 c 2 := 0 p2p2 c 2 = 16
33
TGS Using Timed Automata (cont.) 2.Constructing chain covers H = {H 1, H 2, …, H k } of ( P, ) –Each chain H i is linearly ordered –H i H j = for all i j – i k H i = P p2p2 p2p2 c 1 := 0 c 1 = 16 p6p6 p6p6 p7p7 p7p7 f c 1 = 2c 1 = 16 c 1 := 0 p 1 c 1 := 0 p 3 p1p1 p1p1 c 2 := 0 c 2 = 2 p3p3 p3p3 p5p5 p5p5 f c 2 = 6 c 2 := 0 c 2 := 0 p 4 p4p4 p4p4 c 3 := 0 p 1 c 2 = 2 f
34
TGS Using Timed Automata (cont.) 3.Constructing mutual exclusion composition –Avoid global states with number of active tasks more the number of available machines 4.Find the shortest path
35
Decidable and Undecidable Problems A large class of schedulability problems are decidable It has been shown that the schedulability is undecidable if three conditions hold: 1.The execution times of tasks are uncertain. 2.A task can preempt another task. 3.A task can announce its completion time.
36
Open Problems Modeling other types scheduling (minimum makespan, minimum completion time) using timed automata Designing approximation algorithms
37
Questions & Comments
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.