Chapter 3: Planning and Scheduling. Planning and Scheduling - Topics Resolving Conflict via Coloring Bin Packing Scheduling Tasks Critical-Path Schedules.

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 (I) Fall 2003 CSE, POSTECH.
Algorithm Design Methods Spring 2007 CSE, POSTECH.
 Review: The Greedy Method
Chapter 3: Planning and Scheduling Lesson Plan
Greed is good. (Some of the time)
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.
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.
Last time: terminology reminder w Simple graph Vertex = node Edge Degree Weight Neighbours Complete Dual Bipartite Planar Cycle Tree Path Circuit Components.
Graph Colouring Lecture 20: Nov 25.
The Mathematics of Scheduling Chapter 8. How long does it take to build a house? It depends on Size of the house Type of construction Number of workers.
CSE 421 Algorithms Richard Anderson Lecture 6 Greedy Algorithms.
Sequencing Problem.
Chapter 2: Business Efficiency Lesson Plan Business Efficiency  Visiting Vertices-Graph Theory Problem Hamiltonian Circuits  Vacation Planning Problem.
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
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.
Spring 2015 Mathematics in Management Science Conflict Scheduling Vertex Coloring Chromatic Number Conflict Resolution.
Critical Path Analysis
Spring 2015 Mathematics in Management Science Bin Packing The Problem The Algorithms.
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.
Graph Colouring L09: Oct 10. This Lecture Graph coloring is another important problem in graph theory. It also has many applications, including the famous.
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
Chapter 2: Business Efficiency Lesson Plan Business Efficiency  Visiting Vertices-Graph Theory Problem Hamiltonian Circuits  Vacation Planning Problem.
For getting out of Ohio State Applications of Graph and Scheduling Theory for getting out of Ohio State Eugene Talagrand Mauktik Gandhi Jeff Mathew.
Graph Colouring Lecture 20: Nov 25. This Lecture Graph coloring is another important problem in graph theory. It also has many applications, including.
Graphs A ‘Graph’ is a diagram that shows how things are connected together. It makes no attempt to draw actual paths or routes and scale is generally inconsequential.
Algorithm Design Methods 황승원 Fall 2011 CSE, POSTECH.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
CSEP 521 Applied Algorithms Richard Anderson Winter 2013 Lecture 3.
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.
Unit 3 Scheduling and Planning. Literacy Practice Please read PG Stop at ASSUMPTIONS AND GOALS on page 68.
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.
DECISION 1. How do you do a Bubble Sort? Bubble Sort:  You compare adjacent items in a list;  If they are in order, leave them.  If they are not in.
1 Job Shop Scheduling. 2 Job shop environment: m machines, n jobs objective function Each job follows a predetermined route Routes are not necessarily.
Greedy Algorithms.
8 The Mathematics of Scheduling
Algorithm Design Methods
Chapter 2: Business Efficiency Lesson Plan
Chapter 2: Business Efficiency Lesson Plan
Greedy Method     Greedy Matching     Coin Changing     Minimum Spanning Tree     Fractional Knapsack     Dijkstra's Single-Source Shortest-Path.
Decision Maths Dijkstra’s Algorithm.
Scheduling Theory By Sarah Walker 12/4/2018.
Chapter 2: Business Efficiency Business Efficiency
Exam 2 LZW not on syllabus. 73% / 75%.
Advanced Analysis of Algorithms
Applied Combinatorics, 4th Ed. Alan Tucker
Richard Anderson Lecture 6 Greedy Algorithms
Richard Anderson Autumn 2016 Lecture 7
Planning and Scheduling
Richard Anderson Lecture 7 Greedy Algorithms
Planning and Scheduling
Algorithm Design Methods
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
List Processing (SOL: DM.10)
Algorithm Design Methods
Chapter 1: Urban Services Management Science
Graph Algorithms: Shortest Path
Richard Anderson Winter 2019 Lecture 7
Richard Anderson Autumn 2015 Lecture 7
Chapter 3: Planning and Scheduling Lesson Plan
Chapter 1: Urban Services Lesson Plan
Algorithm Design Methods
Richard Anderson Autumn 2019 Lecture 7
Presentation transcript:

Chapter 3: Planning and Scheduling

Planning and Scheduling - Topics Resolving Conflict via Coloring Bin Packing Scheduling Tasks Critical-Path Schedules Independent Tasks 2

3 Resolving Conflict Resolving Conflict Goals of Three Scheduling Problems Optimization issues – Try to maximize profit, minimize cost. Example: Scheduling machine time for earliest completion time

4 Resolving Conflict Resolving Conflict Goals of Three Scheduling Problems Equity – Try to make things fair for all participants. Example: Schedule baseball games (same number home and away games)

5 Resolving Conflict Resolving Conflict Goals of Three Scheduling Problems Conflict Resolution – Try to prevent conflicts from happening. Example: Scheduling college final examinations for end of term

The goal of a map coloring problem is to color a map so that regions sharing a common border have different colors. (Regions that meet only in a point may share a common color.)

What is the least amount of colors needed?

What is the least amount of colors needed? 3

