Unit 3 Scheduling and Planning. Literacy Practice Please read PG 67-68. Stop at ASSUMPTIONS AND GOALS on page 68.

Slides:



Advertisements
Similar presentations
Math for Liberal Studies. There is a list of numbers called weights These numbers represent objects that need to be packed into bins with a particular.
Advertisements

Algorithm Design Methods Spring 2007 CSE, POSTECH.
Great Theoretical Ideas in Computer Science
22C:19 Discrete Math Graphs Fall 2014 Sukumar Ghosh.
Chapter 3: Planning and Scheduling Lesson Plan
Greed is good. (Some of the time)
Excursions in Modern Mathematics, 7e: Copyright © 2010 Pearson Education, Inc. Scheduling with Independent Tasks Notes 9 – Section 8.7.
Chapter 8: Scheduling “Science is organized knowledge. Wisdom is organized life.” -Immanuel Kant.
Critical Paths and Critical Paths Algorithm Notes 8 – Sections 8.5 & 8.6.
13.4 Map Coloring and the Four Color Theorem. We started this chapter by coloring the regions formed by a set of circles in the plane. But when do we.
Sampling Distributions
3.3 Spanning Trees Tucker, Applied Combinatorics, Section 3.3, by Patti Bodkin and Tamsen Hunter.
Scheduling Two people are camping out and wish to cook a simple supper consisting of soup and hamburgers. In order to prepare the supper, several tasks.
“Coloring in Math Class” Julie March Tracey Clancy Onondaga Community College.
Last time: terminology reminder w Simple graph Vertex = node Edge Degree Weight Neighbours Complete Dual Bipartite Planar Cycle Tree Path Circuit Components.
A general approximation technique for constrained forest problems Michael X. Goemans & David P. Williamson Presented by: Yonatan Elhanani & Yuval Cohen.
Graph Colouring Lecture 20: Nov 25.
CSE 421 Algorithms Richard Anderson Lecture 6 Greedy Algorithms.
D1: Bin Packing Algorithms. D1: Bin-Packing Algorithms Bin-packing algorithms can be used to find ways to complete a number of tasks in given time slots,
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
Graph Theory and Graph Coloring Lindsay Mullen
Investigation #1 Let’s review what has happened so far in this story… A) Thirty-two people are coming to the reunion. B) Mrs. Comfort has ordered 8 square.
A processor is a person, machine, computer, or robot etc., which works on a task. To solve a scheduling problem typically the tasks are scheduled to minimize.
CS 2813 Discrete Structures
Spring 2015 Mathematics in Management Science Conflict Scheduling Vertex Coloring Chromatic Number Conflict Resolution.
Graph Coloring.
Critical Path Analysis
Spring 2015 Mathematics in Management Science Bin Packing The Problem The Algorithms.
Which of these can be drawn without taking your pencil off the paper and without going over the same line twice? If we can find a path that goes over all.
Planning and Scheduling Chapter 3 Jennifer Holland February 2, 2010.
Spring 2015 Mathematics in Management Science Machine Scheduling Problem Statement of MSP Assumptions & Goals Priority Lists List Processing Algorithm.
Excursions in Modern Mathematics, 7e: Copyright © 2010 Pearson Education, Inc. 8 The Mathematics of Scheduling 8.1The Basic Elements of Scheduling.
Spring 2015 Mathematics in Management Science Critical Path Scheduling Critical Paths & Times Backflow Algorithm Critical Times PL Critical Path Algorithm.
Vertex Coloring Chromatic Number Conflict Resolution
Graph Colouring L09: Oct 10. This Lecture Graph coloring is another important problem in graph theory. It also has many applications, including the famous.
Outline Introduction Minimizing the makespan Minimizing total flowtime
Planar Graphs Graph Coloring
Agenda Review: –Planar Graphs Lecture Content:  Concepts of Trees  Spanning Trees  Binary Trees Exercise.
Graph Colouring Lecture 20: Nov 25. This Lecture Graph coloring is another important problem in graph theory. It also has many applications, including.
Matching Algorithms and Networks. Algorithms and Networks: Matching2 This lecture Matching: problem statement and applications Bipartite matching Matching.
Sight Words.
Algorithm Design Methods 황승원 Fall 2011 CSE, POSTECH.
The bin packing problem. For n objects with sizes s 1, …, s n where 0 < s i ≤1, find the smallest number of bins with capacity one, such that n objects.
CSEP 521 Applied Algorithms Richard Anderson Winter 2013 Lecture 3.
Bushy Binary Search Tree from Ordered List. Behavior of the Algorithm Binary Search Tree Recall that tree_search is based closely on binary search. If.
Great Theoretical Ideas in Computer Science for Some.
I can describe the differences between Hamilton and Euler circuits and find efficient Hamilton circuits in graphs. Hamilton Circuits I can compare and.
Planning and Scheduling.  A job can be made up of a number of smaller tasks that can be completed by a number of different “processors.”  The processors.
Critical Paths and Scheduling Tasks Circuits, Paths, and Schedules.
Bin Packing. 2 Background: Suppose you plan to build a wall system for your books, records, and stereo set in your dorm room. The wall system requires.
Unit 2 Hamiltonian Circuits. Hamiltonian Circuit: A tour that starts at a vertex of a graph and visits each vertex once and only once, returning to where.
1 Ch18. The Greedy Methods. 2 BIRD’S-EYE VIEW Enter the world of algorithm-design methods In the remainder of this book, we study the methods for the.
Chapter 3: Planning and Scheduling. Planning and Scheduling - Topics Resolving Conflict via Coloring Bin Packing Scheduling Tasks Critical-Path Schedules.
8 The Mathematics of Scheduling
Planar Graphs Hubert Chan (Chapter 9.7) [O2 Proof Techniques]
Greedy Algorithms.
8 The Mathematics of Scheduling
Task Tables Draw a graph for the following task table.
Great Theoretical Ideas in Computer Science
Planar Graphs & Euler’s Formula
Tucker, Applied Combinatorics, Sec 2.4
Scheduling Theory By Sarah Walker 12/4/2018.
Route Inspection Which of these can be drawn without taking your pencil off the paper and without going over the same line twice? If we introduce a vertex.
Richard Anderson Autumn 2016 Lecture 7
Planning and Scheduling
Planning and Scheduling
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
Richard Anderson Winter 2019 Lecture 7
Richard Anderson Autumn 2015 Lecture 7
Chapter 3: Planning and Scheduling Lesson Plan
Presentation transcript:

