1 / 37

Scheduling Using Timed Automata

Selected Topics in Algorithms and Complexity (CSE960). Scheduling Using Timed Automata. Borzoo Bonakdarpour Wednesday, April 13, 2005. Based on. Y. Abdeddaim, O. Maler, Job-shop scheduling using timed automata , 2001

olisa
Download Presentation

Scheduling Using Timed Automata

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Selected Topics in Algorithms and Complexity (CSE960) SchedulingUsingTimed Automata Borzoo Bonakdarpour Wednesday, April 13, 2005

  2. Based on • Y. Abdeddaim, O. Maler, Job-shop scheduling using timed automata, 2001 • Y. Abdeddaim, O. Maler, Scheduling under uncertainty using timed automata, 2003 • Y. Abdeddaim, O. Maler, Task graph scheduling using timed automata, 2002 • 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. PART I TIMED AUTOMATA

  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 constraintsg 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. g, [] s0 s1 Timed Automata Formally, a timed automaton is a tuple <V, V0, VF, X, E> where V : set of locations, V0 : set of initial locations, VF : set of final locations, X : set of clocks, E (V   (X)  2X  V ) is a set of transitions. <s0, g, , s1> : • The stateof a real-time program is a pair (s, v) such that s is a location and v is a clock valuation for X.

  8. s0 x = 3 y = 1 s0 x = 4 y = 2 t = 1 s1 x = 0 y = 1.2 s0 x = 3 y = 1 [x := 0] Timed Automata (cont.) t 0 • Location switch: (s, v)  (s', v') where v' = v[:=0] Types of transitions: Elapse of time: (s, v)  (s, v + t1) • A run of the automaton is a finite sequence of transitions: •  = (s0, v0)  (s1, v1)  …  (sn, vn) t1 tn t2

  9. (y = 1)? (x < 1)? y := 0 (x < 1)? (x > 1)? Example s2 s0 s1 s3 Question: is s3 reachable via s2?

  10. PART II JOB-SHOP SCHEDULING

  11. Job-Shop Scheduling • M is a set of machines • Each jobJ 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 = {J1, J2, …, Jn} of jobs Ji= (ki, i, di) • 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 Ji 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  di(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 problemis to find a minimal length. It is known to be NP-hard.

  13. J1 J2 (a) m1 J1 J2 J1 m2 m1 9 J1 (b) m2 12 Example • M = {m1, m2} • J1 = (m1, 4), (m2, 5) • J2 = (m1, 3)

  14. m1 m2 m1 m2 J1 J1 m1 m2 m1 m2 J2 J2 m1 m1 J3 J3 (a) (b) 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.

  15. Job-shop Timed Automata • Constructing Job Timed Automaton (Ai)for each job Ji: • 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 constraintsis based on the duration of tasks

  16. J2 c1 := 0 c2 := 0 c1 4 c2 3 f c1 := 0 m1 m1 m2 m1 m1 m2 c1 5 f Example J1 M = {m1, m2} J1 = (m1, 4), (m2, 5) J2 = (m1, 3)

  17. Job-shop Timed Automata (cont.) • Constructing mutual exclusion composition (A) of the job timed automata • An n-tuple q = (q1, …, qn)  (M  M  {f})n is conflicting if it contains two components qa= qb = 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 Ai for all i

  18. J2 c2 := 0 c2 3 f J1 c2 := 0 c2 3 f m1 c1 := 0 c1 := 0 c1 := 0 m1, m1, m1 m1, f c1 4 c1 4 c1 4 c2 := 0 c2 3 m1 f c1 := 0 c1:= 0 c1 := 0 c1 := 0 m1 m2 m1 c2 := 0 c2 3 m1 m2, m1 m1, m2, m1, m1, m2 m1 m1 m2, m1 m1 m1 m2, m2, m1 m2, f f c1 5 c1 5 c1 5 c1 5 c2 := 0 c2 3 m2, f f, f f, Example

  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. Job-shop Timed Automata (cont.) • 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.

  21. m1 f m2 m1 m1 m1 m1 m1 m2, m1 m1, m1 m1, m2, m1 m1, m2, m1 m2 m2, m2, m1 m2, f f f, m1 f, f f, Example L(S1) = 9 L(S2) = 12 J2 c2 := 0 c2 3 f J1 c2 := 0 c2 3 m1 f c1 := 0 c1 := 0 c1 := 0 m1, m1, f c1 4 c1 4 c1 4 c2 := 0 c2 3 c1 := 0 c1 := 0 c1 := 0 c1 := 0 c2 := 0 c2 3 c1 5 c1 5 c1 5 c1 5 c2 := 0 c2 3

  22. PART III SCHEDULING UNDER UNCERTAINTY

  23. Scheduling Under Uncertainty • The duration of tasks is within an interval [l, u] • Example: J1 = (m1, 10) , (m3, [2, 4]) , (m4, 5) J2 = (m2, [2, 8]), (m3, 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. m1 m3 m4 J2 10 14 m2 m3 J1 21 8 (a) m1 m3 m4 m1 m3 m4 J2 J2 10 (2, 8) m2 10 m3 m2 m3 J1 J1 21 (b) 19 (c) Example (4, 8) J1 = (m1, 10) , (m3, [2, 4]) , (m4, 5) J2 = (m2, [2, 8]), (m3, 7)

  25. m1 m3 m4 m1 m3 m4 J1 J1 10 (4, 4) m2 m3 10 m2 m3 J2 J2 20 (c) 21 (b) Example J1 = (m1, 10) , (m3, [2, 4]) , (m4, 5) J2 = (m2, [2, 8]), (m3, 7)

  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): J1 = (m1, 10) , (m3, [2, 4]) , (m4, 5) J2 = (m2, [2, 8], 7) After terminations of m2 in J2 after 4 time: J1 ' = (m1, 6) , (m3, [2, 4]) , (m4, 5) J2' = (m3, 7)

  27. h(f, v) = 0 h(q, v) = min {t + h(q', v'): (q, v)  (q, v+t1)  (q', v') t 0 Uncertain Job-shop Automata • Generate job automata • Construct mutual exclusion composition • In the beginning of a run reset a global clock • 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:

  28. 7-c2+h(m4, f, c1+7- c2, ) 5-c1+h(f, m3, , c2+5- c1) min{ 7 c1 if c2  c1 2 5  c1if c2 c1 2 min{ Optimal Strategies for Timed Automata h(f, f, , ) = 0 h(m4, f, c1, ) = 5 – c1 h(m3, f, , c2) = 7 – c2 h(m4, m3, c1, c2) =

  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. PART VI TASK GRAPH SCHEDULING

  31. P2 P1 16 2 P6 P3 P4 2 6 16 P7 P5 2 8 Task Graph Scheduling • In task graph scheduling,we need to schedule tasks on a limited number of machines, while respecting the precedence constraints.

  32. c2 := 0 c1 := 0 c2= 16 c1= 1 p1 p2 c3 := 0  p1 c3= 6 p1 p2 p1 p2 p1 p3 p1 TGS Using Timed Automata • Generating the automata for each task

  33. p1 p4 f p5 p3 f p7 f p2 p6 p1 p5 p2 p3 p6 p7 p4 TGS Using Timed Automata (cont.) • Constructing chain covers H = {H1, H2, …, Hk} of (P, ) • Each chain Hi is linearly ordered • Hi Hj =  for all i  j • ikHi = P c1 := 0  p1 c1 := 0 c1= 2 c1 := 0  p3 c1= 16 c1= 16 c2 := 0 c2= 6 c2 := 0  p4 c2= 6 c2= 2 c2 := 0 c3 := 0  p1 c2= 2

  34. TGS Using Timed Automata (cont.) • Constructing mutual exclusion composition • Avoid global states with number of active tasks more the number of available machines • 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: • The execution times of tasks are uncertain. • A task can preempt another task. • 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

More Related