Presentation is loading. Please wait.

Presentation is loading. Please wait.

Scheduling Theory By Sarah Walker 12/4/2018.

Similar presentations


Presentation on theme: "Scheduling Theory By Sarah Walker 12/4/2018."— Presentation transcript:

1 Scheduling Theory By Sarah Walker 12/4/2018

2 Introduction to Scheduling
Scheduling is used to arrange, coordinate and plan the utilization of resources to achieve an objective. In today’s world, time is a scarce commodity, so making the best of it can be very important. It can also be useful to look at other things we might be interested in getting the most possible use out of: Cash flow Manpower Space For our purposes, we will mostly be concerned with time management. Scheduling can be difficult because currently there are no algorithms that guarantee optimization. 12/4/2018

3 Definitions Processor – someone (or something) who does the work for a given task. Denoted where N is the number of processors. Task – indivisible amount of work that is by nature carried out by a single processor. At any time during a project, a task will be in any the four following states: Ineligible – the task cannot be started at this time Ready – the task could be started at this time In execution – the task is currently being carried out by a processor Completed. 12/4/2018

4 More Definitions Processing time – the amount of time it takes one processor to complete a given task. We will assume that all processors have the same processing time for a task Precedence relations – if task X precedes task Y (abbreviated X Y), then task Y cannot be started until task X is completed. Example: you can’t put your shoes on before you put your socks on. Two tasks are considered independent if there are no precedence relations between them. The finishing time for a project is the duration from the start of the first task to the end of the last task. 12/4/2018

5 Using Digraphs To Represent Precedence Relations
Create a vertex for each task. Give each task a label using capital letters. Put the tasks’ processing times in parenthesis after its label. Draw an arc between them based on their given precedence relation. 12/4/2018

6 An Important Note Precedence relations cannot form a cycle.
Trying to schedule these four tasks would be impossible. Y X Z W 12/4/2018

7 Example 1 Let’s assume we want to build a habitat on mars using two processors, P1 and P2, and we are given the tasks and precedence relations that appear in the following two tables: 12/4/2018

8 Symbol (Processing Time)
Example 1 (continued) Precedence Relations Task Symbol (Processing Time) Assemble Pad AP (7) Assemble Flooring AF (5) Assemble Wall Units AW (6) Assemble Dome Frame AD (8) Install Floors IF (5) Install Interior Walls IW (7) Install Dome Frame ID (5) Plumbing PL (4) Install Atomic Power Plant IP (4) Install Pressurization Unit PU (3) Install Heating Units HU (4) Install Commode IC (1) Interior Finish Work FW (6) Pressurize Dome PD (3) Install Entertainment Unit EU (2) 12/4/2018

9 Example 1 (continued) Given the preceding information, we can draw the following digraph: The tasks labeled START and END are not real tasks, they are added for our convenience It is now easy to visualize the project as a flow that begins at START and concludes at END. We give these fictitious tasks processing times of zero, so they don’t affect time calculations for the project. START (0) AP(7) AF(5) AW(6) AD(8) IF(5) IW(7) ID(5) PL(4) IP(4) PU(3) IC(1) HU(4) EU(2) PD(3) FW(6) END (0) 12/4/2018

10 The Priority List Model
A project digraph is a great to describe the information we have, but we need something that tells us how to make a schedule. To do this, we make a priority list in which we put the tasks in order of their priority of execution. If task X comes before task Y in the priority list, we should try to accomplish X before Y. 12/4/2018

11 Example 2: Launching a Satellite
Suppose we are launching a satellite that has five different system checks that need to be done by two different computers P1 and P2. We will call the system checks A(6), B(5), C(7), D(2), and E(5). Now assume the priority list is in reverse alphabetical order, so the precedence relations are given by the following digraph: Priority List: E(5), D(2), C(7), B(5), A(6) START (0) END (0) A(6) B(5) C(7) D(2) E(5) 12/4/2018

