Lecture 5 Scheduling Scheduling Scheduling Planning What to

  • Slides: 30
Download presentation
Lecture 5 Scheduling

Lecture 5 Scheduling

Scheduling

Scheduling

Scheduling Planning: What to do and in what order Scheduling: When to do required

Scheduling Planning: What to do and in what order Scheduling: When to do required actions (given required resources) § Assume we have a partial ordering of actions required to achieve our goals. § Total orders need to be relaxed. (We will not cover this. ) § Actions have: § Duration § Required consumable resources § Required durable/reusable resources § Initial state has a specification of available resources. § The task of scheduling is to provide an optimal schedule for the performance of the required actions. Optimal may be in terms of time (generally shortest) or resources (generally minimal use) or both.

Our Example Continued. . . Go Shopping Initial state Make Cake Eat Cake Wait

Our Example Continued. . . Go Shopping Initial state Make Cake Eat Cake Wait Goal Go Shopping Make Cake Action Consumes Uses Duration Go Shopping -1 Mix 1 Mike 20 min Wait - - 60 min Make Cake 1 Mix, -1 Cake 1 Oven 30 min Eat Cake 1 Mike 10 min

Resource-Free Scheduling §

Resource-Free Scheduling §

Our Example Continued. . . Go Shopping Initial state ES=0 Make Cake Eat Cake

Our Example Continued. . . Go Shopping Initial state ES=0 Make Cake Eat Cake Wait Goal Go Shopping Make Cake Action Consumes Uses Duration Go Shopping -1 Mix 1 Mike 20 min Wait - - 60 min Make Cake 1 Mix, -1 Cake 1 Oven 30 min Eat Cake 1 Mike 10 min

Our Example Continued. . . Go Shopping Initial state ES=0 Make Cake ES=0=0+0 Eat

Our Example Continued. . . Go Shopping Initial state ES=0 Make Cake ES=0=0+0 Eat Cake Wait Goal Go Shopping Make Cake Action Consumes Uses Duration Go Shopping -1 Mix 1 Mike 20 min Wait - - 60 min Make Cake 1 Mix, -1 Cake 1 Oven 30 min Eat Cake 1 Mike 10 min

Our Example Continued. . . Go Shopping Initial state ES=0 Make Cake ES=0 Eat

Our Example Continued. . . Go Shopping Initial state ES=0 Make Cake ES=0 Eat Cake Wait ES=0=0+0 Go Shopping Goal Make Cake ES=0=0+0 Action Consumes Uses Duration Go Shopping -1 Mix 1 Mike 20 min Wait - - 60 min Make Cake 1 Mix, -1 Cake 1 Oven 30 min Eat Cake 1 Mike 10 min

Our Example Continued. . . Go Shopping Initial state ES=0 Make Cake ES=20=0+20 Eat

Our Example Continued. . . Go Shopping Initial state ES=0 Make Cake ES=20=0+20 Eat Cake Wait ES=0 Go Shopping Goal Make Cake ES=0 Action Consumes Uses Duration Go Shopping -1 Mix 1 Mike 20 min Wait - - 60 min Make Cake 1 Mix, -1 Cake 1 Oven 30 min Eat Cake 1 Mike 10 min

Our Example Continued. . . Go Shopping Initial state ES=0 Make Cake ES=20 Eat

Our Example Continued. . . Go Shopping Initial state ES=0 Make Cake ES=20 Eat Cake Wait ES=60=0+60 ES=0 Go Shopping ES=0 Make Cake ES=20 Action Consumes Uses Duration Go Shopping -1 Mix 1 Mike 20 min Wait - - 60 min Make Cake 1 Mix, -1 Cake 1 Oven 30 min Eat Cake 1 Mike 10 min Goal

Our Example Continued. . . Go Shopping Initial state ES=0 Make Cake ES=20 Eat

Our Example Continued. . . Go Shopping Initial state ES=0 Make Cake ES=20 Eat Cake Wait ES=60 ES=0 Go Shopping ES=0 Goal Make Cake ES=70=60+10 ES=20 Action Consumes Uses Duration Go Shopping -1 Mix 1 Mike 20 min Wait - - 60 min Make Cake 1 Mix, -1 Cake 1 Oven 30 min Eat Cake 1 Mike 10 min

