Task Scheduling A Lecture in CE Freshman Seminar Series:

Slides:



Advertisements
Similar presentations
Apr. 2007SatisfiabilitySlide 1 Satisfiability A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
Advertisements

Chapter 3: Planning and Scheduling Lesson Plan
May 2015Binary SearchSlide 1 Binary Search A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
Bilkent University Department of Computer Engineering
May 2007Task SchedulingSlide 1 Task Scheduling A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
Apr. 2015SatisfiabilitySlide 1 Satisfiability A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
June 2007Malfunction DiagnosisSlide 1 Malfunction Diagnosis A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
HandoutLecture 7Task Scheduling Mini-Sudoku Puzzle Complete entries in this chart so that letters A-F appear without repetition in each row, each column.
Apr. 2007Placement and RoutingSlide 1 Placement and Routing A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
Mar. 2015Easy, Hard, Impossible!Slide 1 Easy, Hard, Impossible! A Lecture in CE Freshman Seminar Series: Puzzling Problems in Computer Engineering.
Feb. 2005Counting ProblemsSlide 1 Counting Problems A Lesson in the “Math + Fun!” Series.
Dec. 2004Math CrosswordsSlide 1 Math Crosswords A Lesson in the “Math + Fun!” Series.
Apr. 2007Easy, Hard, Impossible!Slide 1 Easy, Hard, Impossible! A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
May 2007Binary SearchSlide 1 Binary Search A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
May 2012Task SchedulingSlide 1 Task Scheduling A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
Apr. 2015Placement and RoutingSlide 1 Placement and Routing A Lecture in CE Freshman Seminar Series: Puzzling Problems in Computer Engineering.
May 2007String MatchingSlide 1 String Matching A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
PowerPoint: Tables Computer Information Technology Section 5-11 Some text and examples used with permission from: Note: We are.
The Mathematics of Sudoku Helmer Aslaksen Department of Mathematics National University of Singapore
Solving Sudoku Mark PTTLS Micro teach. Solving Sudoku What is a Sudoku? A Sudoku is a number puzzle based on a 9x9 grid made up from smaller 3x3 blocks.
Mathematical Methods In Solving Sudoku Puzzles By: Cory Trenkamp Wright State University May 24, 2006.
 Optimal Packing of High- Precision Rectangles By Eric Huang & Richard E. Korf 25 th AAAI Conference, 2011 Florida Institute of Technology CSE 5694 Robotics.
Constraint Satisfaction Problems (CSPs) CPSC 322 – CSP 1 Poole & Mackworth textbook: Sections § Lecturer: Alan Mackworth September 28, 2012.
Scheduling policies for real- time embedded systems.
Fall CS-EE 480 Lillevik 480f06-l10 University of Portland School of Engineering Senior Design Lecture 10 Webs Scheduling MS Project (Optional)
Whiteboardmaths.com © 2008 All rights reserved
1 Short Term Scheduling. 2  Planning horizon is short  Multiple unique jobs (tasks) with varying processing times and due dates  Multiple unique jobs.
HandoutMay 2007Task Scheduling A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
May 2015Sorting NetworksSlide 1 Sorting Networks A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
Memory Management OS Fazal Rehman Shamil. swapping Swapping concept comes in terms of process scheduling. Swapping is basically implemented by Medium.
CompSci Problem Solving: Sudoku  Rules of the Game Sudoku is played with a 9 by 9 "board" consisting of nine 3 by 3 sub-boards. The symbols 1 -
May 2007Sorting NetworksSlide 1 Sorting Networks A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
Constraint Satisfaction Problems (CSPs) Introduction
Some Topics in OR.
Chapter 2 Memory and process management
Hard Problems Some problems are hard to solve.
CHP - 9 File Structures.
Algorithm Design Methods
Memory Management 6/20/ :27 PM
Mathematical Illusions
PowerPoint: Tables and Charts
Intro to Processes CSSE 332 Operating Systems
Design and Analysis of Algorithm
Approximation Algorithms
Statistical Analysis with Excel
Teaching slides Chapter 1.
Professor Arne Thesen, University of Wisconsin-Madison
CSCI1600: Embedded and Real Time Software
3D Models from 2D Images A Lecture in the Freshman Seminar Series:
Satisfiability A Lecture in CE Freshman Seminar Series:
Statistical Analysis with Excel
Objective of This Course
TransCAD Vehicle Routing 2018/11/29.
Introduction to Scheduling Chapter 1
Greedy Algorithms Alexandra Stefan.
Sudoku (数独 sūdoku?), also known as Number Place or Nanpure, is a logic-based placement puzzle. The objective is to fill the grid so that every column,
CSE451 Virtual Memory Paging Autumn 2002
Placement and Routing A Lecture in CE Freshman Seminar Series:
Sorting Networks A Lecture in CE Freshman Seminar Series:
Planning and Scheduling
3D Models from 2D Images A Lecture in the Freshman Seminar Series:
Easy, Hard, Impossible! A Lecture in CE Freshman Seminar Series:
Data Structures & Algorithms
Algorithm Design Methods
Malfunction Diagnosis
Binary Search A Lecture in CE Freshman Seminar Series:
Mathematical Illusions
Chapter 3: Planning and Scheduling Lesson Plan
CSCI1600: Embedded and Real Time Software
Algorithm Design Methods
Presentation transcript:

Task Scheduling A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering May 2016 Task Scheduling

About This Presentation This presentation belongs to the lecture series entitled “Ten Puzzling Problems in Computer Engineering,” devised for a ten-week, one-unit, freshman seminar course by Behrooz Parhami, Professor of Computer Engineering at University of California, Santa Barbara. The material can be used freely in teaching and other educational settings. Unauthorized uses, including any use for financial gain, are prohibited. © Behrooz Parhami Edition Released Revised First May 2007 May 2008 May 2009 May 2010 May 2011 May 2012 May 2015 May 2016 May 2016 Task Scheduling

Mini-Sudoku Puzzle Complete entries in this chart so that numbers 1-6 appear without repetition in each row, each column and each 2  3 block 2 4 1 Standard Sudoku consists of a 9  9 chart, but this mini version is good for a quick fix 6 3 1 5 3 6 USA Today carries a daily mini-Sudoku at its site: http://puzzles.usatoday.com 4 6 Sudoku isn’t a math puzzle: We can use the letters A-F, or any other six symbols, instead of the numbers 1-6 3   May 2016 Task Scheduling

Mini-Sudoku Puzzle: Solution Method Complete entries in this chart so that letters A-F appear without repetition in each row, each column and each 2  3 block B D A F C E 2 D C AE C 4 1 To continue from here, write down all possible choices in the remaining blank boxes and see whether the resulting info leads to more progress 6 D 3 1 B A 5 3 D 6 SuDoKu: abbr. in Japanese for “numbers must be single.” Euler may have invented it; Howard Garns (US) & Wayne Gould (HK) popularized it in modern times 4 C 6 A 3 D AE   May 2016 Task Scheduling

Sudoku Puzzle: Easy Example Complete entries in this chart so that numbers 1-9 appear without repetition in each row, each column and each 3  3 block 5 4 7 6 9 2 1 3 8 Many newspapers carry these puzzles; there are also many collections in book form Sudoku puzzles of varying difficulties (easy, medium, hard, evil) are available at http://www.websudoku.com and several other Web sites, such as USA Today’s site http://puzzles.usatoday.com   May 2016 Task Scheduling

Sudoku Puzzle Solution Method Strategy 1: Identify a missing number from a row, column, or block; if you can exclude all but one cell for that number, then write it down 5 4 7 6 9 2 1 3 8 8 7, 8, 9 missing from this column 1379 25 4 6 9 1 Strategy 2: When you can’t make progress by Strategy 1, write down all candidate numbers in the cells and try to eliminate a number of options via reasoning. For example if xy, xy, xyz are candidates in three cells of a block, then the cell marked xyz must hold z 58 7 2 9 7 28 3 1 4 7 6 1 8 in the upper middle block 6 in 4th row 7 in 7th row 6 in 7th row 13 14 23 4 1 1, 2, 3, 4 missing from this row 2   May 2016 Task Scheduling

