A mathematical view of our world
Download
1 / 153

A Mathematical View of Our World - PowerPoint PPT Presentation


  • 113 Views
  • Uploaded on

A Mathematical View of Our World. 1 st ed. Parks, Musser, Trimpe, Maurer, and Maurer. Chapter 7. Scheduling. Section 7.1 Basic Concepts of Scheduling. Goals Study project scheduling Study tasks Find finishing times Study weighted digraphs Study maximal paths Find critical times.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'A Mathematical View of Our World' - lang


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
A mathematical view of our world

A Mathematical View of Our World

1st ed.

Parks, Musser, Trimpe, Maurer, and Maurer


Chapter 7

Chapter 7

Scheduling


Section 7 1 basic concepts of scheduling
Section 7.1Basic Concepts of Scheduling

  • Goals

    • Study project scheduling

      • Study tasks

      • Find finishing times

    • Study weighted digraphs

      • Study maximal paths

      • Find critical times


7 1 initial problem
7.1 Initial Problem

  • A model railroad club is preparing for an open house.

  • Estimate the minimum preparation time required.

    • The solution will be given at the end of the section.


Tasks
Tasks

  • A project consists of 2 or more smaller activities called tasks.

    • A task cannot be broken into smaller jobs.

    • A task is done by 1 machine or 1 person.

  • The amount of time needed to complete a project depends on:

    • How many people or machines are available to do the work.

    • How the tasks are assigned.


Example 1
Example 1

  • A group of college students are making lasagna.

  • Divide the project into tasks.


Example 1 cont d
Example 1, cont’d

  • Solution: A possible list of tasks is given.


Tasks cont d
Tasks, cont’d

  • The people or machines performing the tasks are called processors.

  • The amount of time it takes to perform a task is called its completion time.


Tasks cont d1
Tasks, cont’d

  • If one task must be completed before another task can be started, we say the tasks have a precedence relation or order requirement between them.

    • Tasks that may be done in any order are called independent.

    • One way to represent a precedence relation between 2 tasks is to use points to denote the tasks and an arrow to indicate the relationship.


Example 2
Example 2

  • The tasks of putting on socks and putting on shoes have a preference relation.


Example 2 cont d
Example 2, cont’d

  • The tasks of putting on a hat and putting on a coat do not have a preference relation. These are independent tasks.


Question
Question:

Choose the list of tasks that has no preference relations.

a. bake the pizza, grate some cheese, make pizza sauce

b. fold some clothes, wash some clothes, hang clothes on the line to dry

c. bake the cake, toss the green salad, set the table

d. frost the cake, bake the cake, set the table


Digraphs
Digraphs

  • A collection of points (tasks) and straight or curved arrows (precedence relations) connecting them is called a directed graph or digraph.

    • A point in a digraph is called a vertex.

    • An arrow in a digraph is called an arc.


Example 3
Example 3

  • Use a digraph to represent the precedence relations for a man dressing to go for a run in the summer.

  • The tasks consist of putting on:

    • A Shirt

    • Shoes

    • Shorts

    • Socks


Example 3 cont d
Example 3, cont’d

  • Solution: Determine if there are any order requirements among the tasks.

    • Socks must be put on before shoes.

    • It is much easier to put on shorts before shoes.

    • The shirt can be put on at any point in the process.


Example 3 cont d1
Example 3, cont’d

  • Solution, cont’d: A possible digraph is shown below.


Digraphs cont d
Digraphs, cont’d

  • A digraph that contains at least one precedence relation is called an order-requirement digraph.

  • A vertex in a digraph with no arcs attached to it is said to be isolated.


Digraphs cont d1
Digraphs, cont’d

  • Example:

    • The digraph from the previous example problem is an order-requirement digraph.

    • Vertex “put on shirt” is isolated.


Example 4
Example 4

  • Construct an order-requirement digraph for the tasks of:

    • Making blackberry jam

    • Making blackberry cobbler

    • Picking blackberries


Example 4 cont d
Example 4, cont’d

  • Solution:

    • The berries must be picked first.

    • The jam and cobbler can be made in any order.


Example 5
Example 5

  • Construct an order-requirement digraph for the tasks of:

    • Putting on socks

    • Putting on a sweatshirt

    • Putting on snow pants

    • Putting on a hat

    • Putting on boots

    • Strapping on a snowboard