Our Example Continued. . . Go Shopping Initial state ES=0 Make Cake ES=20 Eat

Our Example Continued. . . Go Shopping Initial state ES=0 Make Cake ES=20 Eat Cake Wait ES=60 ES=0 Go Shopping ES=0 Goal Make Cake ES=70, LS=70 ES=20 Action Consumes Uses Duration Go Shopping -1 Mix 1 Mike 20 min Wait - - 60 min Make Cake 1 Mix, -1 Cake 1 Oven 30 min Eat Cake 1 Mike 10 min

Our Example Continued. . . Go Shopping Initial state ES=0 Make Cake ES=20 Eat

Our Example Continued. . . Go Shopping Initial state ES=0 Make Cake ES=20 Eat Cake Wait ES=60, ES=0 Go Shopping ES=0 Make Cake Goal LS=60=70 -10 ES=20 Action Consumes Uses Duration Go Shopping -1 Mix 1 Mike 20 min Wait - - 60 min Make Cake 1 Mix, -1 Cake 1 Oven 30 min Eat Cake 1 Mike 10 min ES=70, LS=70

Our Example Continued. . . Go Shopping Initial state ES=0 Wait Make Cake ES=20,

Our Example Continued. . . Go Shopping Initial state ES=0 Wait Make Cake ES=20, LS=30=60 -30 ES=60, LS=60 ES=0 Go Shopping ES=0 Eat Cake Make Cake Goal ES=70, LS=70 ES=20 Action Consumes Uses Duration Go Shopping -1 Mix 1 Mike 20 min Wait - - 60 min Make Cake 1 Mix, -1 Cake 1 Oven 30 min Eat Cake 1 Mike 10 min

Our Example Continued. . . Go Shopping Initial state ES=0 Make Cake ES=20, LS=30

Our Example Continued. . . Go Shopping Initial state ES=0 Make Cake ES=20, LS=30 Eat Cake Wait ES=60, LS=60 ES=0 Go Shopping ES=0 Make Cake Goal ES=70, LS=70 ES=20, LS=40=70 -30 Action Consumes Uses Duration Go Shopping -1 Mix 1 Mike 20 min Wait - - 60 min Make Cake 1 Mix, -1 Cake 1 Oven 30 min Eat Cake 1 Mike 10 min

Our Example Continued. . . Go Shopping Initial state ES=0 Make Cake ES=0, LS=10=30

Our Example Continued. . . Go Shopping Initial state ES=0 Make Cake ES=0, LS=10=30 -10 ES=20, LS=30 Eat Cake Wait ES=60, LS=60 ES=0 Go Shopping ES=0 Make Cake Goal ES=70, LS=70 ES=20, LS=40 Action Consumes Uses Duration Go Shopping -1 Mix 1 Mike 20 min Wait - - 60 min Make Cake 1 Mix, -1 Cake 1 Oven 30 min Eat Cake 1 Mike 10 min

Our Example Continued. . . Go Shopping Initial state ES=0, LS=10 Make Cake ES=20,

Our Example Continued. . . Go Shopping Initial state ES=0, LS=10 Make Cake ES=20, LS=30 Eat Cake Wait ES=60, LS=60 ES=0, LS=0=60 -60 Go Shopping ES=0 Make Cake Goal ES=70, LS=70 ES=20, LS=40 Action Consumes Uses Duration Go Shopping -1 Mix 1 Mike 20 min Wait - - 60 min Make Cake 1 Mix, -1 Cake 1 Oven 30 min Eat Cake 1 Mike 10 min

Our Example Continued. . . Go Shopping Initial state ES=0, LS=10 Make Cake ES=20,

Our Example Continued. . . Go Shopping Initial state ES=0, LS=10 Make Cake ES=20, LS=30 Eat Cake Wait ES=60, LS=60 ES=0, LS=0 Go Shopping Make Cake Goal ES=70, LS=70 ES=0, LS=20=40 -20 ES=20, LS=40 Action Consumes Uses Duration Go Shopping -1 Mix 1 Mike 20 min Wait - - 60 min Make Cake 1 Mix, -1 Cake 1 Oven 30 min Eat Cake 1 Mike 10 min

