SlideShare a Scribd company logo
Basic Analysis of Bin-Packing Heuristics
Bastian Rieck
1. Results for the test problems
The benchmarks have been performed using an Intel Celeron M 1.5 GHz. The
results are not too surprising: Obviously, the Next-Fit heuristic is fastest because
only 1 bin has to be managed. However, due to the efficient data structure (a prior-
ity queue) that has been used for the Max-Rest heuristic, this heuristic will generally
be almost as fast as Next-Fit. Furthermore, the implementation of the Best-Fit
heuristic has a worst-case running time of O(Kn), where K is the maximum weight.
Thus, the slowest algorithms are First-Fit and First-Fit-Decreasing.
Detailed results can be studied in the table below. In each set, the best solutions
are marked using the dagger symbol “†”. The timing is not accurate for the small
running times. This is due to the CLOCKS PER SEC macro that has been used for
the benchmarks. Hence, in some cases, the same running times will appear. This
means that the running times differ by a very small amount (measured in “raw”
CPU cycles). A value of 0 signifies that the measurement is outside the notable
range.
The algorithms have been compiled with the -O3 optimizations of the g++ com-
piler. All heuristics have been abbreviated to fit in the table. Thus, MR is Max-Rest,
for example. The +-signs after the algorithm names specify whether an optimized
version of the algorithm has been used. For implementation details, refer to table
2 on page 6.
Table 1: Results for the test problems
Problem set Algorithm Bins Time in s
bp1.dat
MR+ 628 0
FF++ 564 0
FFD++ 545 0
NF 711 0
NFD+ 686 0
BF++ 553†
0
bp2.dat
MR+ 6131 0†
FF++ 5420 0†
FFD++ 5321†
0†
NF 6986 0†
NFD+ 6719 0†
BF++ 5377 0†
bp3.dat
MR+ 16637 0†
FF++ 16637 0.0071825
FFD++ 10000†
0†
NF 16637 0†
NFD+ 16637 0†
BF++ 16637 0†
1
2
Table 1: Results for the test problems
Problem set Algorithm Bins Time in s
bp4.dat
MR+ 29258 0.0078125
FF++ 25454 0.015625
FFD++ 25157†
0.0078125
NF 33397 0.0078125
NFD+ 32174 0†
BF++ 25303 0†
bp5.dat
MR+ 32524 0†
FF++ 30155 0.0078125
FFD++ 30111†
0†
NF 36623 0.0078125
NFD+ 37048 0†
BF++ 30152 0†
bp6.dat
MR+ 55566 0.0234375
FF++ 50021 0.0078125
FFD++ 49951†
0.0078125
NF 63078 0.0078125
NFD+ 59852 0†
BF++ 50021 0.0078125
bp7.dat
MR+ 38242 0.015625
FF++ 36863†
0.0078125
FFD++ 39276 0.0071825
NF 42082 0†
NFD+ 47937 0†
BF++ 36866 0.0703125
bp8.dat
MR+ 82804 0.0234375
FF++ 79746 0.015625
FFD++ 79130†
0.015625
NF 93618 0.0078125†
NFD+ 104096 0.0078125†
BF++ 79731 0.015625
bp9.dat
MR+ 293319 0.078125†
FF++ 252577 0.234375
FFD++ 251164†
0.125
NF 333852 0.0078125†
NFD+ 322643 0.015625
BF++ 251568 0.0390625
bp10.dat
MR+ 588478 0.171875
FF++ 506844 0.296875
FFD++ 504927†
0.179688
NF 669926 0.015625†
NFD+ 645906 0.0390625
BF++ 505643 0.046875
bp11.dat
MR+ 2929609 0.882812
FF++ 2510868 8.42188
FFD++ 2502387†
4.86719
NF 3333928 0.09375†
3
Table 1: Results for the test problems
Problem set Algorithm Bins Time in s
NFD+ 3225064 0.234375
BF++ 2504284 1.3125
2. Worst-case running time
2.1. First-Fit. In pseudo-code, we have the following algorithm:
Algorithm 1 First-Fit
1: for All objects i = 1, 2, . . . , n do
2: for All bins j = 1, 2, . . . do
3: if Object i fits in bin j then
4: Pack object i in bin j.
5: Break the loop and pack the next object.
6: end if
7: end for
8: if Object i did not fit in any available bin then
9: Create new bin and pack object i.
10: end if
11: end for
In the worst-case, a new bin has to be opened each time a new object is in-
serted. Thus, there are 1, 2, 3, . . . , n − 1 executions of the inner loop, which yields
an asympotical factor of O(n2
).
2.2. First-Fit-Decreasing. Since all weights of the objects are known prior to
running any algorithm, Counting Sort is the best choice for sorting the objects.
Algorithm 2 First-Fit-Decreasing
1: Sort objects in decreasing order using Counting Sort.
2: Apply First-Fit to the sorted list of objects.
Since Counting Sort has a complexity of O(n+k), where k is the largest weight,
the algorithm is obviously dominated by the running time of First-Fit, which
yields a factor of O(n2
).
2.3. Max-Rest. In pseudo-code, the following algorithm is used:
Algorithm 3 Max-Rest
1: for All objects i = 1, 2, . . . , n do
2: Determine k = min{i | ci = minj=m
j=1 cj}, the index of the bin with maximum
remaining capacity.
3: if Object i fits in bin k then
4: Pack object i in bin k.
5: else
6: Create new bin and pack object i.
7: end if
8: end for
4
If a naive algorithm is used, determining the bin with maximum remaining ca-
pacity yields a factor of O(n). Thus, the worst-case running-time of the algorithm
is O(n2
).
A more detailed analysis shows that the bin can be determined by using a priority
queue (i.e. a heap). In this case, the bin can be determined in constant time.
Packing the object (either in a new bin or in an existing one) then requires adding
or updating an element of the heap, which can be done in O(log n). Hence, the
improved version of the algorithm has a worst-case running-time of O(n log n):
Algorithm 4 Max-Rest-Priority-Queue
1: for All objects i = 1, 2, . . . , n do
2: if Object i fits in top-most bin of the priority queue then
3: Remove top-most bin from queue.
4: Add object i to this bin.
5: Push updated bin to queue.
6: else
7: Create new bin and pack object i.
8: end if
9: end for
2.4. Next-Fit. In pseudo-code, my implementation proceeds as follows:
Algorithm 5 Next-Fit
1: for All objects i = 1, 2, . . . , n do
2: if Object i fits in current bin then
3: Pack object i in current bin.
4: else
5: Create new bin, make it the current bin, and pack object i.
6: end if
7: end for
Since packing an object can be done in constant time, the algorithm is dominated
by the loop, which has a running-time of Θ(n).
2.5. Next-Fit-Decreasing. The algorithm is straightforward:
Algorithm 6 Next-Fit-Decreasing
1: Sort objects in decreasing order using Counting Sort.
2: Apply Next-Fit to the sorted list of objects.
Since Next-Fit has a running time of Θ(n), the dominating factor is the Counting
Sort algorithm, which has a running time of O(n + k), where k is the maximum
weight of the problem.
5
2.6. Best-Fit. The algorithm works like this:
Algorithm 7 Best-Fit
1: for All objects i = 1, 2, . . . , n do
2: for All bins j = 1, 2, . . . do
3: if Object i fits in bin j then
4: Calulate remaining capacity after the object has been added.
5: end if
6: end for
7: Pack object i in bin j, where j is the bin with minimum remaining capacity
after adding the object (i.e. the object “fits best”).
8: If no such bin exists, open a new one and add the object.
9: end for
Since all bins are examined in each step, the algorithm has an obvious running-
time of O(n2
). The running time can be decreased by using a heap in order to
determine the best bin:
Algorithm 8 Best-Fit-Heap
1: for All objects i = 1, 2, . . . , n do
2: Perform a Breadth-First-Search in the heap to determine the best bin.
3: if Best bin has been found then
4: Pack object i in this bin.
5: Restore the heap property.
6: else
7: Open a new bin and add the object.
8: end if
9: end for
Using a heap decreases the running time slightly. An even more rapid imple-
mentation of this algorithm will be outlined later on.
3. Speedup for choosing the right bin
Algorithms First-Fit-Decreasing and Next-Fit-Decreasing greatly benefit
from changing the sorting algorithm to Counting Sort, thus yielding a factor of
O(n) for sorting instead of the usual O(n log n) for Heapsort.
All algorithms benefit from the following idea: Since the minimum weight w is
known, a bin can be closed after adding an object if the remaining capacity of the
bin is less than the “limit capacity” cl = K − w (where K is the total capacity of
the bin).
If not mentioned otherwise, optimized versions of all algorithms have been im-
plemented. Figures 1 and 2 show the running times of all algorithms for problems
bp5 and bp8, respectively. The algorithms depicted in the figures are explained in
table 2.
3.1. First-Fit & First-Fit-Decreasing. The right bin can be determined very
quickly if the algorithm uses a map that stores the index j of the bin which contains
an object of weight w. Since the bins are filled in increasing order of their indices,
all bins with index j < j can be skipped when adding an object of weight w ≥ w.
Asymptotically, the algorithm is still in O(n2
).
A sample implementation has been supplied with the source code. See function
first fit map for more details. In pseudo-code, we have:
6
Table 2. Naming schemes used in figures 1 and 2
MR Max-Rest
MR+ Max-Rest using a priority queue
FF First-Fit
FF+ First-Fit using the vector container from the STL. Thus, “almost full”
bins can be removed without having to re-order the array.
FF++ First-Fit using the map container from the STL. Thus, a lookup table is
created that determines the proper bin more rapidly.
FFD First-Fit-Decreasing using the Heapsort algorithm.
FFD+ First-Fit-Decreasing using FF+ and Counting Sort.
FFD++ First-Fit-Decreasing using FF++ and Counting Sort.
NF Next-Fit
NFD Next-Fit-Decreasing
NFD+ Next-Fit-Decreasing using Counting Sort.
BF Best-Fit
Figure 1. Running times in seconds for problem bp5. Note that
a running time of 0s simply means that only very few CPU cycles
have been used (in this case, the clock() function will not be able
to take accurate measurings).
0
0.5
1
1.5
2
2.5
3
MR MR+ FF FFD FF+ FFD+ FFD++ NF NFD NFD+ BF BF+ BF++
1.117
0.00781
2.148
2.477
0.227 0.258 0.234
0 0.03125 0
0.773
0.1406
0
Algorithm 9 First-Fit-Lookup
1: for All objects i = 1, 2, . . . , n do
2: Lookup the last bin j that was used to pack an object of this size. If no such
bin exists, set j = 1.
3: for All remaining bins j, j + 1, . . . do
4: if Object i fits in current bin then
5: Pack object i in current bin.
6: Save the current index in the lookup table.
7: Break the loop and pack the next object.
8: end if
9: end for
10: if Object i did not fit in any available bin then
11: Create new bin and pack object i.
12: end if
13: end for
3.2. Max-Rest. This algorithm greatly benefits from a priority queue (see the
running time analysis): When the heuristic needs to decide where to place an
object, the bin with the highest priority (i.e. the maximum remaining capacity)
7
Figure2.Runningtimesforproblembp8.Notethatalogarithmicscalehasbeenusedbecausetherunningtimesdiffergreatly.
0.001
0.01
0.1
1
10
100
MRMR+FFFF+FF++FFDFFD+FFD++NFNFDNFD+BFBF+BF++
2.844
0.0234
22.898
0.00781
0.0156
26.195
1.383
0.007810.00781
0.1406
0.007810.00781
0.0313
0.0156
8
would be chosen from the queue. If the object does not fit, a new bin needs to be
created. If it does fit, the bin’s capacity is updated and it is placed back in the
priority queue.
A sample implementation has been supplied with the source code. See function
max rest pq for more details.
3.3. Best-Fit. The Best-Fit algorithm greatly benefits from using a lookup table
for the bin sizes. Index i of this table stores the number of bins with remaining
capacity i. When a new object is added, the lookup table is queried for increasing
remaining capacities. Thus, the first match will be the best one. The algorithm
can be formalized as follows:
Algorithm 10 Best-Fit-Lookup-Table
1: Initialize lookup table t with tK = n (there are n bins with remaining capacity
K, hence no object has been packed yet).
2: for All objects i = 1, 2, . . . , n do
3: Let wi be the current object size.
4: Search a suitable bin by querying the lookup table for bins of remaining
capacity wi, wi + 1, . . . until a bin has been found at index tl.
5: tl − −, because there is one bin less with remaining capacity l.
6: tl−wi + +, because the number of bins with remaining capacity l − wi has
been increased by one.
7: end for
8: Compute
i=K−1
i=0 ti in order to determine the number of bins that has to be
used.
Since the remaining capacity of a bin is at most K, a suitable bin can always be
determined in O(K). Because of the outer loop, the algorithm has a running time
of O(nK).
The obvious disadvantage of this algorithm is that the object positions are not
stored in the lookup table. This can be solved by using a table of queues, for
example, which contain pointers to the “real” bins. In the last two steps of the
outer loop, the elements would be removed or added to the queues, respectively.
Since this can be done in constant time, the running time of the algorithm is not
changed.
3.4. Next-Fit and Next-Fit-Decreasing. Since only one bin is managed at a
time, these algorithms cannot be optimized any further (apart from using Counting
Sort for Next-Fit-Decreasing).
4. Worst-case results
Claim 4.1. mFF < 17
10 · mOPT + 2
Proof. Already shown in lecture.
Claim 4.2. mFFD < 11
9 · mOPT + 4
Proof. Already shown in lecture.
Claim 4.3. mNF ≤ 2 · mOPT
Proof. For two subsequent bins, ci + ci+1 > 1 holds. If it were otherwise, no new
bin would have been opened. Hence, the solution of the heuristic is at most twice
as big as the optimum solution. The bound is tight for a problem that contains
n objects with weights 1
2 and n objects with weights 1
2n . If the objects arrive in
9
an alternating fashion, i.e. 1
2 , 1
2n , 1
2 , . . . , Next-Fit will create 2n bins, whereas the
optimal solution consists of n + 1 bins.