Resolving Conflict via Coloring Chromatic Number Chromatic Number The chromatic number is the minimum number of colors necessary to color a map so that regions sharing a common border have different colors

Resolving Conflict via Coloring Chromatic Number Chromatic Number For example, the chromatic number for the map above is 3 since it takes at least 3 colors to color the map so that regions sharing a common border have different colors. Why can't it be done with 2 colors?

Resolving Conflict via Coloring A map coloring problem can be solved by first converting the map into a graph where each region is a vertex and an edge connects two vertices if and only if the corresponding regions share a border.

Resolving Conflict via Coloring Once a map is converted into a graph, a process called vertex coloring can be used to decide how the map should be colored.

Resolving Conflict via Coloring For example, using the original graph above, we convert each country to a vertex. (We'll use open circles instead of filled dots to make it easier to color them later.)

Resolving Conflict via Coloring

 Now we add the edges. Two countries are connected by an edge if and only if they have a common border (but not if they just meet at a point). This gives:

Resolving Conflict via Coloring

To "color" a graph, we follow the following vertex coloring rules: Vertex coloring rules Vertices connected by an edge must be different colors. Use the fewest possible number of colors.

Resolving Conflict via Coloring Continuing the example, one way of doing the vertex coloring (that happens to correspond to the colors used in the second map above) is:

Resolving Conflict via Coloring This same idea can be used to solve other problems. Example: those in which people or things must be grouped or organized based on conflicts among the people or things. those in which people or things must be grouped or organized based on conflicts among the people or things.

Resolving Conflict via Coloring In such a situation, the people (or things) are represented by vertices and conflicts between two people (or things) are represented by a connecting edge. In such a situation, the people (or things) are represented by vertices and conflicts between two people (or things) are represented by a connecting edge.

21 Resolving Conflict via Coloring Example: Scheduling Exams Using Vertex Coloring There are eight (8) finals to schedule with only two (2) air- conditioned rooms. (8 courses: French-F, Math-M, History-H, Philosophy-P, English-E, Italian-I, Spanish-S, Chemistry-C).

22 Resolving Conflict via Coloring Example: Scheduling Exams Using Vertex Coloring In the graph, courses are represented by vertices and two course are joined by an edge for every student enrolled in both courses.

Resolving Conflict via Coloring The graph represents conflict info about the courses.

Resolving Conflict via Coloring 8 colors represent 8 time slots — not optimal. It means 8 rooms are needed.

25 Resolving Conflict via Coloring 4 colors — 4 time slots but need 3 rooms for time slot 2.

26 Resolving Conflict via Coloring d) 4 colors with 4 time slots each color appears twice so only need 2 air condition rooms.

27 Resolving Conflict via Coloring The chromatic number is 4 as in d (we scheduled 8 exams in 4 time slots without a conflict).

28 Bin Packing The problem of finding the minimum number of bins (containers) into which the weight (object) can be packed. Once again, there is no fast or optimal algorithm, so we will look at several methods and compare them.

29 Bin Packing Six Methods Next Fit (NF) Next Fit Decreasing (NFD) First Fit (FF) First Fit Decreasing (FFD) Worse Fit (WF)Worse Fit Decreasing (WFD)

30 Bin Packing Next Fit (NF) – A new bin is opened if the weight to be packed next will not fit in the bin that is currently being filled; the current bin is then closed. First Fit (FF) – The next weight to be packed is placed in the lowest- numbered bin already opened into which it will fit. If it does not fit in any open bins, a new bin is opened.

31 Bin Packing Worse Fit (WF) – The next weight to be packed is placed into the open bin with the largest amount of room remaining. If it does not fit in any bins, open a new bin. Decreasing-Time (NFD, FFD, WFD) – list the weights in order of decreasing size before the bin-packing method. Does NOT guarantee optimal solution.

32 Bin Packing Next Fit (NF) Advantages – Does not require knowledge of all the weights in advance; only need to know the remaining space in the bin. Disadvantages – The bin packed early on may have had room for small items that come later in the list. Best method for assembly-line packing.

33 Bin Packing First Fit (FF) Advantages – Does not require knowledge of all the weights in advance. Disadvantages – Large number of bins will cause issues, large amount of computer storage Best method for small amount of items to be packed.

Scheduling Tasks Examples: Around-the-clock scheduling of doctors and nurses, scheduling equipment (X-rays, MRI scans) for maximum efficiency Organizing all sub-contractors (electric, plumbing, etc) to get a house built. 34

Scheduling Tasks Examples: Schedule all different crews that are necessary to prepare a plane for next flight Creating a High School Yearbook 35

Scheduling Tasks Accurate planning and scheduling is required of both people and machines. 36 Processors  A person, machine, robot, operating room, or runway (for airplanes) whose time must be scheduled.

Scheduling Tasks Accurate planning and scheduling is required of both people and machines. 37 Machine-Scheduling Problem  The problem of deciding how the tasks should be scheduled so the entire job is completed as early as possible.