Example 5 cont d
Example 5, cont’d

  • Solution:

    • The socks probably go on before the pants.

    • The pants go on before the boots.

    • The boots go on before the snowboard.

    • The sweatshirt goes on before the coat.

    • The hat can be put on at any point.


Example 5 cont d1
Example 5, cont’d

  • Solution, cont’d: The digraph is shown below.


Paths
Paths

  • Any list of 2 or more vertices connected by arrows such that the list goes in the same direction as the arcs in the corresponding digraph is called a directed path.

    • Because we consider only directed paths, we simply call the list a path.


Example 6
Example 6

  • Identify all possible paths in the order-requirement digraph representing a simple version of the project of replacing old brake shoes.


Example 6 cont d
Example 6, cont’d

  • Solution: There are 6 possible paths.


Paths cont d
Paths, cont’d

  • A path that cannot be extended by adding a vertex at either end is called a maximal path.

    • In the previous example, the maximal paths were:


Sources and sinks
Sources and Sinks

  • A vertex in a digraph that is at the end of no arc is called a source.

  • A vertex in a digraph that is at the start of no arc is called a sink.

    • An isolated vertex is both a source and a sink.

    • A maximal path starts at a source and ends at a sink.


Sources and sinks cont d
Sources and Sinks, cont’d

  • In this digraph from the previous example,

    • Vertex T1 is a source.

    • Vertex T4 is a sink.


Question1
Question:

Identify all sources and sinks.

a. Sources: put on socks; Sinks: put on hat

b. Sources: put on hat, put on coat, strap on

snowboard; Sinks: put on socks, put on sweatshirt

c. Sources: put on hat; Sinks: put on socks

d. Sources: put on socks, put on sweatshirt;

Sinks: put on hat, put on coat, strap on snowboard


Finding all maximal paths
Finding all Maximal Paths

  • To find all maximal paths in a digraph:

  • Locate all the sinks that are not isolated vertices.

  • Locate all the sources that are not isolated vertices.


Finding maximal paths cont d
Finding Maximal Paths, cont’d

  • For each source, follow the arcs until you reach a sink.

  • If there is more than one arc at any vertex along the path formed in Step 3, start again at the same source and choose a different route.


Question2
Question:

Which path listed below is not a maximal path?

a. put on hat

b. put on pants, put on boots

c. put on sweatshirt, put on coat

d. put on socks, put on pants, put on boots, strap on snowboard


Example 7
Example 7

  • Identify all maximal paths in the digraph.


Example 7 cont d
Example 7, cont’d

  • Solution:

  • There is only one sink: T6

  • There is only one source: T1


Example 7 cont d1
Example 7, cont’d

  • Solution, cont’d:

  • A maximal path from T1 to T6 is

  • Another maximal path from T1 to T6 is


Example 8
Example 8

  • Identify all maximal paths in the digraph.


Example 8 cont d
Example 8, cont’d

  • Solution:

  • There is only one sink: T10


Example 8 cont d1
Example 8, cont’d

  • Solution, cont’d:

  • There are 4 sources: T1, T4 , T6, and T8.


Example 8 cont d2
Example 8, cont’d

  • Solution, cont’d:

  • There are 4 maximal paths:


Weighted digraphs
Weighted Digraphs

  • The completion time associated with a vertex (task) is the weight of the vertex.

  • A digraph with weights at each vertex is called a weighted digraph.

    • For example: This weighted digraph shows that it takes 20 seconds to put on sock and 25 seconds to put on shoes.


Example 9
Example 9

  • Construct a weighted digraph.



Project finishing time
Project Finishing Time

  • The time from the beginning of a project until the end of the project is called the finishing time for the project.

  • The finishing time depends on:

    • The task completion times.

    • The number of processors available.

    • How the processors are scheduled.

    • Whether or not some tasks can be done at the same time.


Example 10
Example 10

  • If only one processor works on the lasagna project, what is the finishing time?


Example 10 cont d
Example 10, cont’d

  • Solution: We assume the processor can only perform one task at a time.

    • Add up all the task completion times: 10 + 5 + 30 + 10 + 10 + 2 + 6 + 7 + 8 + 30 = 118 minutes.

    • It will take one processor almost 2 hours to finish the project.