More Related Content

What's hot

Prim's algorithm
Prim's algorithmPrim's algorithm
Prim's algorithm
Pankaj Thakur
 
5.1 greedy
5.1 greedy5.1 greedy
5.1 greedy
Krish_ver2
 
Travelling salesman problem
Travelling salesman problemTravelling salesman problem
Travelling salesman problem
hamza haseeb
 
Traveling salesman problem
Traveling salesman problemTraveling salesman problem
Traveling salesman problem
Jayesh Chauhan
 
Tsp branch and-bound
Tsp branch and-boundTsp branch and-bound
Tsp branch and-bound
Saravanan Natarajan
 
Minimum spanning Tree
Minimum spanning TreeMinimum spanning Tree
Minimum spanning Tree
Narendra Singh Patel
 
Tic tac toe simple ai game
Tic tac toe simple ai gameTic tac toe simple ai game
Tic tac toe simple ai game
Seevaratnam Kajandan
 
minimum spanning tree
minimum spanning tree minimum spanning tree
minimum spanning tree
Melaku Bayih Demessie
 
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
Sahil Kumar
 
Back tracking and branch and bound class 20
Back tracking and branch and bound class 20Back tracking and branch and bound class 20
Back tracking and branch and bound class 20Kumar
 
sum of subset problem using Backtracking
sum of subset problem using Backtrackingsum of subset problem using Backtracking
sum of subset problem using Backtracking
Abhishek Singh
 