Unit 3 Scheduling and Planning

Literacy Practice Please read PG Stop at ASSUMPTIONS AND GOALS on page 68.

Vocabulary 1.Job: 2.Tasks: 3.Processors:

Assumptions 1.If a processor starts work on a task, it will not stop until the task is completed. 2.No processor will stay voluntarily idle. If a processor is free to do a task, and a task is available to be worked on, the processor will immediately start work on the task. 3.The requirements for ordering the tasks are given by an order- requirement digraph. 4.The tasks are arranged in a priority list (most important to least important) that is independent of the order requirements.

Goals 1.Minimize the completion time of the job (optimal time) 2.Minimize the total time that the processors are idle 3.Find the minimum number or processors necessary to finish the job by a specified time.

List-Processing Algorithm At a given time, assign to the lowest-numbered free processor the first task on the priority list that is ready at that time and that hasn’t already been assigned to a processor.

Example 2 Schedule the following order-requirement digraph given the following priority list with 2 processors.

For Example 2, what is the shortest possible completion time for the job? How did you know?

Estimated Minimum Completion Time To estimate the minimum completion time of a Order-Requirement Digraph (ORD), add up all the times of the tasks and divide by the number of processors. That number will be the minimum estimation. Example: If we sum the tasks from Example 2, we get 47. Divide this by 2 processors, and we get So we know that the job could never be completed in less that 23.5 minutes regardless of the critical path.