Weighted digraphs cont d
Weighted Digraphs, cont’d

  • The weight of a path in a weighted order-requirement digraph is the sum of the weights at the vertices on the path.

  • A critical path in an order-requirement digraph is a path having the largest possible weight.

    • The weight of a critical path is called the critical time for the project.


Weighted digraphs cont d1
Weighted Digraphs, cont’d

  • Any critical path must be a maximal path.

  • To find the critical paths:

    • Find all the maximal paths.

    • Select the maximal path(s) with the largest weight.


Example 11
Example 11

  • Find a critical path in the lasagna project digraph.


Example 11 cont d
Example 11, cont’d

  • Solution: Previously we found 4 maximal paths.


Example 11 cont d1
Example 11, cont’d

Solution, cont’d:


Example 11 cont d2
Example 11, cont’d

  • Solution, cont’d: The largest weight for any maximal path is 83.

    • The one critical path is

    • The critical time for the project is 83 minutes.

  • It will take a minimum of 83 minutes, with enough processors, to make the lasagna.

  • This example illustrates the fact that the finishing time of a project is always greater than or equal to its critical time.


7 1 initial problem solution
7.1 Initial Problem Solution

  • A model railroad club is preparing for an open house.

  • What is the minimum completion time?


Initial problem solution cont d
Initial Problem Solution, cont’d

  • The first 6 tasks need to be done first and in order.

  • Task 7 must be done before task 8.

  • Everything else must be done before task 10.


Initial problem solution cont d1
Initial Problem Solution, cont’d

  • A weighted digraph is created.


Initial problem solution cont d2
Initial Problem Solution, cont’d

  • Find all maximal paths, along with their weights.


Initial problem solution cont d3
Initial Problem Solution, cont’d

  • The critical time of the project is 52 hours.

  • The finishing time is greater than or equal to the critical time, so it will take at least 52 hours to prepare for the open house.


Section 7 2 list scheduling algorithm
Section 7.2List-Scheduling Algorithm

  • Goals

    • Study project scheduling

      • Study priority lists

      • Use the list-scheduling algorithm

      • Create and read Gantt charts

      • Study optimal schedules


7 2 initial problem
7.2 Initial Problem

  • Suppose 2 students will make the lasagna in the project examined in Section 7.1.

  • What is a good way for the 2 students to divide the work and how long will it take?

    • The solution will be given at the end of the section.


Priority lists
Priority Lists

  • A priority list is an ordered list of all the tasks in a project.

    • When tasks are performed, precedence relations override a priority list.

    • A priority list tells you which task to do first among those you can do at a certain point in time.


Example 12
Example 1

  • A woodworking project consists of 7 tasks.


Example 1 cont d1
Example 1, cont’d

  • The weighted digraph above represents the project, with completion times in minutes.

  • Determine the critical time.

  • Create a priority list based on completion time, from shortest to longest.


Example 1 cont d2
Example 1, cont’d

  • Solution: The 3 maximal paths, and their weights, are listed.


Example 1 cont d3
Example 1, cont’d

  • Solution, cont’d: The largest weight of a maximal path in this case is 90 minutes.

    • The critical time is 90 minutes.


Example 1 cont d4
Example 1, cont’d

  • Solution, cont’d: The tasks are placed in a priority list according to their completion times.

    • The priority list is T1, T5, T2, T3, T6, T7, and T4.


Priority lists cont d
Priority Lists, cont’d

  • A priority list in which tasks are arranged from shortest completion time to longest completion time is called an increasing-time priority list.

  • A priority list in which tasks are arranged from longest completion time to shortest completion time is called a decreasing-time priority list


Question3
Question:

Create the decreasing-time priority list for the project whose digraph is shown below.

a.

b.

c.

d.


Example 21
Example 2

  • How would one processor finish the woodworking project from the previous example using the increasing-time priority list T1, T5, T2, T3, T6, T7, and T4?


Example 2 cont d1
Example 2, cont’d

  • Solution: Use the precedence relations and the priority list to determine the order of the tasks.

    • Task T1is a source and is first on the list, so it will be done first.

    • Next, either T2or T3could be done. Choose T2because it is first in the list.

    • At this point, the tasks that can be done are T3 or T5. According to the priority list, choose T5.