Approximation Algorithms
Approximation AlgorithmsApproximation Algorithms
Approximation Algorithms
Nicolas Bettenburg
 
Branch and bound technique
Branch and bound techniqueBranch and bound technique
Branch and bound technique
ishmecse13
 
All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithmSrikrishnan Suresh
 
Travelling salesman problem
Travelling salesman problemTravelling salesman problem
Travelling salesman problem
Pradeep Behera
 
All pair shortest path
All pair shortest pathAll pair shortest path
All pair shortest path
Arafat Hossan
 
01 knapsack using backtracking
01 knapsack using backtracking01 knapsack using backtracking
01 knapsack using backtrackingmandlapure
 
0/1 knapsack
0/1 knapsack0/1 knapsack
0/1 knapsack
Amin Omi
 
Backtracking
Backtracking  Backtracking
Backtracking
Vikas Sharma
 
Coin Change : Greedy vs Dynamic Programming
Coin Change : Greedy vs Dynamic ProgrammingCoin Change : Greedy vs Dynamic Programming
Coin Change : Greedy vs Dynamic Programming
Syeda Khadizatul maria
 

What's hot (20)

Prim's algorithm
Prim's algorithmPrim's algorithm
Prim's algorithm
 
5.1 greedy
5.1 greedy5.1 greedy
5.1 greedy
 
Travelling salesman problem
Travelling salesman problemTravelling salesman problem
Travelling salesman problem
 
Traveling salesman problem
Traveling salesman problemTraveling salesman problem
Traveling salesman problem
 
Tsp branch and-bound
Tsp branch and-boundTsp branch and-bound
Tsp branch and-bound
 
Minimum spanning Tree
Minimum spanning TreeMinimum spanning Tree
Minimum spanning Tree
 
Tic tac toe simple ai game
Tic tac toe simple ai gameTic tac toe simple ai game
Tic tac toe simple ai game
 
minimum spanning tree
minimum spanning tree minimum spanning tree
minimum spanning tree
 
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
 
Back tracking and branch and bound class 20
Back tracking and branch and bound class 20Back tracking and branch and bound class 20
Back tracking and branch and bound class 20
 
sum of subset problem using Backtracking
sum of subset problem using Backtrackingsum of subset problem using Backtracking
sum of subset problem using Backtracking
 
Approximation Algorithms
Approximation AlgorithmsApproximation Algorithms
Approximation Algorithms
 
Branch and bound technique
Branch and bound techniqueBranch and bound technique
Branch and bound technique
 
All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithm
 
Travelling salesman problem
Travelling salesman problemTravelling salesman problem
Travelling salesman problem
 
All pair shortest path
All pair shortest pathAll pair shortest path
All pair shortest path
 
01 knapsack using backtracking
01 knapsack using backtracking01 knapsack using backtracking
01 knapsack using backtracking
 
0/1 knapsack
0/1 knapsack0/1 knapsack
0/1 knapsack
 
Backtracking
Backtracking  Backtracking
Backtracking
 
Coin Change : Greedy vs Dynamic Programming
Coin Change : Greedy vs Dynamic ProgrammingCoin Change : Greedy vs Dynamic Programming
Coin Change : Greedy vs Dynamic Programming
 

Similar to Bin packing

data structures and algorithms Unit 4
data structures and algorithms Unit 4data structures and algorithms Unit 4
data structures and algorithms Unit 4
infanciaj
 
220exercises2
220exercises2220exercises2
220exercises2
sadhanakumble
 
