# Chapter 8: Scheduling “Science is organized knowledge. Wisdom is organized life.” -Immanuel Kant.

## Presentation on theme: "Chapter 8: Scheduling “Science is organized knowledge. Wisdom is organized life.” -Immanuel Kant."— Presentation transcript:

Chapter 8: Scheduling “Science is organized knowledge. Wisdom is organized life.” -Immanuel Kant

Example 8.1.1: Preparing for Launch Immediately preceding the launch of a satellite into space, last-minute system checks need to be performed by the on- board computers, and it is important to complete these system checks as quickly as possible – for both cost and safety reasons. Suppose that there are five system checks required: A(6), B(5), C(7), D(2), and E(5), with the numbers in parentheses representing the hours it takes one computer to perform that system check. In addition, there are precedence relations: D cannot be started until both A and B have been finished, and E cannot be started until C has been finished. Suppose there are two identical computer processors, P1 and P2, that will carry out the individual system checks. Create a schedule for the two processors.

Example 8.1.2: Building a Dream Home on Mars It is the year 2050 and several human colonies have already been established on Mars. Imagine that you accept a job offer to work in one of these colonies. Like everyone else on Mars, you will be provided with a living pod called a Martian Habitat Unit (MHU). The assembly of an MHU consists of 15 separate tasks, and there are 17 different precedence relations among these tasks that must be followed. The tasks, their respective processing times, and their precedent tasks are all shown in the table. How can we get your MHU built as quickly as possible? How many robots should you rent to do the job? How do we create a suitable work schedule that will get the job done?

Section 8.2: Directed Graphs (Digraphs) Graphs in which the edges have a direction associated with them

Example 8.2.1: Digraphs Refer to the Digraph drawn. List all the arcs in the digraph. Is B incident to D? Is B incident from D? What arcs are adjacent? List a cycle in this digraph. What is the outdegree of A? What is the indegree of A?

Example 8.2.2: Examples of digraphs Traffic – some streets are one-way, some are two-way Telephones – phone calls Tournaments Dream House on Mars (draw a digraph)

Section 8.3: Scheduling with Priority Lists

Example 8.3.1: Preparing for Launch Immediately preceding the launch of a satellite into space, last-minute system checks need to be performed by the on-board computers, and it is important to complete these system checks as quickly as possible – for both cost and safety reasons. Suppose that there are five system checks required: A(6), B(5), C(7), D(2), and E(5), with the numbers in parentheses representing the hours it takes one computer to perform that system check. In addition, there are precedence relations: D cannot be started until both A and B have been finished, and E cannot be started until C has been finished. Suppose there are two identical computer processors, P1 and P2, that will carry out the individual system checks. Create a schedule for the two processors. Let’s pretend the priority list is in alphabetical order. What if we try it with the priority list in reverse alphabetical order? What if we add a third computer?

The Priority-List Model Three different scenarios to consider: All processors are busy. (The only thing we can do is wait.) One processor is free. (Give it the first ready task in the priority list.) More than one processor is free. (Give each processor ready tasks in order by priority.) The key of this model: keep track of which tasks are ready, in execution, completed and ineligible.

Example 8.3.2: Dream Home on Mars Use the priority list AD(8), AW(6), AF(5), IF(5), AP(7), IW(7), ID(5), IP(4), PL(4), PU(3), HU(4), IC(1), PD(3), EU(2), FW(6) where the numbers in the parentheses represent the number of hours it takes one robot to complete the task. Circle ready tasks. Put a single slash through tasks in execution. Put an X through completed tasks. Don’t mark ineligible tasks.

But how do we find the optimal priority list? Coming next…

Section 8.4: The Decreasing- Time Algorithm Finding a good priority list

Example 8.4.1: Dream Home on Mars (yes, again) Use the decreasing-time priority list AD(8), AP(7), IW(7), AW(6), FW(6), AF(5), IF(5), ID(5), IP(4), PL(4), HU(4), PU(3), PD(3), EU(2), IC(1) Find the schedule. Not very good – Why?

Section 8.5: Critical Paths

Critical Paths and Critical Times For a given vertex X, the critical path is the path from X to END with the longest processing time. The processing time of a path is the sum of the processing times of all the vertices in the path. When we add the processing times of all the tasks along the critical path for X, we get the critical time for X. The critical time for END is 0. The path with the longest processing time from START to END is called the critical path for the project, and the total processing time for this critical path is the critical time for the project.

Example 8.5.1: Still Building That Dream Home on Mars Let’s look at the vertex HU. There are 3 paths from HU to END: HU, IC, FW, END has processing time 4+1+6=11 HU, PD, END has processing time 4+3=7 HU, EU, END has processing time 4+2=6 Which one is the critical path? Answer: HU, IC, FW, END (because it has the longest processing time) Now, find the critical path for the vertex AD. Now, find the critical path for the project.

Finding Critical Paths Backflow Algorithm: 1.Find the critical time for every vertex of the project digraph. This is done by starting at END and working backward toward START according to the following rule: The critical time for a task X equals the processing time of X plus the largest critical time among the vertices incident from X. 2.Critical paths are found by following the path along largest critical times. In other words, the critical path for any vertex X is obtained by starting at X and moving to the adjacent vertex with largest critical time, and from there to the adjacent vertex with largest critical time, and so on.

Example 8.5.2: That Dream Home on Mars Find the critical path.

Section 8.6: The Critical Path Algorithm

Critical-Path Algorithm 1.Find critical times – Using the backflow algorithm, find the critical time for every task in the project. 2.Create priority list – Using the critical times obtained in Step 1, create a priority list with the tasks listed in decreasing order of critical times. 3.Create schedule – Using the critical-time priority list obtained in Step 2, create the schedule.

Example 8.6.1: That Dream Home on Mars Schedule the MHU project with 2 processors.

Download ppt "Chapter 8: Scheduling “Science is organized knowledge. Wisdom is organized life.” -Immanuel Kant."

Similar presentations