Strange Happenings The LPA involves four factors that affect the final schedule: 1.The times to carry out the tasks. 2.Number of processors. 3.Order-requirement digraph. 4.Ordering of the tasks in the priority list.

Strange Happenings continued In order to shorten the completion time of a job that has been scheduled, we can do any of three things to the job. 1.Reduce the task times. 1.If every task takes less time, the job should be able to be done quicker. 2.Use more processors. 1.If more people are working on the job, it should go quicker. 3.“Loosen” constraints by having fewer edges in the ORD. 1.If we have more independent tasks, they can be done at any time and we should be able to finish the job quicker.

Critical-Path Scheduling Algorithm The critical-path scheduling algorithm applies to the LPA using the priority list obtained as follows: 1.Find the task that heads the critical path in the ORD. If there is a tie, choose the one with the lower task number. 2.Place the task found in step one next on the list. 3.Remove the task and its connected edges from the ORD. 4.Continue steps 1-3 until there are no vertices left.

Priority List

Not a game. We’re talkin’ ‘bout practice, man. 1. Individually, create an Order-Requirement Digraph. 2. Get with a partner and trade your digraphs. 3. Using the critical-path scheduling algorithm and the list processing algorithm, determine the priority list and schedule the digraph using 2 processors.

Literacy Practice Please read page 78 starting at section 3.3. Stop reading at page 79 before Decreasing-Time Lists

Decreasing-Time Lists The LPA applied to a list of task times arranged in order of nonincreasing size. Ex: 10, 4, 5, 9, 7, 7 are the times of independent tasks. Using the DTL, the tasks would be arranged 10, 9, 7, 7, 5, 4

Example Schedule a job that has all independent tasks of times 3,4,2,8,5,9,7 with two processors using Decreasing-Time Lists. Then try it with three processors. 1.What is the idle time of each processor? 2.What is the total idle time? 3.Are either of these schedules optimal?

Schedule the following graphs on 2, then three processors using the critical path scheduling algorithm.

Schedule the following graphs using the Decreasing Time Lists Algorithm on 2 then 3 processors.

Bin Packing The bin-packing problem involves finding the minimum number of bins of a specific weight capacity into which items of smaller weights can be packed without exceeding the capacity of the bins. ***This is directly related to the scheduling we have been doing so far this unit, but instead of having a fixed number of processors and looking for a minimum completion time, we have a fixed completion time and need to find the minimum number of processors.

Example 1: Bookshelves You would like to build a set of shelves along your living room wall. To match the design you’ve drawn, you need shelves of the following lengths: 6, 6, 5, 5, 5, 4, 4, 2, 2, 2, 3, 7, 8, 8 If the lumber yard only sells wood in 9ft boards, how many board do you need to buy? (assume no wood is ever ruined, wasted, or miscut, i.e. a 9ft board could be cut into a 7ft and a 2ft section)

Next-Fit Algorithm (NF) Starting at the beginning of the list, place the weights into the currently open bin. If it does not fit, open a new bin and place the weight in there. Pro: Do not need to know all weights in advance Con: Not always optimal ***Think conveyor belt moving the bins past you, once you move onto the next bin, you cannot go back to a previous one whether or not it has space available.

Shelves: NF Each “bin” below is 9ft long. Let’s use the NF algorithm to figure out how many we need. 6, 6, 5, 5, 5, 4, 4, 2, 2, 2, 3, 7, 8, 8

First-Fit Algorithm (FF) Just like NF algorithm, but remove the conveyor belt idea. All of the bins are in front of you and you place the weight into the FIRST bin that it FITS into. After a weight is placed in a bin, grab the next weight, and start with bin #1 to see where it will fit.

Shelves: FF Each “bin” below is 9ft long. Let’s use the FF algorithm to figure out how many we need. 6, 6, 5, 5, 5, 4, 4, 2, 2, 2, 3, 7, 8, 8