12 A Helpful Hint When creating a schedule, it can be helpful to update your priority list as you go by using these symbols: X Task X is ready. X Task X is in execution. X Task X is completed. X Task X is ineligible. 12/4/2018

13 Example 2 (continued) Priority List: E(5), D(2), C(7), B(5), A(6)
START (0) END (0) A(6) B(5) C(7) D(2) E(5) Priority List: E(5), D(2), C(7), B(5), A(6) Time T=0 hr (start of project). C(7), B(5), and A(6) are the only ready tasks. Following the priority list, we assign C(7) to P1, and B(5) P2. Time T=5 hr. P1 is still busy with C(7); P2 has just completed B(5). A(6) is the only available ready task. We assign A(6) to P2. Time T=7 hr. P1 has just completed C(7); P2 is busy with A(6). E(5) has just become a ready task. We assign E(5) to P1. Time T=11 hr. P2 has just completed A(6); P1 is busy with E(5). D(2) has just become ready, so we assign D(2) to P2. Time T=12 hr. P1 has just completed E(5); P2 is busy with D(2). There are no tasks left, so P1 sits idle. Time T=13 hr. P2 has just completed the last task, D(2). The project is complete. Finishing time is 13 hours. 12/4/2018

14 We end up with the following schedule:
Example 2 (continued) We end up with the following schedule: Time: C(7) E(5) Idle B(5) A(6) D(2) 12/4/2018

15 Decreasing-Time Algorithm
It seems logical that doing the longer tasks first may result in more optimal scheduling, so we consider the decreasing-time algorithm. In this algorithm, we simply create a priority list in which the longest task comes first, then the second longest, and so on. We then use that priority list to make a schedule. 12/4/2018

16 Decreasing-Time Algorithm (continued)
In most cases however, the decreasing-time algorithm does not yield an optimal schedule. It can be much more efficient to look at the long term benefits of starting a task early in a project. 12/4/2018

17 Critical Paths The critical path for a vertex X is the path from X to END that has the longest total processing time. Let’s go back to the Martian Habitat example: Consider the vertex HU. There are three paths from HU to END. (i) HU, IC, FW, END ---- processing time is 11 (ii) HU, PD, END ---- processing time is 7 (iii) HU, EU, END ---- processing time is 6 AP(7) AF(5) IF(5) PL(4) IC(1) FW(6) AW(6) IW(7) IP(4) PD(3) HU(4) START (0) END (0) AD(8) ID(5) PU(3) EU(2) So, the critical path for HU is HU, IC, FW, END, and its critical time is 11. 12/4/2018

18 Backflow Algorithm Finding critical paths using this method can become quite tedious in projects with a lot of tasks, so we use an algorithm called the backflow algorithm. The algorithm moves backward from END to START building a critical path as it goes. If we know the critical times for all the vertices “in front” of a vertex X, we choose among these the vertex with the largest critical time (call it C). The critical time of X is then obtained by adding the processing time of X to the critical time of C. We will write the critical time of a vertex in square brackets after the task’s processing time (which is in parentheses). Once we have all the critical times, we get the critical path for a vertex by always moving to the adjacent vertex with the greatest critical time. 12/4/2018

19 Return to the Martian Habitat Example
START (0) AP(7) AF(5) AW(6) AD(8) IF(5) IW(7) ID(5) PL(4) IP(4) PU(3) IC(1) HU(4) EU(2) PD(3) FW(6) END (0) [11] [7] [6] [3] [11] [0] [5] [2] Step 1. We start at END, and assign a critical value of 0. Step 2. We move backward to the three vertices that are incident to END, namely, FW(6), PD(3), and EU(2). For each of them, the critical time is its processing time plus zero, so the critical times are FW[6], PD[3], and EU[2]. Step 3. From FW[6], we move backward to IC(1). The only vertex incident from IC(1) is FW[6], so the critical time for IC is [1+6 = 7]. We record a [7] next to IC in the graph. Step 4. We move backward to HU(4). There are three vertices incident from it (IC[7], PD[3], and EU[2]), and the one with the largest critical time is IC[7]. It follows that the critical time for HU is [4+7=11]. At this stage, we can also find critical times of PL(4), and PU(3). For PL(4), the only vertex incident from it is IC[7], so its critical time is [4+7=11]. For PU(3), the only vertex incident from it is EU[2], so its critical time is [3+2=5]. 12/4/2018