Example 2 cont d2
Example 2, cont’d

  • Solution, cont’d: The order of the rest of the tasks is determined in the same manner.

    • The priority list is T1, T5, T2, T3, T6, T7, T4.

    • The order in which the tasks will be completed is T1, T2, T5, T3, T6, T4, T7 .


Gantt charts
Gantt Charts

  • We can keep track of the order in which tasks are done and how long it takes using a diagram called a Gantt chart.

    • Numbers at the bottom of the chart show the elapsed time.

    • The boxes represent the tasks.


Gantt charts cont d
Gantt Charts, cont’d

  • A Gantt chart for the woodworking project in the previous example is shown below.


Definitions
Definitions

  • A task T will be called ready if all tasks required to begin T have been completed.

  • A processor that has not yet been assigned a task and is not working on a task will be called idle.

    • At the beginning of a project we assume all processors are idle and at least 1 task is ready.


List processing algorithm
List-Processing Algorithm

  • The lowest-numbered idle processor is assigned to the highest-priority ready task until either all processors are assigned or all ready tasks have been assigned.


List processing algorithm cont d
List-Processing Algorithm, cont’d

  • When a processor completes a task, that processor becomes idle. One of 3 cases will occur.

    • If there are ready tasks, repeat Step 1.

    • If there are no ready tasks but not every task has been done, the processor remains idle until more tasks are completed.

    • If all tasks have been completed, the project is finished.


Example 31
Example 3

  • Apply the algorithm to the wood-working project using 2 processors and the increasing-time priority list T1, T5, T2, T3, T6, T7, T4.


Example 3 cont d2
Example 3, cont’d

  • Solution: Step 1:

    • P1 is assigned to T1.

    • P2 remains idle.


Example 3 cont d3
Example 3, cont’d

  • Solution, cont’d: At 5 minutes, Step 2, Case A.

    • Ready: T2, T3.

    • Not completed: T2, T3, T4, T5, T6, T7.

    • Priority list: T1, T5, T2, T3, T6, T7, T4.


Example 3 cont d4
Example 3, cont’d

  • Solution, cont’d: Step 1:

    • P1 and P2 are idle.

    • P1 is assigned to T2.

    • P2 is assigned to T3.


Example 3 cont d5
Example 3, cont’d

  • Solution, cont’d: At 20 minutes, Step 2, Case A.

    • Ready: T5.

    • Not completed: T3, T4, T5, T6, T7.

    • Priority list: T1, T5, T2, T3, T6, T7, T4.


Example 3 cont d6
Example 3, cont’d

  • Solution, cont’d: Step 1:

    • P1 is idle.

    • P1 is assigned to T5.


Example 3 cont d7
Example 3, cont’d

  • Solution, cont’d: At 25 minutes, Step 2, Case A.

    • Ready: T4, T6.

    • Not completed: T4, T5, T6, T7.

    • Priority list: T1, T5, T2, T3, T6, T7, T4.


Example 3 cont d8
Example 3, cont’d

  • Solution, cont’d: Step 1:

    • P2 is idle.

    • P2 is assigned to T6.


Example 3 cont d9
Example 3, cont’d

  • Solution, cont’d: At 30 minutes, Step 2, Case A.

    • Ready: T4.

    • Not completed: T4, T6, T7.

    • Priority list: T1, T5, T2, T3, T6, T7, T4.


Example 3 cont d10
Example 3, cont’d

  • Solution, cont’d: Step 1:

    • P1is idle.

    • P1 is assigned to T4.


Example 3 cont d11
Example 3, cont’d

  • Solution, cont’d: At 50 minutes, Step 2, Case B.

    • Ready: none.

    • Not completed: T4, T7.

    • Priority list: T1, T5, T2, T3, T6, T7, T4.


Example 3 cont d12
Example 3, cont’d

  • Solution, cont’d: Step 1:

    • P2 remains idle.


Example 3 cont d13
Example 3, cont’d

  • Solution, cont’d: At 65 minutes, Step 2, Case A.

    • Ready: T7.

    • Not completed: T7.

    • Priority list: T1, T5, T2, T3, T6, T7, T4.


Example 3 cont d14
Example 3, cont’d

  • Solution, cont’d: Step 1:

    • P1 and P2 are idle.

    • P1 is assigned to T7.