Assumptions When a processor starts a task, it will be completed without interruption. Any processor can work on any of the tasks. No processor stays idle voluntarily. Scheduling Tasks 38

Assumptions Order-requirement digraph is used to show the task order and has the task times highlighted within each vertex. Priority lists arrange the tasks in order, independent of the order requirements. Used to “break ties” if more than one task is ready. Scheduling Tasks 39

Goals to Consider Minimize the completion time of the job. Minimize the total time the processors are idle. Find the minimum number of processors necessary to finish the job by a specified time. Scheduling Tasks 40

41 When is the schedule optimal? Optimal Time = Total time of all tasks/# processors. Completion Time: length of longest processor Idle Time is the amount of total time the processors are not used.

42 When is the schedule optimal? If the schedule completion time = the length of critical path, then the schedule is optimal (earliest completion time).

Order-Requirement Digraph A directed graph (digraph) that shows which tasks precede other tasks among the collection of tasks making up a job.

Independent Tasks Tasks that are independent of each other if they can be performed in any order (no edges in the order-requirement digraph). Label the tasks by their task times rather than their task number.

Independent Tasks The list-processing algorithm can be used to schedule the tasks onto machines using the given list but may not be efficient. Geometrically, we can think of independent tasks as rectangles of height 1.

Independent Tasks Diagram of a task schedule on 2 processors

47 List Processing Algorithm Also called “First come, First serve” Algorithm Put finger on available processor (whenever there is a tie, lowest numbered processor) Schedule 1 st task from the priority list on the available processor. Cross it off the list.

48 List Processing Algorithm 3. Put finger on processor that is behind. Schedule next task from the priority list onto the processor. Remove this task from priority list. 4. Repeat 1-3 until all tasks are scheduled. 5. Create idle time to “even-up” processors.

Decreasing-Time List Algorithm 1) Arrange tasks in decreasing order by time. This becomes the priority list, 2) Apply the List Processing Algorithm.

Decreasing-Time List Algorithm Example: Apply decreasing-time list algorithm on independent tasks 10, 9, 7, 7, 5, 4 (already in order) This result is an optimal schedule!

Dependent Tasks Complications arise with jobs consisting of several tasks that cannot be done in an arbitrary order.

Dependent Tasks Example: Treating the job of building a house as a scheduling problem, what must occur first? Order these tasks: working on the roof, putting up the walls, laying the foundation Laying foundation, putting up the walls, working on roof

53 Order-Requirement Digraph For the next example, tasks are labeled as T1–T8. The length of time for each task is indicated in a colored circle.

54 Order-Requirement Digraph At the beginning (time = 0), tasks T1, T7, T8 are ready to be scheduled on machines.

55 Scheduling Tasks Processors  For this example, tasks will be scheduled on two machines according to the order-requirement digraph and priority list.

56 Scheduling Tasks Priority List  A list that ranks the tasks in some criterion of importance. Used to “break ties” if more than one task is ready.

57 Scheduling Tasks Priority List  Ready task – A task is ready if its predecessors have been completed by that time as given by the order- requirement digraph.  For the problem, the priority list is T1, T2, T3, T4, T5, T6, T7, T8.

58 Scheduling Tasks on Machines

Critical Path Critical Path is BE = = 52 min. The longest path in an order-requirement digraph. The length is measured in terms of summing the task times of the tasks making up the path.

60 Critical Path Schedules A systematic method of choosing/creating a priority list, that yields optimal, or nearly optimal, schedules.

61 Critical Path Scheduling Algorithm (to create a Priority List) Evaluate paths and find critical (longest) path in the order- requirement digraph. If a tie, choose path with the lowest-number task Remove first task occurring in that path and put it first in the priority list. (Remove the task found in step 1 and the edges attached to it from the current order-requirement digraph).

62 Critical Path Scheduling Algorithm (to create a Priority List) 3. With this task removed, evaluate new completion time for this path. (reduce path by length of task). 4. If there is more than one path from which to choose, assign the lowest numbered task to the priority list.

63 Critical Path Scheduling Algorithm (to create a Priority List) 5. Repeat 1-4 until all tasks have been placed on the priority list. 6. Apply list processing algorithm, along with order-requirement digraph, to schedule all tasks on the given number of processors.

64 Example of Critical-Path Scheduling Algorithm For this order-requirement digraph, there are two critical paths of length 64: T1, T2, T3 and T1, T4, T3. Place T1 on the list L.

65 Example of Critical-Path Scheduling Algorithm With T1 “gone,” there is a new critical path of length 60: T5, T6, T4, T3. Place T5 next on the list L.

66 Example of Critical-Path Scheduling Algorithm With T1 and T5 “gone,” the next longest path would be 56: T6, T4, T3. Place T6 next on the list L. (Continue the algorithm until list is complete.)

67 Critical Path Schedules The new priority list would be: T1, T5, T6, T2, T3, T3, T8, T9, T7, T10. Using the list-processing algorithm with the new priority list, the following schedule is obtained:

68 Example of Critical-Path Scheduling Algorithm For this order-requirement digraph, the critical path of length 27: T1, T2, T3, T4. Place T1 on the list.