Sudoku Puzzle: Hard Example Complete entries in this chart so that numbers 1-9 appear without repetition in each row, each column and each 3  3 block 4 1 6 8 5 3 9 2 7 Hard puzzles typically have fewer entries supplied, with each row, column, or block containing only a few entries Hard puzzles may have handles or starting points (5 in the top left block or 9 in center and lower right blocks)   May 2016 Task Scheduling

Constructing a (Mini-)Sudoku Puzzle Begin with a completed puzzle and one by one remove selected entries that can be deduced from the remaining ones 2 4 1 6 3 2 4 3 3 4 1 This will ensure a unique solution, which is a desirable attribute 6 3 1 4 3 2 1 5 3 6 5 4 Interesting fact: In a 9  9 Sudoku puzzle, you may need at least 17 initial entries (clues) for the solution to be unique; no one knows whether a 16-clue puzzle with unique solution exists 4 3 6 5 2 1 http://people.csse.uwa.edu.au/gordon/sudokumin.php (Web page devoted to minimum Sudoku) 3 4 http://people.csse.uwa.edu.au/gordon/sudokumin.php (Web page devoted to minimum Sudoku)   May 2016 Task Scheduling

Variations on Sudoku Other sizes (e.g., 6  6, with 2  3 blocks; or 16  16, with 4  4 blocks) Combining this 2000s phenomenon with Rubik’s cube of the 1980s . . . or with the age-old sliding 15 puzzle Latin square May 2016 Task Scheduling

Task Scheduling Problem We have a set of of tasks Numbers in Sudoku puzzle There are some “processors” that can execute tasks Cells in Sudoku puzzle can hold numbers Assign tasks to processors so as to meet certain constraints Place numbers in cells while honoring some constraints A task may fit only some processors Tasks may have prerequisite tasks Preemption may be (dis)allowed Tasks may have deadlines Shortest schedule may be sought Use only numbers 1-9 Some numbers already placed Different numbers in each row Different numbers in each column Different numbers in each block Virtually all instances of the task scheduling problem are difficult (NP-hard), just like Sudoku May 2016 Task Scheduling

Resource Allocation Problem We have a set of of resources Numbers in Sudoku puzzle There are “locations” where resources may be placed Cells in Sudoku puzzle can hold numbers Assign resources to locations to meet certain constraints Place numbers in cells while honoring some constraints A resource may fit only some locations Resources must be “easily” accessible Resource mobility may be (dis)allowed Resource cost may differ by location Lowest-cost assignment may be sought Use only numbers 1-9 Some numbers already placed Different numbers in each row Different numbers in each column Different numbers in each block Virtually all instances of the resource allocation problem are difficult (NP-hard), just like Sudoku May 2016 Task Scheduling

Scheduling Required CE Courses Math 3A ECE 1 Chem 1A Chem 1AL CS 10 Math 3B Phys 1 Chem 1B Chem 1BL 1 2 3 4 5 Units 12 units CS 20 Math 3C Phys 2 20 units CS 40 CS 60 Phys 3L Phys 3 Math 5A ECE 2A Phys 4L Phys 4 ECE 15A ECE 2B Upper -division standing Engr 101 ECE 15B ECE 2C Or CS 30 Constraints Prerequisite: Solid downward arrow Corequisite: Dashed sideways arrow Units per quarter:  18 ECE 152A ECE 139 Or CS 30 Or PSTAT 120A CS 130A ECE 154 ECE 152B CS 170 May 2016 Task Scheduling

Scheduling Required CE Courses Math 3A ECE 1 Chem 1A Chem 1AL CS 10 Math 3B Phys 1 Chem 1B Chem 1BL 1 2 3 4 5 Units 12 units CS 20 Math 3C Phys 2 16 20 units CS 40 CS 60 Phys 3L Phys 3 Math 5A ECE 2A Phys 4L Phys 4 ECE 15A ECE 2B Upper -division standing Engr 101 ECE 15B ECE 2C Or CS 30 Constraints Prerequisite: Solid downward arrow Corequisite: Dashed sideways arrow Units per quarter:  18 ECE 152A ECE 139 Or CS 30 Or PSTAT 120A Almost done! CS 130A ECE 154 ECE 152B CS 170 May 2016 Task Scheduling