BinPacking.pdf Dfghhjkkjjjjmkkkjnjjjjmmmk
BinPacking.pdf DfghhjkkjjjjmkkkjnjjjjmmmkBinPacking.pdf Dfghhjkkjjjjmkkkjnjjjjmmmk
BinPacking.pdf Dfghhjkkjjjjmkkkjnjjjjmmmk
ShivaniSharma335055
 
A novel work for bin packing problem by ant colony optimization
A novel work for bin packing problem by ant colony optimizationA novel work for bin packing problem by ant colony optimization
A novel work for bin packing problem by ant colony optimization
eSAT Publishing House
 
Ch-2 final exam documet compler design elements
Ch-2 final exam documet compler design elementsCh-2 final exam documet compler design elements
Ch-2 final exam documet compler design elements
MAHERMOHAMED27
 
Chap8 part ii
Chap8 part iiChap8 part ii
Chap8 part iiLoc Tran
 
Advanced s and s algorithm.ppt
Advanced s and s algorithm.pptAdvanced s and s algorithm.ppt
Advanced s and s algorithm.ppt
LegesseSamuel
 
Data Structure & Algorithms - Mathematical
Data Structure & Algorithms - MathematicalData Structure & Algorithms - Mathematical
Data Structure & Algorithms - Mathematical
babuk110
 
M269 Data Structures And Computability.docx
M269 Data Structures And Computability.docxM269 Data Structures And Computability.docx
M269 Data Structures And Computability.docx
stirlingvwriters
 
Algorithm analysis basics - Seven Functions/Big-Oh/Omega/Theta
Algorithm analysis basics - Seven Functions/Big-Oh/Omega/ThetaAlgorithm analysis basics - Seven Functions/Big-Oh/Omega/Theta
Algorithm analysis basics - Seven Functions/Big-Oh/Omega/Theta
Priyanka Rana
 
algorithm assignmenteeeeeee.pptx
algorithm assignmenteeeeeee.pptxalgorithm assignmenteeeeeee.pptx
algorithm assignmenteeeeeee.pptx
kassahungebrie
 
Shor's discrete logarithm quantum algorithm for elliptic curves
 Shor's discrete logarithm quantum algorithm for elliptic curves Shor's discrete logarithm quantum algorithm for elliptic curves
Shor's discrete logarithm quantum algorithm for elliptic curves
XequeMateShannon
 
