The document analyzes the performance of different bin-packing heuristics. It finds that the Next-Fit heuristic is the fastest, taking O(n) time, while First-Fit and First-Fit-Decreasing are the slowest at O(n^2) time. The Max-Rest heuristic can be optimized to O(n log n) time by using a priority queue. Various optimizations are discussed that improve the performance of heuristics like using mapping/lookup tables or sorting objects by size.
We are given n distinct positive numbers (weights)
The objective is to find all combination of weights whose sum is equal to given weights m
State space tree is generated for all the possibilities of the subsets
Generate the tree by keeping weight <= m
We will discuss the following: Graph, Directed vs Undirected Graph, Acyclic vs Cyclic Graph, Backedge, Search vs Traversal, Breadth First Traversal, Depth First Traversal, Detect Cycle in a Directed Graph.
We are given n distinct positive numbers (weights)
The objective is to find all combination of weights whose sum is equal to given weights m
State space tree is generated for all the possibilities of the subsets
Generate the tree by keeping weight <= m
We will discuss the following: Graph, Directed vs Undirected Graph, Acyclic vs Cyclic Graph, Backedge, Search vs Traversal, Breadth First Traversal, Depth First Traversal, Detect Cycle in a Directed Graph.
A minimum spanning tree (MST) or minimum weight spanning tree is a subset of the edges of a connected, edge-weighted undirected graph that connects all the vertices together, without any cycles and with the minimum possible total edge weight.
Backtracking is a general algorithm for finding all (or some) solutions to some computational problems, notably constraint satisfaction problems, that incrementally builds candidates to the solutions, and abandons each partial candidate c ("backtracks") as soon as it determines that c cannot possibly be completed to a valid solution.
Array is a container which can hold a fix number of items and these items should be of the same type. Most of the data structures make use of arrays to implement their algorithms. Following are the important terms to understand the concept of array.
A minimum spanning tree (MST) or minimum weight spanning tree is a subset of the edges of a connected, edge-weighted undirected graph that connects all the vertices together, without any cycles and with the minimum possible total edge weight.
Backtracking is a general algorithm for finding all (or some) solutions to some computational problems, notably constraint satisfaction problems, that incrementally builds candidates to the solutions, and abandons each partial candidate c ("backtracks") as soon as it determines that c cannot possibly be completed to a valid solution.
Array is a container which can hold a fix number of items and these items should be of the same type. Most of the data structures make use of arrays to implement their algorithms. Following are the important terms to understand the concept of array.
A novel work for bin packing problem by ant colony optimizationeSAT Publishing House
IJRET : International Journal of Research in Engineering and Technology is an international peer reviewed, online journal published by eSAT Publishing House for the enhancement of research in various disciplines of Engineering and Technology. The aim and scope of the journal is to provide an academic medium and an important reference for the advancement and dissemination of research results that support high-level learning, teaching and research in the fields of Engineering and Technology. We bring together Scientists, Academician, Field Engineers, Scholars and Students of related fields of Engineering and Technology
Ch-2 final exam documet compler design elementsMAHERMOHAMED27
The "Project Risk Management" course transformed me from a passive observer of risk to a proactive risk management champion. Here are some key learnings that will forever change my approach to projects:
The Proactive Mindset: I transitioned from simply reacting to problems to anticipating and mitigating them. The course emphasized the importance of proactive risk identification through techniques like brainstorming, SWOT analysis, and FMEA (Failure Mode and Effect Analysis). This allows for early intervention and prevents minor issues from snowballing into major roadblocks.
Risk Assessment and Prioritization: I learned to assess the likelihood and impact of each identified risk. The course introduced qualitative and quantitative risk analysis methods, allowing me to prioritize risks based on their potential severity. This empowers me to focus resources on the most critical threats to project success.
Developing Response Strategies: The course equipped me with a toolbox of risk response strategies. I learned about risk avoidance, mitigation, transference, and acceptance strategies, allowing me to choose the most appropriate approach for each risk. For example, I can now advocate for additional training to mitigate a knowledge gap risk or build buffer time into the schedule to address potential delays.
Communication and Monitoring: The course highlighted the importance of clear communication regarding risks. I learned to effectively communicate risks to stakeholders, ensuring everyone is aware of potential challenges and mitigation plans. Additionally, I gained valuable insights into risk monitoring and tracking, allowing for continuous evaluation and adaptation as the project progresses.
In essence, "Project Risk Management" equipped me with the knowledge and tools to navigate the inevitable uncertainties of projects. By embracing a proactive approach, I can now lead projects with greater confidence, increasing the chances of achieving successful outcomes.
Discuss seven functions, Analysis of algorithms- Experimental Studies/Primitive operations/Asymptotic notation- Big Oh/Big-Omega/Big-Theta
(Download is recommended to make the animations work)
The Bin Packing Problem is one of the most important optimization problems. In recent years, due to its
NP-hard nature, several approximation algorithms have been presented. It is proved that the best
algorithm for the Bin Packing Problem has the approximation ratio 3/2 and the time orderO(n),
unlessP=NP. In this paper, first, a
-approximation algorithm is presented, then a modification to FFD
algorithm is proposed to decrease time order to linear. Finally, these suggested approximation algorithms
are compared with some other approximation algorithms. The experimental results show the suggested
algorithms perform efficiently.
In summary, the main goal of the research is presenting methods which not only enjoy the best theoretical
criteria, but also perform considerably efficient in practice.
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
Model Attribute Check Company Auto PropertyCeline George
In Odoo, the multi-company feature allows you to manage multiple companies within a single Odoo database instance. Each company can have its own configurations while still sharing common resources such as products, customers, and suppliers.
Francesca Gottschalk - How can education support child empowerment.pptxEduSkills OECD
Francesca Gottschalk from the OECD’s Centre for Educational Research and Innovation presents at the Ask an Expert Webinar: How can education support child empowerment?
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
Honest Reviews of Tim Han LMA Course Program.pptxtimhan337
Personal development courses are widely available today, with each one promising life-changing outcomes. Tim Han’s Life Mastery Achievers (LMA) Course has drawn a lot of interest. In addition to offering my frank assessment of Success Insider’s LMA Course, this piece examines the course’s effects via a variety of Tim Han LMA course reviews and Success Insider comments.
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
• The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
• The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate “any matter” at “any time” under House Rule X.
• The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
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
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.