Example 3 cont d15
Example 3, cont’d

  • Solution, cont’d: At 95 minutes, Step 2, Case C.

    • Ready: none.

    • Not completed: none.

  • The finishing time with 2 processors is 95 minutes.

    • This is less than 140 minutes for 1 processor, but more than the critical time of 90 minutes.


Example 41
Example 4

  • Apply the algorithm to the wood-working project using 3 processors and the increasing-time priority list T1, T5, T2, T3, T6, T7, T4.


Example 4 cont d1
Example 4, cont’d

  • Solution: Step 1:

    • P1 is assigned to T1.

    • P2 and P3 remain idle.


Example 4 cont d2
Example 4, cont’d

  • Solution, cont’d: At 5 minutes: Step 2 and Step 1

    • P1, P2 and P3are idle.

    • T2 and T3are ready.

    • P1 is assigned to T2.

    • P2 is assigned to T3.

    • P3remains idle.


Example 4 cont d3
Example 4, cont’d

  • Solution, cont’d: At 20 minutes: Step 2 and Step 1

    • P1 and P3are idle.

    • T5is ready.

    • P1 is assigned to T5.

    • P3remains idle.


Example 4 cont d4
Example 4, cont’d

  • Solution, cont’d: At 25 minutes: Step 2 and Step 1

    • P2 and P3are idle.

    • T6and T4 are ready.

    • P2is assigned to T6.

    • P3is assigned to T4.


Example 4 cont d5
Example 4, cont’d

  • Solution, cont’d: At 30 minutes: Step 2 and Step 1

    • P1is idle.

    • No tasksare ready.

    • P1 remains idle.


Example 4 cont d6
Example 4, cont’d

  • Solution, cont’d: At 50 minutes: Step 2 and Step 1

    • P1 and P2are idle.

    • No tasksare ready.

    • P1and P2remain idle.


Example 4 cont d7
Example 4, cont’d

  • Solution, cont’d: At 60 minutes: Step 2 and Step 1

    • P1, P2 and P3 are idle.

    • T7is ready.

    • P1 is assigned to T7.


Example 4 cont d8
Example 4, cont’d

  • Solution, cont’d: At 90 minutes: Step 2 and Step 1

    • P1, P2 and P3are idle.

    • No tasks are ready.

    • All tasks have been completed.


Example 4 cont d9
Example 4, cont’d

  • The completion time with 3 processors is 90 minutes, the critical time.

    • The project completion is summarized in the Gantt chart.


Example 51
Example 5

  • Apply the algorithm to the wood-working project using 2 processors and the decreasing-time priority list T4, T7, T6, T3, T2, T5, T1.


Example 5 cont d2
Example 5, cont’d

  • Solution: Step 1:

    • P1 is assigned to T1.

    • P2remains idle.


Example 5 cont d3
Example 5, cont’d

  • Solution, cont’d: At 5 minutes: Step 2 and Step 1

    • P1and P2 are idle.

    • T2and T3are ready.

    • P1 is assigned to T3.

    • P2 is assigned to T2.


Example 5 cont d4
Example 5, cont’d

  • Solution, cont’d: At 20 minutes: Step 2 and Step 1

    • P2 is idle.

    • T5is ready.

    • P2 is assigned to T5.


Example 5 cont d5
Example 5, cont’d

  • Solution, cont’d: At 25 minutes: Step 2 and Step 1

    • P1 is idle.

    • T4 and T6are ready.

    • P1 is assigned to T4.


Example 5 cont d6
Example 5, cont’d

  • Solution, cont’d: At 30 minutes: Step 2 and Step 1

    • P2is idle.

    • T6 is ready.

    • P2 is assigned to T6.


Example 5 cont d7
Example 5, cont’d

  • Solution, cont’d: At 55 minutes: Step 2 and Step 1

    • P2is idle.

    • No tasks are ready.

    • P2remains idle.


Example 5 cont d8
Example 5, cont’d

  • Solution, cont’d: At 60 minutes: Step 2 and Step 1

    • P1 and P2 are idle.

    • T7 is ready.

    • P1 is assigned to T7.

    • P2remains idle.


Example 5 cont d9
Example 5, cont’d

  • Solution, cont’d: At 90 minutes: Step 2 and Step 1

    • P1 and P2are idle.

    • No tasks are ready.

    • All tasks are completed.

  • The finishing time with the decreasing-time priority list and 2 processors is 90 minutes.