Our Example Continued. . . Go Shopping Initial state ES=0, LS=0 ES=0, LS=10 Make

Our Example Continued. . . Go Shopping Initial state ES=0, LS=0 ES=0, LS=10 Make Cake ES=20, LS=30 Eat Cake Wait ES=60, LS=60 ES=0, LS=0 Go Shopping ES=0, LS=20 Make Cake Goal ES=70, LS=70 ES=20, LS=40 Action Consumes Uses Duration Go Shopping -1 Mix 1 Mike 20 min Wait - - 60 min Make Cake 1 Mix, -1 Cake 1 Oven 30 min Eat Cake 1 Mike 10 min

Our Example Continued. . . Go Shopping Initial state ES=0, LS=10 Make Cake ES=20,

Our Example Continued. . . Go Shopping Initial state ES=0, LS=10 Make Cake ES=20, LS=30 ES=60, LS=60 ES=0, LS=20 The critical path is the path from origin to goal where all nodes have slack=0 Eat Cake Wait Go Shopping Slack= LS-ES Make Cake Goal ES=70, LS=70 ES=20, LS=40 Action Consumes Uses Duration Go Shopping -1 Mix 1 Mike 20 min Wait - - 60 min Make Cake 1 Mix, -1 Cake 1 Oven 30 min Eat Cake 1 Mike 10 min

Priority based scheduling with resource constraints 1. Set T (Start)=0. 2. Select highest priority

Priority based scheduling with resource constraints 1. Set T (Start)=0. 2. Select highest priority action from those whose predecessors have had their T scheduled, set its T as early as possible given resource constraints. When doing so, record which resources used and effects on consumed resources. 3. Repeat step 2 until all actions T scheduled. What should our priority function be? One idea: Minimum slack § We prioritize actions based on their slack (LS-ES) in the resource free schedule. We can redo the resource free algorithm, given (resource constrained) scheduled actions at each iteration of this algorithm.

Initial state TIME: 0 Mike Oven Cakes 0 Mixes 0

Initial state TIME: 0 Mike Oven Cakes 0 Mixes 0

Initial state TIME: 0 Mike Oven Cakes 0 Mixes 0

Initial state TIME: 0 Mike Oven Cakes 0 Mixes 0

Initial state TIME: Wait 0 60 Cakes 0 0 Mixes 0 0 Mike Oven

Initial state TIME: Wait 0 60 Cakes 0 0 Mixes 0 0 Mike Oven

Initial state Wait Shop TIME: 0 20 60 Cakes 0 0 0 Mixes 0

Initial state Wait Shop TIME: 0 20 60 Cakes 0 0 0 Mixes 0 1 1 Mike Oven

Initial state Wait Make Shop TIME: 0 20 50 60 Cakes 0 0 1

Initial state Wait Make Shop TIME: 0 20 50 60 Cakes 0 0 1 1 Mixes 0 (1) 0 0 0 Mike Oven

Initial state Wait Make Shop TIME: Eat 0 20 50 60 70 Cakes 0

Initial state Wait Make Shop TIME: Eat 0 20 50 60 70 Cakes 0 0 1 (1) 0 0 Mixes 0 (1) 0 0 0 Mike Oven 0

Initial state Wait Eat Make Shop TIME: 0 20 40 50 60 70 Cakes

Initial state Wait Eat Make Shop TIME: 0 20 40 50 60 70 Cakes 0 0 0 1 (1) 0 0 Mixes 0 (1) 0 1 1 1 Mike Oven 1

Initial state Wait Eat Make Shop TIME: 0 20 40 50 60 70 80

Initial state Wait Eat Make Shop TIME: 0 20 40 50 60 70 80 Cakes 0 0 0 1 (1) 0 0 1 Mixes 0 (1) 0 1 0 0 0 Mike Oven 0

Scheduling with Resources § Resource Free times are lowest bounds only. § Minimum slack

Scheduling with Resources § Resource Free times are lowest bounds only. § Minimum slack algorithm is not always optimal. § No scalable optimal algorithm exists. (As far as I know. )