Worst-Fit Algorithm (WF) Similar to the FF algorithm, WF requires that the next weight goes into the open bin that has the MOST available space left.

Shelves: WF Each “bin” below is 9ft long. Let’s use the WF algorithm to figure out how many we need. 6, 6, 5, 5, 5, 4, 4, 2, 2, 2, 3, 7, 8, 8

Why we use each algorithm Next-Fit: Can be used when “bins” are being taken away as they are being packed. Imagine someone coming up and grabbing the bins that you are no longer using, so you are stuck with the one you’re on or a new bin. First-Fit: Packing storage containers full of items that are not breakable, therefore they can be packed tightly without fear of breaking anything inside the bin. Worst-Fit: Packing expensive breakables. WF allows for more space to be left over in each bin since it is more unlikely to completely fill each bin. Since there is extra space, items won’t be pressing against each other.

Decreasing-Time Heuristics As we have noticed, large weights toward the end of the list cannot be packed efficiently with smaller weights that occurred early. Therefore, if we organize the list before packing the weights from GREATEST to LEAST, we create three new algorithms that are more likely to be optimal. The three new algorithms are called Next-Fit Decreasing (NFD), First- Fit Decreasing (FFD), and Worst-Fit Decreasing (WFD).

Next-Fit Decreasing (NFD) Apply the NFD algorithm to the following list and pack them in the 9ft bins below. 6, 6, 5, 5, 5, 4, 4, 2, 2, 2, 3, 7, 8, 8

First-Fit Decreasing (FFD) Apply the FFD algorithm to the following list and pack them in the 9ft bins below. 6, 6, 5, 5, 5, 4, 4, 2, 2, 2, 3, 7, 8, 8

Worst-Fit Decreasing (WFD) Apply the WFD algorithm to the following list and pack them in the 9ft bins below. 6, 6, 5, 5, 5, 4, 4, 2, 2, 2, 3, 7, 8, 8

Conflict Resolution Read page 84. Stop at Example 5.

Example 5 (Page 85) FMHPEISC French (F) X XXX X Math (M)X XX History (H) XXX Philosophy (P)X X English (E)XX X Italian (I)XXX X X Spanish (S) X X Chemistry (C)X XX

Definitions Vertex Coloring: Assigning each vertex of a graph a color (label) such that two vertices joined by an edge are assigned different colors. Chromatic Number: The minimum number of colors needed to label the vertices of a graph so that no two vertices of the graph joined by an edge get the same color.

Four Color Theorem Alfred Kempe tried to prove Four Color Theorem in 1879, but in 1890 Percy John Heawood found an error. Heawood went on from Kempe’s work to instead prove Five Color Theorem. In 1976, Kenneth Appel and Wolfgang Haken proved four color theorem, however many modern mathematicians do not take the proof as fact because they required thousands of maps and a supercomputer to prove their theorem. No pencil and paper proof exists to this day.

Four Color Theorem No matter how complicated the map, only four colors are needed to color it such that no two adjacent sections are the same color. Try to draw a complicated map on a piece of paper. Then trade with a partner and see if they can color it using only four colors.

The table below represents species of plants that have competing light or water requirements. Draw a graph that represents the conflicts and find the minimum number of habitats that would be needed to display all these plants in a garden. ABCDE A X XX BX X C X X DX X X EX X

The following chart represents species of fish. There is an X between two species if they cannot survive in the same aquarium due to hostility, food needs, or other issues. Find out the minimum number of aquariums we need to house all of the different types of fish. Also, try your best to even out the number of fish in each aquarium. ABCDE A X XX BX XX C X DXX X EX X

John, Hannah, Autriana, Derek, and Karla are going on a field trip to the Math Factory with their awesome teacher, Mr. D. The only problem is some of the students HATE each other and cannot be in the car on the way to the Math Factory. How many cars will be needed, and who will be in each car, if the follow table represents students who do not like each other? JHADK John XXX Hannah X X AutrianaXX DerekX X KarlaXX X