Example 5 cont d10
Example 5, cont’d

  • Solution, cont’d:


Question4
Question:

Given the priority list

and the digraph for the project, which tasks will be assigned first if there are 3 processors?


Question cont d
Question cont’d

a. Processor 1: Task 4; Processor 2: Task 1; Processor 3: Task 8

b. Processor 1: Task 1; Processor 2: Task 4; Processor 3: Task 6

c. Processor 4: Task 1; Processor 2: Task 1; Processor 3: Task 6

d. Processor 1: Task 1; Processor 2: Task 4; Processor 3: Task 8


Optimal schedules
Optimal Schedules

  • An optimal schedule is a schedule assigning processors to tasks in such a way that it results in the shortest possible finishing time for that project with that number of processors.


Optimal schedules cont d
Optimal Schedules, cont’d

  • If the finishing time is equal to the critical time, we know the schedule is optimal.

  • If the finishing time is more than the critical time, the schedule may or may not be optimal.

    • Typically, the decreasing-time priority list gives a better finishing time than does the increasing-time priority list.


Decreasing time algorithm
Decreasing-Time Algorithm

  • Form a decreasing-time priority list.

  • Apply the list-processing algorithm.

    • If 2 or more tasks have the same completion time, they may be chosen in any order.


7 2 initial problem solution
7.2 Initial Problem Solution

  • Determine a schedule and the finishing time for the lasagna project with 2 processors.


Initial problem solution cont d4
Initial Problem Solution, cont’d

  • Use a decreasing-time priority list: T3, T10, T1, T4, T5, T9, T8, T7, T2, T6.

  • The Gantt chart that results from applying the algorithm is shown next.


Initial problem solution cont d5
Initial Problem Solution, cont’d

  • The finishing time for this project with 2 processors and a decreasing-time priority list is 90 minutes.

    • The critical time was 83 minutes.

    • This may or may not be an optimal schedule.


Section 7 3 the critical path algorithm
Section 7.3The Critical-Path Algorithm

  • Goals

    • Study the critical-path priority list algorithm

      • Create the critical-path priority list

      • Schedule tasks according to the critical-path priority list


7 3 initial problem
7.3 Initial Problem

  • Find an optimal schedule for the lasagna project using 2 processors.

    • The solution will be given at the end of the section.


Example 13
Example 1

  • A digraph for the project of making sandwiches is shown below.

  • Two processors will be assigned.


Example 1 cont d5
Example 1, cont’d

  • Apply the decreasing-time algorithm to create a schedule and find the finishing time.

  • Find the critical path and the critical time.

  • Find the finishing time when one processor is assigned to the tasks in the critical path and one to the other tasks.


Example 1 cont d6
Example 1, cont’d

  • Solution: The decreasing-time priority list is T1, T2, T3, T4, T5, T6, T7.

    • The Gantt chart shows a finishing time of 39 minutes.


Example 1 cont d7
Example 1, cont’d

  • Solution: The maximal paths and their weights are shown below.

    • The critical time is 30 minutes.


Example 1 cont d8
Example 1, cont’d

  • Solution: Instead of using a priority list, all tasks in the critical path are assigned to one processor.

    • The Gantt chart shows a finishing time of 30 minutes.


Critical path priority list
Critical-Path Priority List

  • List all the maximal paths and isolated vertices.

  • Find the greatest of all the weights of the maximal paths and isolated vertices.

    • If the weight belongs to a maximal path, the task at the head of the path goes next in the priority list.

    • If the weight belongs to an isolated vertex, that task goes next in the priority list.


Critical path priority list cont d
Critical-Path Priority List, cont’d

  • Remove the task selected in Step 2 and all attached edges from the digraph.

    • Using the new digraph, repeat Step 1 and Step 2.


Example 22
Example 2

  • Find the critical-path priority list.


Example 2 cont d3
Example 2, cont’d

  • Solution: The maximal paths are listed. There are no isolated vertices.

    • The greatest weight is 42, so the first task in the list is T2.


Example 2 cont d4
Example 2, cont’d

  • Solution, cont’d: The task and all attached edges are removed from the digraph.


Example 2 cont d5
Example 2, cont’d

  • Solution, cont’d: The maximal paths are listed. There are no isolated vertices.

    • The greatest weight is 38, so the next task in the list is T1.


