Spring 2015 Mathematics in Management Science Bin Packing The Problem The Algorithms.

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

1 Chapter 8 Approximation Algorithms (Part II). 2 Outline Scheduling Independent tasks Bin packing.
Algorithm Design Methods (I) Fall 2003 CSE, POSTECH.
Algorithm Design Methods Spring 2007 CSE, POSTECH.
Bin Packing First fit decreasing algorithm
 Review: The Greedy Method
Real-Time Mutli-core Scheduling Moris Behnam. Introduction Single processor scheduling – E.g., t 1 (P=10,C=5), t 2 (10, 6) – U= >1 – Use a faster.
MCS 312: NP Completeness and Approximation algorithms Instructor Neelima Gupta
D1 Algorithms Sorting algorithms. Bubble sort- repeated passes through a list of numbers by comparing and switching adjacent numbers Try for 16, 9, 4,
Chapter 3: Planning and Scheduling Lesson Plan
Biologically Inspired Computation Really finishing off EC.
Tournament Trees CSE, POSTECH.
Reservation Systems TimeTabling
Carnegie Mellon R-BATCH: Task Partitioning for Fault-tolerant Multiprocessor Real-Time Systems Junsung Kim, Karthik Lakshmanan and Raj Rajkumar Electrical.
Assignment of Different-Sized Inputs in MapReduce Shantanu Sharma 2 joint work with Foto N. Afrati 1, Shlomi Dolev 2, Ephraim Korach 2, and Jeffrey D.
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.
Lecture 1: Introduction to the Course of Optimization 主講人 : 虞台文.
CPSC 171 Introduction to Computer Science More Efficiency of Algorithms.
PTAS for Bin-Packing. Special Cases of Bin Packing 1. All item sizes smaller than Claim 1: Proof: If then So assume Therefore:
CSE 421 Algorithms Richard Anderson Lecture 6 Greedy Algorithms.
© J. Christopher Beck Lecture 18: Timetabling with Workforce Capacity.
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,
Improved results for a memory allocation problem Rob van Stee University of Karlsruhe Germany Leah Epstein University of Haifa Israel WADS 2007 WAOA 2007.
Why is bin packing interesting?
Critical Path Analysis
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.
Flexible Assembly line Minimum part set(MPS) Suppose there are l product types. Let N l denote the number of jobs for each product type l. If z is the.
Spring 2015 Mathematics in Management Science Critical Path Scheduling Critical Paths & Times Backflow Algorithm Critical Times PL Critical Path Algorithm.
Outline Introduction Minimizing the makespan Minimizing total flowtime
1 Approximation Algorithm Updated at 2011/01/03. 2 Approximation Algorithm Up to now, the best algorithm for solving an NP-complete problem requires exponential.
1 Algorithms & Data Structures for Games Lecture 2A Minor Games Programming.
By Christos Giavroudis Dissertation submitted in partial fulfilment for the degree of Master of Science in Communication & Information Systems Department.
Parallel Machine Scheduling
CS 3343: Analysis of Algorithms Lecture 18: More Examples on Dynamic Programming.
1 Chapter 5-1 Greedy Algorithms Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
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.
CS 3343: Analysis of Algorithms Lecture 19: Introduction to Greedy Algorithms.
Biologically Inspired Computing: Indirect Encodings, and Hyperheuristics This is DWC’s lecture 7 for `Biologically Inspired Computing’ Contents: direct.
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.
Bin packing Teacher’s guide. Copper tubing is sold in 10m lengths. For a particular job, the following lengths are required: 2m, 2m, 4m, 4m, 5m, 5m, 8m.
BIN SORTING Problem Pack the following items in bins of size Firstly, find the lower bound by summing the numbers to be packed.
Chapter 3: Planning and Scheduling. Planning and Scheduling - Topics Resolving Conflict via Coloring Bin Packing Scheduling Tasks Critical-Path Schedules.
Multiprocessor Real-Time Scheduling
Chapter 2 Memory and process management
Bin Packing First fit decreasing algorithm
Bin Packing First fit algorithm
Algorithm Design Methods
Greedy Algorithms.
Exam 2 LZW not on syllabus. 73% / 75%.
Bin Packing First fit decreasing algorithm
Bin packing – First fit algorithm
PTAS for Bin-Packing.
Richard Anderson Lecture 6 Greedy Algorithms
Bin Packing First fit decreasing algorithm
Richard Anderson Lecture 7 Greedy Algorithms
Bin Packing First fit decreasing algorithm
Planning and Scheduling
Algorithm Design Methods
ICS 353: Design and Analysis of Algorithms
Algorithm Design Methods
Bin Packing First fit algorithm
Chapter 3: Planning and Scheduling Lesson Plan
Bin Packing Michael T. Goodrich Some slides adapted from slides from
Approximation Algorithm
Algorithm Design Methods
Presentation transcript:

Spring 2015 Mathematics in Management Science Bin Packing The Problem The Algorithms

Different Scheduling Problem Have collection of idpt tasks (all task times ≤ 10). Instead of asking how long to finish job with 3 processors, instead ask, “What is fewest number of processors need to finish job in under 20 min?” A very different question! Example of a bin-packing problem.

The Bin Packing Problem Assume have: identical “bins” fixed capacity, and objects (“weights”) of various sizes that must be packed in bins. How can we do this most efficiently (i.e., with fewest bins)?

Example A company buys bulk wire in 100 ft spools. They use the wire in a variety of lengths in their product. How should they cut the wire so as to use the fewest spools?

Example A wall unit requires boards of lengths: 6, 5, 4, 5, 3, 2, 2, 2, 7, 5, 5, 8, 4, 4 Stock boards come in 9ft lengths. How should we cut the boards so as to minimize the cost of material?

Variants Two possibilities: 1. Only know next weight to pack. (Think assembly line.) 2. Have full knowledge of all needed sizes/weights. (E.g., a work order that lists everything that is needed.)

Variants Two possibilities: 1. Only know next wt to pack. 2. Full knowledge all weights. In (2), it makes sense to first sort the weights in a decreasing list. (Why?) Leads to two variants of every bin- packing algorithm.

Variants Two variants of every bin-packing algorithm.

The Bin Packing Problem Pack wts w 1, w 2, …,w n into bins. Each bin has fixed capacity. Use as few bins as possible. A scheduling problem in disguise! unlimited # of procs each with fixed capacity (Goal: minimize # procs)

Dictionary Scheduling task task time processor completion time completing a task # of processors Bin Packing item to pack weight of item bin bin size packing an item # of bins

The Algorithms Heuristic Algorithms NF – Next Fit FF – First Fit WF – Worst Fit In last 2, bins stay open until they are completely full. Decreasing Versions NFD – Next Fit D FFD – First Fit D WFD – Worst Fit D With these first sort wts into decreasing order, then pack.

Next Fit Packing Algortihm Only one bin open at a time! Pack item in current bin. If item will not fit in current bin: close this bin & open a new bin. Continue until all items packed.

Example using Next Fit Packing Wts 6, 6, 5, 5, 5, 4, 4, 4, 4, 2, 2, 2, 2, 3, 3, 7, 7, 5, 5, 8, 8, 4, 4, 5

Next Fit Packing Algortihm Advantages – Do not need to know 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.

First Fit & Worst Fit Packing Keep all bins open until full. Then close. To pack an item, look at open bins. FF Place item in first bin in which it fits. WF Place item in bin with the most space (and into which item fits). Only open new bin if item will not fit in any of the already open bins.

16 Bin Packing Methods Next Fit & First Fit & Worst 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. 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. 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.

17 Bin Packing Methods Next Fit Decreasing (NFD) First Fit Decreasing(FFD) Worse Fit Decreasing(WFD) Decreasing-Time Heuristics NFD, FFD, WFD – Create the priority list by listing the weights in order of decreasing size before applying selected bin-packing method.

Example: Next Fit A wall unit requires boards of lengths: 6, 5, 4, 5, 3, 2, 2, 2, 7, 5, 5, 8, 4, 4 Stock boards come in 9 ' lengths(!). How should you cut the boards so as to minimize the cost of material? Use (1) NF and (2) NFD. Next Fit:Next Fit:6, 5, 4, 5, 3, 2, 2, 2, 7, 5, 5, 8, 4, 46, 5, 4, 5, 3, 2, 2, 2, 7, 5, 5, 8, 4,

Example: Next Fit A wall unit requires boards of lengths: 6, 5, 4, 5, 3, 2, 2, 2, 7, 5, 5, 8, 4, 4 Stock boards come in 9' lengths(!). How should you cut the boards so as to minimize the cost of material? Use (1) NF and (2) NFD. Next Fit Decreasing:Next Fit Decreasing:8, 7, 6, 5, 5, 5, 5, 4, 4, 4, 3, 2, 2, 28, 7, 6, 5, 5, 5, 5, 4, 4, 4, 3, 2, 2,

Example Pack the following weights: 6, 5, 7, 3, 4, 2 in bins of size 10 using (1) NF and (2) NFD. Next Fit:NFD: 7, 6, 5, 4, 3, 2 3

Example: First Fit A wall unit requires boards of lengths: 6, 5, 4, 5, 3, 2, 2, 2, 7, 5, 5, 8, 4, 4 Stock boards come in 9' lengths(!). How should you cut the boards so as to minimize the cost of material? Use (1) FF and (2) FFD. First Fit:First Fit:6, 5, 4, 5, 3, 2, 2, 2, 7, 5, 5, 8, 4, 46, 5, 4, 5, 3, 2, 2, 2, 7, 5, 5, 8, 4,

Example: First Fit A wall unit requires boards of lengths: 6, 5, 4, 5, 3, 2, 2, 2, 7, 5, 5, 8, 4, 4 Stock boards come in 9 1 lengths(!). How should you cut the boards so as to minimize the cost of material? Use (1) FF and (2) FFD. First Fit Decreasing:First Fit Decreasing:8, 7, 6, 5, 5, 5, 5, 4, 4, 4, 3, 2, 2, 28, 7, 6, 5, 5, 5, 5, 4, 4, 4, 3, 2, 2,

Example 4 Pack the following weights: 6, 5, 7, 3, 4, 2 in bins of size 10 using (1) FF and (2) FFD. First Fit:FFD: 7, 6, 5, 4, 3,

Example: Worst Fit A wall unit requires boards of lengths: 6, 5, 4, 5, 3, 2, 2, 2, 7, 5, 5, 8, 4, 4 Stock boards come in 9' lengths(!). How should you cut the boards so as to minimize the cost of material? Use (1) WF and (2) WFD. Worst Fit:Worst Fit:6, 5, 4, 5, 3, 2, 2, 2, 7, 5, 5, 8, 4, 46, 5, 4, 5, 3, 2, 2, 2, 7, 5, 5, 8, 4,

Example: Worst Fit A wall unit requires boards of lengths: 6, 5, 4, 5, 3, 2, 2, 2, 7, 5, 5, 8, 4, 4 Stock boards come in 9 1 lengths(!). How should you cut the boards so as to minimize the cost of material? Use (1) WF and (2) WFD. Worst Fit Decreasing:Worst Fit Decreasing:8, 7, 6, 5, 5, 5, 5, 4, 4, 4, 3, 2, 2, 28, 7, 6, 5, 5, 5, 5, 4, 4, 4, 3, 2, 2,

Example 4 Pack the following weights: 6, 5, 7, 3, 4, 2 in bins of size 10 using (1) WF and (2) WFD. Worst Fit:WFD: 7, 6, 5, 4, 3,

Exercise Find a question of the form: Use indicated bin-packing algorithm to place given weight in the supplied, already partially filled, bins. Place wts in the bins and select the next wt to be added in such a way that each of the 3 algorithms (NF, FF, WF) will place the wt in a di ff erent bin.