Solving Equal Piles Problem
Solving Equal Piles Problem
submitted by
BACHELOR OF TECHNOLOGY
I, CHABALA VINEETH BABU, with Roll No: CS20B1025 hereby declare that the
material presented in the Project Report titled Solving Equal Piles Problem represents
original work carried out by me in the Department of Computer Science and Engi-
neering at the Indian Institute of Information Technology, Design and Manufacturing,
Kancheepuram.
With my signature, I certify that:
• I have not committed any plagiarism of intellectual property. I have clearly indi-
cated and referenced the contributions of others.
• I have understood that any false claim will result in severe disciplinary action.
• I have understood that the work may be screened for any form of academic mis-
conduct.
Place: Chennai
Date: 14.05.2024
CERTIFICATE
This is to certify that the report titled Solving Equal Piles Problem, submitted by
CHABALA VINEETH BABU (CS20B1025), to the Indian Institute of Information
Technology, Design and Manufacturing Kancheepuram, in partial fulfilment of require-
ments for the award of the degree of BACHELOR OF TECHNOLOGY is a bonafide
record of the work done by him/her under my supervision. The contents of this report,
in full or in parts, have not been submitted to any other Institute or University for the
award of any degree or diploma.
Place: Chennai
Date:
ACKNOWLEDGEMENTS
I extend my sincerest appreciation to Dr. Pandiri Venkatesh for his invaluable guidance
and unwavering support as my project advisor. His profound insights and dedication
have been instrumental in the successful completion of this endeavor. Particularly note-
worthy is Dr. Pandiri’s assistance in optimizing the code for new instances, ensuring its
suitability and efficiency. His expertise enabled me to navigate challenges with confi-
dence and adapt the project to evolving requirements.
I would also like to express profound gratitude to Aditya Gopakumar for the in-
valuable insights gleaned from his project report, discovered independently. His work
served as a guiding beacon, enabling me to navigate challenges with confidence.
Furthermore, I express deep gratitude to the educational YouTube channels for their
invaluable contributions. Their tutorials on the problem domain and genetic algorithms
have significantly enriched my learning experience, aiding in overcoming project chal-
lenges.
I am immensely grateful for the support and resources provided by Dr. Pandiri
Venkatesh, Aditya Gopakumar, educational YouTube channels, friends, and parents,
which have been integral to the successful progression of my project.
i
ABSTRACT
Given set of n objects of various heights we seek an arrangement of these objects into
k piles in such a way that heights of resulting piles are as nearly as possible. This task
can also be framed as partitioning a set of numerical values into a specified number of
subsets, with the objective of minimizing the differences in the sums of each subset.
In this study, I attempted to tackle the problem in a novel way by employing the
methodologies proposed by Prof. A. Singh and A. Gupta, as well as a combination
of the two. This technique seeks to extensively investigate several choices in order to
identify effective solutions. It demonstrates a commitment to developing new ideas
and merging old ones in order to better understand and solve the problem.To list the
approaches used: 1. Hybrid grouping genetic algorithm. 2. Perturbation-based local
search, and 3. A hybrid technique that combines the preceding algorithms.
I actively searched for new problem cases to optimise, changing the code to make
it more flexible. Devoted to perfection, I painstakingly adjusted algorithms, examining
the characteristics of every incident. Specific changes were implemented to increase
productivity. By using this iterative method, I tried to achieve the best results possible in
a variety of settings while also improving the quality of the solutions and computational
effectiveness..
KEYWORDS: Equal Piles Problem; Genetic Algorithm; Perturbation Based Lo-
cal Search; Hybrid Heuristics.
ii
TABLE OF CONTENTS
ACKNOWLEDGEMENTS i
ABSTRACT ii
LIST OF TABLES v
LIST OF FIGURES vi
ABBREVIATIONS vii
NOTATION viii
1 INTRODUCTION 1
1.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Combinatorial Search Space Analysis . . . . . . . . . . . . . . . . 3
1.4 Objectives of the work . . . . . . . . . . . . . . . . . . . . . . . . 4
2 Literature Survey 6
2.1 HGGA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 PLS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3 The Hybrid Method . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.4 Instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3 Work Done 11
3.1 Proposed algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.2 Instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.3 Initial code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
iii
4 Results and Analysis 15
REFERENCES 22
LIST OF TABLES
4.1 Comparing HGGA ans PLS with Hybrid method for Jones and Bel-
tramo instance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.2 Input Data for Equal Piles Problem . . . . . . . . . . . . . . . . . . 18
4.3 F Values for Uniform Instances . . . . . . . . . . . . . . . . . . . . 18
4.4 F Values for Non-Uniform Instances values ∈ [1,1000] . . . . . . . 19
v
LIST OF FIGURES
vi
ABBREVIATIONS
vii
NOTATION
P
Summation
viii
CHAPTER 1
INTRODUCTION
The equal piles problem, first formulated by Jones and Beltramo in 1991, is revisited in
this study with an emphasis on effective solutions. I tried to implement the approaches
suggested by A. Singh and A. Gupta[2], in addition to a hybrid strategy that incorporates
components from both. The task is to minimise differences in the sums of each pile by
grouping numbers or objects of different heights into K subsets or heaps. In order to
provide new insights into this persistent issue, our research explores efficient ways for
obtaining balanced distributions within specified restrictions. I wanted to increase the
understanding and solution of this basic problem in resource allocation and optimisation
by incorporating new ideas and reexamining old techniques.
1.1 Background
Jones and Beltramo[1] initially presented the Equal Piles Problem in 1991. It entails
dividing a set up into smaller groups. In particular, the goal is to partition a set of N inte-
gers or objects with different heights into K subgroups. Making sure that each subset’s
sum of numbers roughly resembles the sums of the other subsets is the goal. Appli-
cations of the Equal Piles Problem can be found in many fields, including assembly
design, parallel computing, and transportation.
Nine distinct genetic algorithms were tested by Jones and Beltramo[1] on a particu-
lar case shown in Table 1.1. Of them, five made use of group number encoding and the
remaining ones of permutation encoding. An improved grouping genetic algorithm was
presented by Faulkener[3], who achieved F = 0 in all 30 trials with an average of 9608
fitness function evaluations. Greene then introduced the Eager Breeder method, which
achieved F = 0 in 29 out of 30 trials with an average of 3242 fitness assessments. It
included a novel crossover and mutant operator. Along with perturbation-based local
CHAPTER 1. INTRODUCTION CS20B1025
Table 1.1: The equal piles problem instance of Jones and Beltramo[1]
search, Professors A. Singh and A. Gupta created the Hybrid Grouping Genetic Algo-
rithm (HGGA). In all 30 trials, HGGA consistently obtained F = 0, averaging 562.37
fitness ratings.
k
X
F itness = (S i − S avg )
i=0
f = Smax − Smin
, in which Smax denotes the maximum height of piles and Smin denotes their minimum
height. By doing this, the piles that are wedged between the ones at the extreme ends
are brought closer to the mean height.
1.2 Motivation
This problem has a wide range of applications apart from just being purely for academic
interest and mental simulation. Fore example:
Although heuristics, genetic algorithms, and other search strategies have proven
successful in solving these kinds of computational search problems, difficulties still
arise when trying to apply these strategies to new or related problems. Despite their
effectiveness, there is still a need to fully utilise these strategies for newly emerging
problems. This emphasises the continuous need for algorithmic techniques research
and innovation to address real-world issues in a variety of sectors. To handle the chang-
ing complexity present in real-world applications, these approaches must be further
investigated and improved.
The EPP has historically been tackled using algorithms prized for their efficiency. This
paper introduces a novel approach aimed at offering a potential framework for address-
ing the problem, with room for further enhancement through the integration of multiple
heuristics. The proposed framework revolves around the utilization of heuristics to op-
timize the solution process. Here, the heuristics and the sequence of steps, striving to
attain the optimal solution with minimal iterations.
While these methods are effective, they may have minor drawbacks. By integrat-
ing both HGGA and PLS into a hybrid approach, I aim to overcome these limitations.
This hybrid approach combines the strengths of both methods while mitigating their
respective weaknesses. By leveraging the efficiency of HGGA and the robustness of
PLS, I seek to enhance the overall effectiveness of the solution process for the Equal
Piles Problem. Through this integrated approach, I aim to provide a comprehensive
solution framework that leverages multiple techniques to tackle the EPP efficiently and
effectively.
By testing the heuristics on these new instances, I aimed to assess their performance
across a broader spectrum of scenarios, encompassing different object distributions and
problem complexities. Through this expanded testing regimen, valuable insights into
the effectiveness of the heuristics in real-world optimization contexts are sought, ul-
timately contributing to the advancement of optimization methodologies for complex
problems like the Equal Piles Problem.
Literature Survey
Singh and Gupta[2] present new approaches specifically designed for the EPP in their
separate works, emphasising workload balancing by dividing assembly jobs across
workstations equally. In their investigation of the use of GAs for partitioning issues,
Jones and BeltramociteJones highlight how workload balance in assembly lines can be
optimised by utilising the adaptability of GAs, which are motivated by natural selection.
The study by Greene [4] probably looks at more general partitioning issues, using evolu-
tionary algorithms as an adaptable framework to solve difficult optimisation problems,
such as workload balancing in EPP settings. Last but not least, Sabuncu and Simsek[5]
provide a novel strategy for solving challenging combinatorial issues, including work-
load smoothing in assembly lines, utilising answer set programming (ASP). Together,
these publications provide a variety of ideas and insights that might guide the creation of
hybrid strategies for handling workload efficiently by solving the Equal Piles Problem.
2.1 HGGA
specific knowledge to achieve more efficient and effective solutions for the EPP.
Fitness Function:
k
X
F itnessScore = (Si − Savg )
i=0
Within the genetic algorithm framework, several key characteristics define its op-
eration. The initial population creation phase generates a diverse array of potential
solutions, representing different allocations of items into piles. Each individual solu-
tion, akin to a blueprint, outlines how items are distributed, with chromosomes serving
as lists detailing item-pile assignments. Fitness assessment determines the quality of
each solution, guiding the selection process to favor individuals with superior fitness for
reproduction. Crossover and mutation operators introduce variability and exploration
within the population, facilitating the generation of novel solutions. Despite the genetic
algorithm’s robustness, the heuristic operator plays a crucial role in refining solutions
based on problem-specific knowledge or rules. By complementing genetic operations,
heuristics enhance solution quality and guide exploration towards promising areas of
the solution space, leading to improved optimization processes.
Overall, the integration of genetic algorithms and heuristic techniques within the
HGGA framework offers a comprehensive and versatile approach to solving the EPP.
By leveraging evolutionary principles and problem-specific knowledge, HGGA effi-
ciently explores and refines the solution space, aiming for optimal or near-optimal solu-
tions. This hybrid methodology combines the strengths of both approaches, providing
a powerful optimization tool applicable across diverse domains and combinatorial opti-
mization problems
2.2 PLS
The method employs a local search approach to iteratively construct improved solu-
tions. Beginning with an initial solution, the local search aims to minimize the height
of the largest pile. It evaluates whether objects in the largest pile can be redistributed
to other piles or swapped with objects from different piles to reduce the height of the
largest pile. If multiple moves are feasible, the one that maximally reduces the height
is selected. Following this adjustment, the process repeats, identifying a new largest
pile and further optimizing the solution. This local search process continues for a fixed
number of iterations, continually refining the solution to potentially enhance its quality.
Overall, the combination of local search and perturbation techniques offers a sys-
tematic approach to iteratively refine and explore solution space. By focusing on mini-
mizing the height of the largest pile and introducing random perturbations, the method
aims to converge towards optimal or near-optimal solutions for the equal piles prob-
lem. Through these iterative processes, the method systematically navigates the solu-
tion space, potentially uncovering more efficient and effective solutions.
The HGGA and PLS each offer unique strengths and weaknesses in tackling optimiza-
tion problems.
HGGA excels in global search, effectively exploring the entire solution space to
mitigate the risk of being trapped in local optima. Its ability to traverse diverse re-
gions of the search space makes it well-suited for complex optimization challenges.
Additionally, HGGA benefits from parallelization, allowing for efficient utilization of
multiple processors or cores to expedite computations. However, its computational cost
can be substantial, particularly for large problem instances, and its effectiveness hinges
on parameter tuning for selection, crossover, and mutation operations.
On the other hand, PLS is characterized by its efficiency and simplicity. It offers
a faster alternative to HGGA, making it particularly suitable for scenarios where quick
solutions are desired. The straightforward nature of PLS simplifies implementation and
facilitates ease of understanding. However, PLS may encounter challenges with local
optima, as it primarily focuses on exploring the vicinity of a starting solution. This
limited exploration can potentially lead to suboptimal solutions, as better alternatives in
distant regions of the search space may remain unexplored.
2.4 Instances
In addition to evaluating the proposed heuristics on the Jones and Beltramo instance
mentioned in Table 1.1, I conducted further testing on new instances derived from the
multiprocessor scheduling problem P ||Cmax [1, 6, 7]. These instances offer a diverse
range of parameters, with the number of objects n varying from 10 to 1000 and the
number of piles k ranging from 5 to 25, satisfying the condition n > k.The object sizes
for these instances were randomly generated within different intervals: [1, 100], [1,
1000], and [1, 10000].
2.5 Summary
The HGGA combines genetic algorithms and heuristics to optimize object allocation,
while PLS refines solutions through iterative local search. This hybrid method lever-
ages global exploration of genetic algorithms and local refinement of local search for
improved optimization in complex problems like the EPP.
Work Done
3.2 Instances
evaluation aimed to provide insights into the effectiveness and robustness of the heuris-
tics in addressing real-world optimization challenges, contributing to advancements in
optimization methodologies for problems like the Equal Piles Problem.
At the core of the code lie several key functions responsible for different stages of
the optimization process. The initialization function sets the stage by generating an
initial population of solutions, each representing a potential allocation of items to bins.
This diversity ensures that the algorithm explores a wide range of possible solutions,
increasing the likelihood of finding high-quality solutions.
The fitness calculation function evaluates the quality of each solution by assessing
how well items are distributed among the bins. Solutions with more evenly balanced
bins are assigned higher fitness scores, reflecting their desirability. This incentivizes the
algorithm to prioritize solutions that lead to more efficient packing arrangements.
The genetic algorithm phase involves operations such as crossover and mutation,
inspired by principles of natural selection and genetic inheritance. Crossover facili-
tates the exchange of genetic material between parent solutions, creating offspring with
characteristics inherited from both parents. Mutation introduces random changes to in-
dividual solutions, injecting diversity into the population and preventing the algorithm
from getting stuck in local optima.
Selection mechanisms ensure that solutions with higher fitness scores are more
likely to be chosen as parents for the next generation, mimicking the process of nat-
ural selection in biological evolution. This bias towards better solutions helps steer the
algorithm towards regions of the solution space that are more promising in terms of
optimization objectives.
After the genetic algorithm phase, the code incorporates a perturbation local search
(PLS) mechanism to further refine solutions. PLS iteratively perturbs individual solu-
tions by relocating items between bins, aiming to improve their fitness. This iterative
refinement process explores the neighborhood of each solution, seeking to uncover im-
provements that may not have been accessible through genetic operations alone.If the
perturbation is too much then many of its good features are lost and local search may
not be able to improve the obtained solution to a value better than the current best.
The main function orchestrates the entire optimization process, from initialization to
final solution evaluation. It coordinates the execution of the genetic algorithm, including
multiple generations of evolution, and applies the perturbation local search technique
to enhance solution quality iteratively. Finally, it presents the best solution found along
with its corresponding fitness, providing insights into the algorithm’s effectiveness in
solving the optimization problem at hand.
Overall, the code offers a robust and flexible framework for solving combinatorial
optimization problems. By combining the strengths of genetic algorithms and local
search techniques, it demonstrates a powerful approach to explore complex solution
spaces and identify near-optimal solutions efficiently. Its modular structure and sys-
tematic approach make it applicable to a wide range of optimization problems beyond
bin packing, showcasing its versatility and utility in diverse domains.
This part of the paper delves into the results and fitness values, emphasizing readability
and clarity. A fitness score of zero represents the optimal solution, with values ap-
proaching zero indicating superior outcomes. The output presented here pertains to a
simplified problem, facilitating easier interpretation. It details the partitioning of ’n’
values into piles, shedding light on the order of heuristics selected and their impact
on solution quality. By comprehensively examining the results and fitness values, this
chapter aims to offer a deeper understanding of the optimization process and the effec-
tiveness of the heuristic strategies employed.The below table compares the performance
of HGGA and PLS and Hybrid method
Table 4.1: Comparing HGGA ans PLS with Hybrid method for Jones and Beltramo
instance
For PBLS-EPP,I have maintained pcp = 0.8 and capped the maximum number of it-
erations at 1000. The divergence in pcp values between HGGA-EPP and PBLS-EPP
stems from their distinct operational mechanisms. In HGGA-EPP, mutation serves
as a subsidiary operator primarily tasked with preserving diversity within the popula-
tion. Conversely, in PBLS-EPP, mutation functions to perturb the current best solution.
CHAPTER 4. RESULTS AND ANALYSIS CS20B1025
Hence, the nuanced differences in pcp values reflect the tailored roles of mutation within
each algorithm.
An example of one instance from both uniform and non uniform are given below
Within each family, comprising both uniform and non-uniform instances, there are
10 instances for every combination of n, k, and object size interval, resulting in a to-
tal of 390 instances. To comprehensively evaluate the performance of the instances, I
conducted trials on 13 randomly selected instances from both uniform and non-uniform
categories. These instances encompassed all possible combinations of n and k values.
The results of these executions are presented in the tables below. Through this system-
atic approach, I aimed to provide a thorough assessment of the instances’ performance
across various parameters, offering valuable insights into their effectiveness in address-
5.1 Conclusion
The attached report describes the development of a software programme that efficiently
distributes objects with different values or heights by using a hybrid approach with
Perturbation-based Local Search (PLS), Hybrid Grouping Genetic Algorithm (HGGA),
and other techniques. The main goal is to divide these things into subsets with the goal
of distributing the total of values inside each subset equitably. We have seen through
careful investigation that HGGA and PLS have optimisation skills that are further im-
proved when combined into a hybrid model. Though the results are encouraging, further
research is necessary due to the heuristics’ inherent complexity.
As a result, I will be investigating methods for better using these heuristics to in-
crease the effectiveness of the solutions. Through exploring the nuances of these meth-
ods, I want to find ways to improve the process of finding solutions and eventually pro-
duce better and faster results. This section lays the groundwork for future developments
in solution optimisation by enabling the existing algorithms to reach their maximum po-
tential. It’s important to remember that although though the hybrid strategy typically
performs better than separate techniques, it can not always produce the best result. The
F value obtained using the PLS approach is sometimes even competitive. By means
of strategic use of heuristics and repeated refinement, I am committed to pushing the
limits of solution quality and efficiency of the solution in different item distribution
I’m now looking on methods to improve the hybrid approach so that it yields better
results, especially when there are more objects involved. To achieve more effective
CHAPTER 5. CONCLUSIONS AND EXTENSIONS CS20B1025
and efficient solution creation, this entails improving the hybridization process to better
handle instances with different item values.
[2] A. Singh and A. K. Gupta, “Two new heuristics for the equal piles problem.” in
IICAI, 2005, pp. 3408–3423.
[5] O. Sabuncu and M. C. Simsek, “Solving assembly line workload smoothing prob-
lem via answer set programming.” in ICLP Workshops, 2020.
[7] R. Mishra and A. Jaiswal, “Ant colony optimization: A solution of load balancing
in cloud,” International Journal of Web & Semantic Technology, vol. 3, no. 2, p. 33,
2012.
22
Weekly Review Report
23
Plagiarism Report
Insert the 1st page of the plagiarism report (containing the similarity index). Make sure
that it is duly signed by you as well as your supervisor.
24