Example 2 cont d6
Example 2, cont’d

  • Solution, cont’d: Remove T1 and create a new digraph and table.

    • The greatest weight is 30, so the next task in the list is T5.


Example 2 cont d7
Example 2, cont’d

  • Solution, cont’d: Remove T5 and create a new digraph and table.

    • The greatest weight is 22, so the next task in the list is T6.


Example 2 cont d8
Example 2, cont’d

  • Solution, cont’d: Remove T6 and create a new digraph and table.

    • The greatest weight is 20, so the next task in the list is T3.


Example 2 cont d9
Example 2, cont’d

  • Solution, cont’d: Remove T3 and create a new digraph and table.

    • The greatest weight is 15, so the next task in the list is T7.


Example 2 cont d10
Example 2, cont’d

  • Solution, cont’d: Remove T7and create a new digraph and table.

    • The greatest weight is 11, so the next task in the list is T4.


Example 2 cont d11
Example 2, cont’d

  • Solution, cont’d: Remove T4and create a new digraph and table.

    • The next task in the list is T8, followed by T9.

    • The priority list is T2, T1, T5, T6, T3, T7, T4, T8, T9.


Question5
Question:

Find the critical-path priority list for the project.

a.

b.

c.

d.


Critical path scheduling algorithm
Critical-Path Scheduling Algorithm

  • Determine the critical-path priority list.

  • Apply the list-processing algorithm.


Question6
Question

Suppose the critical-path algorithm is being used to schedule a project using 3 processors. The priority list is . At 2 minutes, the status is that Processors 1 and 2 are both working on task, while Processor 3 is idle. What should happen at this point?

a. Processor 3 is assigned

Task 8.

b. Processor 3 is assigned

Task 2.

c. Processor 3 is assigned

Task 5.

d. Processor 3 remains idle.


Example 32
Example 3

  • Apply the critical-path scheduling algorithm using 2 processors.


Example 3 cont d16
Example 3, cont’d

  • Solution: The critical-path priority list was found in the last example: T2, T1, T5, T6, T3, T7, T4, T8, T9.

  • The Gantt chart is shown below.


Example 3 cont d17
Example 3, cont’d

  • Solution, cont’d: The finishing time with 2 processors using the critical-path priority list is 42 minutes.

  • There were 2 periods of time during which Processor 2 had to remain idle.


7 3 initial problem solution
7.3 Initial Problem Solution

  • Two processors will complete the lasagna project.


Initial problem solution cont d6
Initial Problem Solution, cont’d

  • We will use the critical-path priority list.

  • The maximal paths are listed, with their weights.

    • The greatest weight is 83, so the first task in the list is T1.


Initial problem solution cont d7
Initial Problem Solution, cont’d

  • Remove T1.

  • The maximal paths are listed, with their weights.

    • The greatest weight is 73, so the next task in the list is T2.


Initial problem solution cont d8
Initial Problem Solution, cont’d

  • Remove T2.

  • The maximal paths are listed, with their weights.

    • The greatest weight is 68, so the next task in the list is T3.


Initial problem solution cont d9
Initial Problem Solution, cont’d

  • Remove T3.

  • The maximal paths are listed, with their weights.

    • The greatest weight is 58, so the next task in the list is T4.


Initial problem solution cont d10
Initial Problem Solution, cont’d

  • Remove T4.

  • The maximal paths are listed, with their weights.

    • The greatest weight is 48, so the next task in the list is T5.


Initial problem solution cont d11
Initial Problem Solution, cont’d

  • Remove T5.

  • The maximal paths are listed, with their weights.

    • The greatest weight is 46, so the next task in the list is T6.


Initial problem solution cont d12
Initial Problem Solution, cont’d

  • Remove T6.

  • The maximal paths are listed, with their weights.

    • The greatest weight is 45, so the next task in the list is T8.


Initial problem solution cont d13
Initial Problem Solution, cont’d

  • Remove T8.

  • The maximal paths are listed, with their weights.

    • The task are assigned in the order T7, T9, T10.

    • The critical-path priority list is T1, T2, T3, T4, T5, T6, T8, T7, T9 , T10 .


Initial problem solution cont d14
Initial Problem Solution, cont’d

  • The Gantt chart is shown above.

  • The finishing time is equal to the critical time of 83 minutes, so we know the schedule is optimal.