Case Study(Analysis of Algorithm.pdf
Case Study(Analysis of Algorithm.pdfCase Study(Analysis of Algorithm.pdf
Case Study(Analysis of Algorithm.pdf
ShaistaRiaz4
 
Time and Space Complexity Analysis.pptx
Time and Space Complexity Analysis.pptxTime and Space Complexity Analysis.pptx
Time and Space Complexity Analysis.pptx
dudelover
 
Bin packing problem two approximation
Bin packing problem two approximationBin packing problem two approximation
Bin packing problem two approximation
ijfcstjournal
 
Design and Analysis of Algorithms Lecture Notes
Design and Analysis of Algorithms Lecture NotesDesign and Analysis of Algorithms Lecture Notes
Design and Analysis of Algorithms Lecture Notes
Sreedhar Chowdam
 
Introduction to data structures and complexity.pptx
Introduction to data structures and complexity.pptxIntroduction to data structures and complexity.pptx
Introduction to data structures and complexity.pptx
PJS KUMAR
 

Similar to Bin packing (20)

data structures and algorithms Unit 4
data structures and algorithms Unit 4data structures and algorithms Unit 4
data structures and algorithms Unit 4
 
Lec23
Lec23Lec23
Lec23
 
220exercises2
220exercises2220exercises2
220exercises2
 
04greedy 2x2
04greedy 2x204greedy 2x2
04greedy 2x2
 
BinPacking.pdf Dfghhjkkjjjjmkkkjnjjjjmmmk
BinPacking.pdf DfghhjkkjjjjmkkkjnjjjjmmmkBinPacking.pdf Dfghhjkkjjjjmkkkjnjjjjmmmk
BinPacking.pdf Dfghhjkkjjjjmkkkjnjjjjmmmk
 
A novel work for bin packing problem by ant colony optimization
A novel work for bin packing problem by ant colony optimizationA novel work for bin packing problem by ant colony optimization
A novel work for bin packing problem by ant colony optimization
 
Ch-2 final exam documet compler design elements
Ch-2 final exam documet compler design elementsCh-2 final exam documet compler design elements
Ch-2 final exam documet compler design elements
 
Chap8 part ii
Chap8 part iiChap8 part ii
Chap8 part ii
 
Advanced s and s algorithm.ppt
Advanced s and s algorithm.pptAdvanced s and s algorithm.ppt
Advanced s and s algorithm.ppt
 
Data Structure & Algorithms - Mathematical
Data Structure & Algorithms - MathematicalData Structure & Algorithms - Mathematical
Data Structure & Algorithms - Mathematical
 
M269 Data Structures And Computability.docx
M269 Data Structures And Computability.docxM269 Data Structures And Computability.docx
M269 Data Structures And Computability.docx
 
Algorithm analysis basics - Seven Functions/Big-Oh/Omega/Theta
Algorithm analysis basics - Seven Functions/Big-Oh/Omega/ThetaAlgorithm analysis basics - Seven Functions/Big-Oh/Omega/Theta
Algorithm analysis basics - Seven Functions/Big-Oh/Omega/Theta
 
algorithm assignmenteeeeeee.pptx
algorithm assignmenteeeeeee.pptxalgorithm assignmenteeeeeee.pptx
algorithm assignmenteeeeeee.pptx
 
Shor's discrete logarithm quantum algorithm for elliptic curves
 Shor's discrete logarithm quantum algorithm for elliptic curves Shor's discrete logarithm quantum algorithm for elliptic curves
Shor's discrete logarithm quantum algorithm for elliptic curves
 
Case Study(Analysis of Algorithm.pdf
Case Study(Analysis of Algorithm.pdfCase Study(Analysis of Algorithm.pdf
Case Study(Analysis of Algorithm.pdf
 
Time and Space Complexity Analysis.pptx
Time and Space Complexity Analysis.pptxTime and Space Complexity Analysis.pptx
Time and Space Complexity Analysis.pptx
 
Bin packing problem two approximation
Bin packing problem two approximationBin packing problem two approximation
Bin packing problem two approximation
 
Design and Analysis of Algorithms Lecture Notes
Design and Analysis of Algorithms Lecture NotesDesign and Analysis of Algorithms Lecture Notes
Design and Analysis of Algorithms Lecture Notes
 
Sortsearch
SortsearchSortsearch
Sortsearch
 
Introduction to data structures and complexity.pptx
Introduction to data structures and complexity.pptxIntroduction to data structures and complexity.pptx
Introduction to data structures and complexity.pptx
 

More from Haji Abdul Ghaffar Jaafar

Lecture 1 and 2 Concepts CM_VBARU.pptx
Lecture 1 and 2 Concepts CM_VBARU.pptxLecture 1 and 2 Concepts CM_VBARU.pptx
Lecture 1 and 2 Concepts CM_VBARU.pptx
Haji Abdul Ghaffar Jaafar
 
Lecture 1 and 2 Concepts CM_TERKINI.pptx
Lecture 1 and 2 Concepts CM_TERKINI.pptxLecture 1 and 2 Concepts CM_TERKINI.pptx
Lecture 1 and 2 Concepts CM_TERKINI.pptx
Haji Abdul Ghaffar Jaafar
 
Whats app image 2020 10-14 at 2.47.25 pm-pelan ipgktaa
Whats app image 2020 10-14 at 2.47.25 pm-pelan ipgktaaWhats app image 2020 10-14 at 2.47.25 pm-pelan ipgktaa
Whats app image 2020 10-14 at 2.47.25 pm-pelan ipgktaa
Haji Abdul Ghaffar Jaafar
 
Whats app image 2020 10-14 at 2.47.25 pm-pelan ipgktaa
Whats app image 2020 10-14 at 2.47.25 pm-pelan ipgktaaWhats app image 2020 10-14 at 2.47.25 pm-pelan ipgktaa
Whats app image 2020 10-14 at 2.47.25 pm-pelan ipgktaa
Haji Abdul Ghaffar Jaafar
 
Sop kebenaran balik bercuti semester converted ipgktaa
Sop kebenaran balik bercuti semester converted ipgktaaSop kebenaran balik bercuti semester converted ipgktaa
Sop kebenaran balik bercuti semester converted ipgktaa
Haji Abdul Ghaffar Jaafar
 
Sop kebenaran balik bercuti semester converted
Sop kebenaran balik bercuti semester convertedSop kebenaran balik bercuti semester converted
Sop kebenaran balik bercuti semester converted
Haji Abdul Ghaffar Jaafar
 
Sop kebenaran balik bercuti semester
Sop kebenaran balik bercuti semesterSop kebenaran balik bercuti semester
Sop kebenaran balik bercuti semester
Haji Abdul Ghaffar Jaafar
 
Qr code asrama
Qr code asramaQr code asrama
Ipg kampus tengku_ampuan_afzan_-_pos_pengawal_ipgktaa
Ipg kampus tengku_ampuan_afzan_-_pos_pengawal_ipgktaaIpg kampus tengku_ampuan_afzan_-_pos_pengawal_ipgktaa
Ipg kampus tengku_ampuan_afzan_-_pos_pengawal_ipgktaa
Haji Abdul Ghaffar Jaafar
 
Ipg &amp; matrikulasi
Ipg &amp; matrikulasiIpg &amp; matrikulasi
Ipg &amp; matrikulasi
Haji Abdul Ghaffar Jaafar
 
Surat siaran bilangan 7 tahun 2020 garis panduan pengurusan pembukaan semula...
Surat siaran bilangan 7  tahun 2020 garis panduan pengurusan pembukaan semula...Surat siaran bilangan 7  tahun 2020 garis panduan pengurusan pembukaan semula...
Surat siaran bilangan 7 tahun 2020 garis panduan pengurusan pembukaan semula...
Haji Abdul Ghaffar Jaafar
 
Sop post covid19 ipg kampus tengku ampuan afzan m3p
Sop post covid19 ipg kampus tengku ampuan afzan  m3pSop post covid19 ipg kampus tengku ampuan afzan  m3p
Sop post covid19 ipg kampus tengku ampuan afzan m3p
Haji Abdul Ghaffar Jaafar
 
Sop pendaftaran khas ipgktaa kediaman-converted
Sop pendaftaran khas ipgktaa kediaman-convertedSop pendaftaran khas ipgktaa kediaman-converted
Sop pendaftaran khas ipgktaa kediaman-converted
Haji Abdul Ghaffar Jaafar
 
Sop pendaftaran khas ipgktaa kediaman
Sop pendaftaran khas ipgktaa kediamanSop pendaftaran khas ipgktaa kediaman
Sop pendaftaran khas ipgktaa kediaman
Haji Abdul Ghaffar Jaafar
 
Pembukaan semula ipg kpm semasa dan selepas pkpp 001 (2020-1595574989399)
Pembukaan semula ipg kpm semasa dan selepas pkpp 001 (2020-1595574989399)Pembukaan semula ipg kpm semasa dan selepas pkpp 001 (2020-1595574989399)
Pembukaan semula ipg kpm semasa dan selepas pkpp 001 (2020-1595574989399)
Haji Abdul Ghaffar Jaafar
 
Kolej kediaman peraturan asrama pelajar mppb sem2-2018
Kolej kediaman   peraturan asrama pelajar mppb sem2-2018Kolej kediaman   peraturan asrama pelajar mppb sem2-2018
Kolej kediaman peraturan asrama pelajar mppb sem2-2018
Haji Abdul Ghaffar Jaafar
 
Kolej kediaman peraturan dalaman(taklimat pljar jun 2019)
Kolej kediaman  peraturan dalaman(taklimat pljar jun 2019)Kolej kediaman  peraturan dalaman(taklimat pljar jun 2019)
Kolej kediaman peraturan dalaman(taklimat pljar jun 2019)
Haji Abdul Ghaffar Jaafar
 
Kolej kediaman peraturan dalaman(taklimat pljar jun 2019) [autosaved]
Kolej kediaman  peraturan dalaman(taklimat pljar jun 2019) [autosaved]Kolej kediaman  peraturan dalaman(taklimat pljar jun 2019) [autosaved]
Kolej kediaman peraturan dalaman(taklimat pljar jun 2019) [autosaved]
Haji Abdul Ghaffar Jaafar
 
Kolej kediaman peraturan dalaman(taklimat pljar jun 2018)
Kolej kediaman  peraturan dalaman(taklimat pljar jun 2018)Kolej kediaman  peraturan dalaman(taklimat pljar jun 2018)
Kolej kediaman peraturan dalaman(taklimat pljar jun 2018)
Haji Abdul Ghaffar Jaafar
 
Kolej kediaman taklimat penginapan 2018
Kolej kediaman   taklimat penginapan 2018Kolej kediaman   taklimat penginapan 2018
Kolej kediaman taklimat penginapan 2018
Haji Abdul Ghaffar Jaafar
 

More from Haji Abdul Ghaffar Jaafar (20)

Lecture 1 and 2 Concepts CM_VBARU.pptx
Lecture 1 and 2 Concepts CM_VBARU.pptxLecture 1 and 2 Concepts CM_VBARU.pptx
Lecture 1 and 2 Concepts CM_VBARU.pptx
 
Lecture 1 and 2 Concepts CM_TERKINI.pptx
Lecture 1 and 2 Concepts CM_TERKINI.pptxLecture 1 and 2 Concepts CM_TERKINI.pptx
Lecture 1 and 2 Concepts CM_TERKINI.pptx
 
Whats app image 2020 10-14 at 2.47.25 pm-pelan ipgktaa
Whats app image 2020 10-14 at 2.47.25 pm-pelan ipgktaaWhats app image 2020 10-14 at 2.47.25 pm-pelan ipgktaa
Whats app image 2020 10-14 at 2.47.25 pm-pelan ipgktaa
 
Whats app image 2020 10-14 at 2.47.25 pm-pelan ipgktaa
Whats app image 2020 10-14 at 2.47.25 pm-pelan ipgktaaWhats app image 2020 10-14 at 2.47.25 pm-pelan ipgktaa
Whats app image 2020 10-14 at 2.47.25 pm-pelan ipgktaa
 
Sop kebenaran balik bercuti semester converted ipgktaa
Sop kebenaran balik bercuti semester converted ipgktaaSop kebenaran balik bercuti semester converted ipgktaa
Sop kebenaran balik bercuti semester converted ipgktaa
 
Sop kebenaran balik bercuti semester converted
Sop kebenaran balik bercuti semester convertedSop kebenaran balik bercuti semester converted
Sop kebenaran balik bercuti semester converted
 
Sop kebenaran balik bercuti semester
Sop kebenaran balik bercuti semesterSop kebenaran balik bercuti semester
Sop kebenaran balik bercuti semester
 
Qr code asrama
Qr code asramaQr code asrama
Qr code asrama
 
Ipg kampus tengku_ampuan_afzan_-_pos_pengawal_ipgktaa
Ipg kampus tengku_ampuan_afzan_-_pos_pengawal_ipgktaaIpg kampus tengku_ampuan_afzan_-_pos_pengawal_ipgktaa
Ipg kampus tengku_ampuan_afzan_-_pos_pengawal_ipgktaa
 
Ipg &amp; matrikulasi
Ipg &amp; matrikulasiIpg &amp; matrikulasi
Ipg &amp; matrikulasi
 
Surat siaran bilangan 7 tahun 2020 garis panduan pengurusan pembukaan semula...
Surat siaran bilangan 7  tahun 2020 garis panduan pengurusan pembukaan semula...Surat siaran bilangan 7  tahun 2020 garis panduan pengurusan pembukaan semula...
Surat siaran bilangan 7 tahun 2020 garis panduan pengurusan pembukaan semula...
 
Sop post covid19 ipg kampus tengku ampuan afzan m3p
Sop post covid19 ipg kampus tengku ampuan afzan  m3pSop post covid19 ipg kampus tengku ampuan afzan  m3p
Sop post covid19 ipg kampus tengku ampuan afzan m3p
 
Sop pendaftaran khas ipgktaa kediaman-converted
Sop pendaftaran khas ipgktaa kediaman-convertedSop pendaftaran khas ipgktaa kediaman-converted
Sop pendaftaran khas ipgktaa kediaman-converted
 
Sop pendaftaran khas ipgktaa kediaman
Sop pendaftaran khas ipgktaa kediamanSop pendaftaran khas ipgktaa kediaman
Sop pendaftaran khas ipgktaa kediaman
 
Pembukaan semula ipg kpm semasa dan selepas pkpp 001 (2020-1595574989399)
Pembukaan semula ipg kpm semasa dan selepas pkpp 001 (2020-1595574989399)Pembukaan semula ipg kpm semasa dan selepas pkpp 001 (2020-1595574989399)
Pembukaan semula ipg kpm semasa dan selepas pkpp 001 (2020-1595574989399)
 
Kolej kediaman peraturan asrama pelajar mppb sem2-2018
Kolej kediaman   peraturan asrama pelajar mppb sem2-2018Kolej kediaman   peraturan asrama pelajar mppb sem2-2018
Kolej kediaman peraturan asrama pelajar mppb sem2-2018
 
Kolej kediaman peraturan dalaman(taklimat pljar jun 2019)
Kolej kediaman  peraturan dalaman(taklimat pljar jun 2019)Kolej kediaman  peraturan dalaman(taklimat pljar jun 2019)
Kolej kediaman peraturan dalaman(taklimat pljar jun 2019)
 
Kolej kediaman peraturan dalaman(taklimat pljar jun 2019) [autosaved]
Kolej kediaman  peraturan dalaman(taklimat pljar jun 2019) [autosaved]Kolej kediaman  peraturan dalaman(taklimat pljar jun 2019) [autosaved]
Kolej kediaman peraturan dalaman(taklimat pljar jun 2019) [autosaved]
 
Kolej kediaman peraturan dalaman(taklimat pljar jun 2018)
Kolej kediaman  peraturan dalaman(taklimat pljar jun 2018)Kolej kediaman  peraturan dalaman(taklimat pljar jun 2018)
Kolej kediaman peraturan dalaman(taklimat pljar jun 2018)
 
Kolej kediaman taklimat penginapan 2018
Kolej kediaman   taklimat penginapan 2018Kolej kediaman   taklimat penginapan 2018
Kolej kediaman taklimat penginapan 2018
 

Recently uploaded

Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 

Recently uploaded (20)

Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 

Bin packing

  • 1. Basic Analysis of Bin-Packing Heuristics Bastian Rieck 1. Results for the test problems The benchmarks have been performed using an Intel Celeron M 1.5 GHz. The results are not too surprising: Obviously, the Next-Fit heuristic is fastest because only 1 bin has to be managed. However, due to the efficient data structure (a prior- ity queue) that has been used for the Max-Rest heuristic, this heuristic will generally be almost as fast as Next-Fit. Furthermore, the implementation of the Best-Fit heuristic has a worst-case running time of O(Kn), where K is the maximum weight. Thus, the slowest algorithms are First-Fit and First-Fit-Decreasing. Detailed results can be studied in the table below. In each set, the best solutions are marked using the dagger symbol “†”. The timing is not accurate for the small running times. This is due to the CLOCKS PER SEC macro that has been used for the benchmarks. Hence, in some cases, the same running times will appear. This means that the running times differ by a very small amount (measured in “raw” CPU cycles). A value of 0 signifies that the measurement is outside the notable range. The algorithms have been compiled with the -O3 optimizations of the g++ com- piler. All heuristics have been abbreviated to fit in the table. Thus, MR is Max-Rest, for example. The +-signs after the algorithm names specify whether an optimized version of the algorithm has been used. For implementation details, refer to table 2 on page 6. Table 1: Results for the test problems Problem set Algorithm Bins Time in s bp1.dat MR+ 628 0 FF++ 564 0 FFD++ 545 0 NF 711 0 NFD+ 686 0 BF++ 553† 0 bp2.dat MR+ 6131 0† FF++ 5420 0† FFD++ 5321† 0† NF 6986 0† NFD+ 6719 0† BF++ 5377 0† bp3.dat MR+ 16637 0† FF++ 16637 0.0071825 FFD++ 10000† 0† NF 16637 0† NFD+ 16637 0† BF++ 16637 0† 1
  • 2. 2 Table 1: Results for the test problems Problem set Algorithm Bins Time in s bp4.dat MR+ 29258 0.0078125 FF++ 25454 0.015625 FFD++ 25157† 0.0078125 NF 33397 0.0078125 NFD+ 32174 0† BF++ 25303 0† bp5.dat MR+ 32524 0† FF++ 30155 0.0078125 FFD++ 30111† 0† NF 36623 0.0078125 NFD+ 37048 0† BF++ 30152 0† bp6.dat MR+ 55566 0.0234375 FF++ 50021 0.0078125 FFD++ 49951† 0.0078125 NF 63078 0.0078125 NFD+ 59852 0† BF++ 50021 0.0078125 bp7.dat MR+ 38242 0.015625 FF++ 36863† 0.0078125 FFD++ 39276 0.0071825 NF 42082 0† NFD+ 47937 0† BF++ 36866 0.0703125 bp8.dat MR+ 82804 0.0234375 FF++ 79746 0.015625 FFD++ 79130† 0.015625 NF 93618 0.0078125† NFD+ 104096 0.0078125† BF++ 79731 0.015625 bp9.dat MR+ 293319 0.078125† FF++ 252577 0.234375 FFD++ 251164† 0.125 NF 333852 0.0078125† NFD+ 322643 0.015625 BF++ 251568 0.0390625 bp10.dat MR+ 588478 0.171875 FF++ 506844 0.296875 FFD++ 504927† 0.179688 NF 669926 0.015625† NFD+ 645906 0.0390625 BF++ 505643 0.046875 bp11.dat MR+ 2929609 0.882812 FF++ 2510868 8.42188 FFD++ 2502387† 4.86719 NF 3333928 0.09375†
  • 3. 3 Table 1: Results for the test problems Problem set Algorithm Bins Time in s NFD+ 3225064 0.234375 BF++ 2504284 1.3125 2. Worst-case running time 2.1. First-Fit. In pseudo-code, we have the following algorithm: Algorithm 1 First-Fit 1: for All objects i = 1, 2, . . . , n do 2: for All bins j = 1, 2, . . . do 3: if Object i fits in bin j then 4: Pack object i in bin j. 5: Break the loop and pack the next object. 6: end if 7: end for 8: if Object i did not fit in any available bin then 9: Create new bin and pack object i. 10: end if 11: end for In the worst-case, a new bin has to be opened each time a new object is in- serted. Thus, there are 1, 2, 3, . . . , n − 1 executions of the inner loop, which yields an asympotical factor of O(n2 ). 2.2. First-Fit-Decreasing. Since all weights of the objects are known prior to running any algorithm, Counting Sort is the best choice for sorting the objects. Algorithm 2 First-Fit-Decreasing 1: Sort objects in decreasing order using Counting Sort. 2: Apply First-Fit to the sorted list of objects. Since Counting Sort has a complexity of O(n+k), where k is the largest weight, the algorithm is obviously dominated by the running time of First-Fit, which yields a factor of O(n2 ). 2.3. Max-Rest. In pseudo-code, the following algorithm is used: Algorithm 3 Max-Rest 1: for All objects i = 1, 2, . . . , n do 2: Determine k = min{i | ci = minj=m j=1 cj}, the index of the bin with maximum remaining capacity. 3: if Object i fits in bin k then 4: Pack object i in bin k. 5: else 6: Create new bin and pack object i. 7: end if 8: end for
  • 4. 4 If a naive algorithm is used, determining the bin with maximum remaining ca- pacity yields a factor of O(n). Thus, the worst-case running-time of the algorithm is O(n2 ). A more detailed analysis shows that the bin can be determined by using a priority queue (i.e. a heap). In this case, the bin can be determined in constant time. Packing the object (either in a new bin or in an existing one) then requires adding or updating an element of the heap, which can be done in O(log n). Hence, the improved version of the algorithm has a worst-case running-time of O(n log n): Algorithm 4 Max-Rest-Priority-Queue 1: for All objects i = 1, 2, . . . , n do 2: if Object i fits in top-most bin of the priority queue then 3: Remove top-most bin from queue. 4: Add object i to this bin. 5: Push updated bin to queue. 6: else 7: Create new bin and pack object i. 8: end if 9: end for 2.4. Next-Fit. In pseudo-code, my implementation proceeds as follows: Algorithm 5 Next-Fit 1: for All objects i = 1, 2, . . . , n do 2: if Object i fits in current bin then 3: Pack object i in current bin. 4: else 5: Create new bin, make it the current bin, and pack object i. 6: end if 7: end for Since packing an object can be done in constant time, the algorithm is dominated by the loop, which has a running-time of Θ(n). 2.5. Next-Fit-Decreasing. The algorithm is straightforward: Algorithm 6 Next-Fit-Decreasing 1: Sort objects in decreasing order using Counting Sort. 2: Apply Next-Fit to the sorted list of objects. Since Next-Fit has a running time of Θ(n), the dominating factor is the Counting Sort algorithm, which has a running time of O(n + k), where k is the maximum weight of the problem.
  • 5. 5 2.6. Best-Fit. The algorithm works like this: Algorithm 7 Best-Fit 1: for All objects i = 1, 2, . . . , n do 2: for All bins j = 1, 2, . . . do 3: if Object i fits in bin j then 4: Calulate remaining capacity after the object has been added. 5: end if 6: end for 7: Pack object i in bin j, where j is the bin with minimum remaining capacity after adding the object (i.e. the object “fits best”). 8: If no such bin exists, open a new one and add the object. 9: end for Since all bins are examined in each step, the algorithm has an obvious running- time of O(n2 ). The running time can be decreased by using a heap in order to determine the best bin: Algorithm 8 Best-Fit-Heap 1: for All objects i = 1, 2, . . . , n do 2: Perform a Breadth-First-Search in the heap to determine the best bin. 3: if Best bin has been found then 4: Pack object i in this bin. 5: Restore the heap property. 6: else 7: Open a new bin and add the object. 8: end if 9: end for Using a heap decreases the running time slightly. An even more rapid imple- mentation of this algorithm will be outlined later on. 3. Speedup for choosing the right bin Algorithms First-Fit-Decreasing and Next-Fit-Decreasing greatly benefit from changing the sorting algorithm to Counting Sort, thus yielding a factor of O(n) for sorting instead of the usual O(n log n) for Heapsort. All algorithms benefit from the following idea: Since the minimum weight w is known, a bin can be closed after adding an object if the remaining capacity of the bin is less than the “limit capacity” cl = K − w (where K is the total capacity of the bin). If not mentioned otherwise, optimized versions of all algorithms have been im- plemented. Figures 1 and 2 show the running times of all algorithms for problems bp5 and bp8, respectively. The algorithms depicted in the figures are explained in table 2. 3.1. First-Fit & First-Fit-Decreasing. The right bin can be determined very quickly if the algorithm uses a map that stores the index j of the bin which contains an object of weight w. Since the bins are filled in increasing order of their indices, all bins with index j < j can be skipped when adding an object of weight w ≥ w. Asymptotically, the algorithm is still in O(n2 ). A sample implementation has been supplied with the source code. See function first fit map for more details. In pseudo-code, we have:
  • 6. 6 Table 2. Naming schemes used in figures 1 and 2 MR Max-Rest MR+ Max-Rest using a priority queue FF First-Fit FF+ First-Fit using the vector container from the STL. Thus, “almost full” bins can be removed without having to re-order the array. FF++ First-Fit using the map container from the STL. Thus, a lookup table is created that determines the proper bin more rapidly. FFD First-Fit-Decreasing using the Heapsort algorithm. FFD+ First-Fit-Decreasing using FF+ and Counting Sort. FFD++ First-Fit-Decreasing using FF++ and Counting Sort. NF Next-Fit NFD Next-Fit-Decreasing NFD+ Next-Fit-Decreasing using Counting Sort. BF Best-Fit Figure 1. Running times in seconds for problem bp5. Note that a running time of 0s simply means that only very few CPU cycles have been used (in this case, the clock() function will not be able to take accurate measurings). 0 0.5 1 1.5 2 2.5 3 MR MR+ FF FFD FF+ FFD+ FFD++ NF NFD NFD+ BF BF+ BF++ 1.117 0.00781 2.148 2.477 0.227 0.258 0.234 0 0.03125 0 0.773 0.1406 0 Algorithm 9 First-Fit-Lookup 1: for All objects i = 1, 2, . . . , n do 2: Lookup the last bin j that was used to pack an object of this size. If no such bin exists, set j = 1. 3: for All remaining bins j, j + 1, . . . do 4: if Object i fits in current bin then 5: Pack object i in current bin. 6: Save the current index in the lookup table. 7: Break the loop and pack the next object. 8: end if 9: end for 10: if Object i did not fit in any available bin then 11: Create new bin and pack object i. 12: end if 13: end for 3.2. Max-Rest. This algorithm greatly benefits from a priority queue (see the running time analysis): When the heuristic needs to decide where to place an object, the bin with the highest priority (i.e. the maximum remaining capacity)
  • 8. 8 would be chosen from the queue. If the object does not fit, a new bin needs to be created. If it does fit, the bin’s capacity is updated and it is placed back in the priority queue. A sample implementation has been supplied with the source code. See function max rest pq for more details. 3.3. Best-Fit. The Best-Fit algorithm greatly benefits from using a lookup table for the bin sizes. Index i of this table stores the number of bins with remaining capacity i. When a new object is added, the lookup table is queried for increasing remaining capacities. Thus, the first match will be the best one. The algorithm can be formalized as follows: Algorithm 10 Best-Fit-Lookup-Table 1: Initialize lookup table t with tK = n (there are n bins with remaining capacity K, hence no object has been packed yet). 2: for All objects i = 1, 2, . . . , n do 3: Let wi be the current object size. 4: Search a suitable bin by querying the lookup table for bins of remaining capacity wi, wi + 1, . . . until a bin has been found at index tl. 5: tl − −, because there is one bin less with remaining capacity l. 6: tl−wi + +, because the number of bins with remaining capacity l − wi has been increased by one. 7: end for 8: Compute i=K−1 i=0 ti in order to determine the number of bins that has to be used. Since the remaining capacity of a bin is at most K, a suitable bin can always be determined in O(K). Because of the outer loop, the algorithm has a running time of O(nK). The obvious disadvantage of this algorithm is that the object positions are not stored in the lookup table. This can be solved by using a table of queues, for example, which contain pointers to the “real” bins. In the last two steps of the outer loop, the elements would be removed or added to the queues, respectively. Since this can be done in constant time, the running time of the algorithm is not changed. 3.4. Next-Fit and Next-Fit-Decreasing. Since only one bin is managed at a time, these algorithms cannot be optimized any further (apart from using Counting Sort for Next-Fit-Decreasing). 4. Worst-case results Claim 4.1. mFF < 17 10 · mOPT + 2 Proof. Already shown in lecture. Claim 4.2. mFFD < 11 9 · mOPT + 4 Proof. Already shown in lecture. Claim 4.3. mNF ≤ 2 · mOPT Proof. For two subsequent bins, ci + ci+1 > 1 holds. If it were otherwise, no new bin would have been opened. Hence, the solution of the heuristic is at most twice as big as the optimum solution. The bound is tight for a problem that contains n objects with weights 1 2 and n objects with weights 1 2n . If the objects arrive in
  • 9. 9 an alternating fashion, i.e. 1 2 , 1 2n , 1 2 , . . . , Next-Fit will create 2n bins, whereas the optimal solution consists of n + 1 bins.