Job-Shop Scheduling Ta2 Tb1 Tc1 Td1 Td2 Ta1 Tb2 Tb3 M1 M2 M3 Tb1 Tc1 Time 2 4 6 8 10 12 14 S t a f Ta2 Tb1 Tc1 Td1 Td2 Ta1 Tb2 Tb3 Job Task Machine Time Staff Ja Ta1 M1 2 3 Ja Ta2 M3 6 2 Jb Tb1 M2 5 2 Jb Tb2 M1 3 3 Jb Tb3 M2 3 2 Jc Tc1 M3 4 2 Jd Td1 M1 5 4 Jd Td2 M2 2 1 M1 M2 M3 Time 2 4 6 8 10 12 14 S t a f Tb1 Tc1 Ta1 Ta2 Tb2 Td2 Tb3 Td1 Static scheduling: all tasks and resources are known in advance May 2016 Task Scheduling

Schedule Refinement Tb1 Tc1 Ta1 Ta2 Tb2 Td2 Tb3 Td1 M1 M2 M3 Tb1 Ta1 Time 2 4 6 8 10 12 14 S t a f Tb1 Tc1 Ta1 Ta2 Tb2 Td2 Tb3 Td1 Switch? Job Task Machine Time Staff Ja Ta1 M1 2 3 Ja Ta2 M3 6 2 Jb Tb1 M2 5 2 Jb Tb2 M1 3 3 Jb Tb3 M2 3 2 Jc Tc1 M3 4 2 Jd Td1 M1 5 4 Jd Td2 M2 2 1 M1 M2 M3 Time 2 4 6 8 10 12 14 S t a f Tb1 Ta1 Tb2 Td1 Tb3 Tc1 Static scheduling: all tasks and resources are known in advance Ta2 Td2 May 2016 Task Scheduling

Truck Scheduling 50% 35% 40% 75% 20% Seattle Required trip Portland 00% Truck load 40% 35% 50% 75% 20% Boise Chicago Truck location NYC SF LA Dallas Dynamic scheduling: New customer orders are generated while trucks move between cities Orlando May 2016 Task Scheduling

Multiprocessor Scheduling 8 7 6 5 4 3 2 1 1 2 3 4 5 6 7 8 9 10 11 12 13 13 1 2 3 4 5 6 7 8 9 10 11 12 Task graph with unit-time tasks Here’s a heuristic known as list scheduling: 1. Find the depth T of the task graph 2. Take T as a goal for the running time Tp 3. Determine the latest possible start times 4. Assign priorities in order of latest times T = 8 (execution time goal) Latest start times: see the layered diagram Priorities: shown on the diagram in red When two tasks have the same “latest start time,” a secondary tie-breaking rule is used May 2016 Task Scheduling

Assignment to Processors 8 7 6 5 4 3 2 1 13 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 13 Tasks listed in priority order 1* 2 3 4 6 5 7 8 9 10 11 12 13 1 2 3 4 6 5 7 8 9 10 11 12 13 P1 1 2 3 4 5 6 7 8 10 11 12 13 9 Time Step 1 2 3 4 5 6 7 8 9 10 11 12 13 P1 P2 1 2 3 4 5 6 7 8 9 10 11 12 13 P1 P2 P3 Even in this simple case of unit-time tasks, multiprocessor scheduling remains difficult with as few as 3 processors May 2016 Task Scheduling

Two Related and Similar Problems The knapsack problem Off-line game of Tetris We have storage capacity W and n files of sizes wi and values vi We have a rectangular bin and a sequence of tetrominos Pick a max-value subset of files that fit in the storage space W Find optimal play to maximize the number of pieces used Files cannot be broken into pieces Naïve solution: Examine all 2n subsets Dynamic programming solution Various heuristic aids Approx. solutions (say, 90% of optimal) Pieces can only be rotated Exponentially many choices There are many other related and similarly hard problems, some of which don’t even admit efficient approximations May 2016 Task Scheduling