20 START (0) AP(7) AF(5) AW(6) AD(8) IF(5) IW(7) ID(5) PL(4) IP(4) PU(3) IC(1) HU(4) EU(2) PD(3) FW(6) END (0) [0] [6] [3] [2] [7] [11] [5] [34] [32] [27] [28] [22] [15] [34] [18] [10] Step 5. We move backward to IP(4). There are two vertices incident from it (HU[11] and PU[5]). The critical time for IP is [4+11=15]. We can also move backward to ID(5) and find its critical time, which is [10]. Step 6. We can now move backward to IW(7), we can see that its critical time is [7+15=22]. Step 7. Move backward to IF(5), and we can see that its critical time is [5+22=27]. Step 8. We now move back to AP(7), AF(5), AW(6) and AD(8). Their respective critical times are [7+27=34], [5+27=32], [6+22=28], and [8+10=18]. Step 9. Finally, we move to START, following the same rules. The critical time is [0+34=34]. This is the critical time for the entire project. 12/4/2018

21 START, AP, IE, IW, IP, HU, IC, FW, END
[34] AF(5) [32] IF(5) [27] PL(4) [11] IC(1) [7] FW(6) [6] AW(6) [28] IW(7) [22] IP(4) [15] PD(3) [3] HU(4) [11] START (0) [34] END (0) [0] AD(8) [18] ID(5) [10] PU(3) [5] EU(2) [2] To find the critical path for this project we just follow the veritices with the largest critical time. START, AP, IE, IW, IP, HU, IC, FW, END 12/4/2018

22 Critical-Path Algorithm
Make a priority list in which tasks are written in order of decreasing critical times. Create a schedule using that priority list. Although the critical-path algorithm is the best and most commonly used scheduling algorithm, it does not guarantee an optimal schedule. 12/4/2018

23 Critical Path Algorithm (continued)
START (0) AP(7) AF(5) AW(6) AD(8) IF(5) IW(7) ID(5) PL(4) IP(4) PU(3) IC(1) HU(4) EU(2) PD(3) FW(6) END (0) [0] [6] [3] [2] [7] [11] [5] [15] [10] [22] [27] [34] [32] [28] [18] If we use the critical path algorithm for the Martian habitat problem, we get the following priority list: AP[34], AF[32], AW[28], IF[27], IW[22], AD[18], IP[15], PL[11], HU[11], ID[10], IC[7], FW[6], PU[5], PD[3], EU[2] 12/4/2018

24 Critical Path Algorithm (continued)
The schedule that results from the previous priority list looks like this: Time: AP IF IW IP HU IC FW EU Idle AF AW AD PL ID PU PD The finishing time is 36 hours. P1 P2 However, it is not an optimal schedule, by trial and error, we find the optimal schedule: AP IF IW IP FW EU AF AW AD PL ID PU PD Time: HU IC P1 P2 The finishing time is 35 hours 12/4/2018

25 Class Example Given the following digraph and priority list, schedule the project with two processors: A(8) D(12) F(1) START (0) B(5) END (0) C(9) E(6) G(2) Priority List: D, C, A, E, B, G, F 12/4/2018

26 Solution Time: C(9) Idle P1 E(6) G(2) P2 A(8) B(5) D(12) F(1) 12/4/2018


Download ppt "Scheduling Theory By Sarah Walker 12/4/2018."

Similar presentations


Ads by Google