You are on page 1of 58

HEURISTIC ALGORITHM BASED GENETIC

APPROACH FOR CONTAINER LOADING


PROBLEM

DC Meetig Presentation 1
GIST OF PRESENTATION
 Abstract.
 Overview of Research.
 Module I : User Input
 Module II : Encoding
 Module III : Genetic Algorithm
 Module IV & V : Decoding & Result
 Conclusion.

DC Meetig Presentation Slide 2


ABSTRACT
Goal :
Maximizing the number of boxes to be packed
inside a container.

To achieve this goal :


A New Heuristic Algorithm Based On Genetic
Approach Is Put Forward In This Work For
Tackling Container Loading Problem.

DC Meetig Presentation 3
Abstract Contd..
The work is mainly concentrated on the
problem of
Finding the best mix of boxes that yield
maximal container volume utilization,

Finding the best orientation of each and


every box,

Including the practical constraints in


packing.
DC Meetig Presentation 4
OVERVIEW OF RESEARCH
WORK

DC Meetig Presentation5
START
User Input
Module GET
INPUT

ENCODE THE PATTERNS


IN TO GA CHROMOSOMES
Encoding
Module

GENETIC
ALGORITHM
Heuristic
Genetic
Algorithm NO
IS THE
Module SOLUTION
FEASIBLE ?
YES
Decoding
Module DECODE GA
Developed CHROMOSOMES
Optimized
Solution or SOLUTION
Output
DC Meetig Presentation 6
Module STOP
Module I
INPUT PARAMETERS
INPUT :
Container : Standard Size
No. of boxes : to be packed
Box Dimensions : Length, Width & Height.
Box specification : Shape and Weight.
Box Constraints : Orientation, position, etc

DC Meetig Presentation 7
DC Meeting Presentation
8
Slide
Proposed GUI for User Input

DC Meetig Presentation 9
Module II
ENCODING TO GA CHROMOSOMES
S.N Description Actual GA Code Byte String Location
o Value length

BOX SPECIFICATION
1. 4 100 3 0th to 2nd
location
2. 5 101 3
Length
3. 6 110 3

4. 7 111 3

5. Breadth -do- -do- 3 3rd to 5th


Location
6. Height -do- -do- 3 6th to 8th
DC Meetig Presentation Location 10
GA Encoding contd..
S.N Description Actual GA Code Byte String Location
o Value length

BOX POSITION
7. Left side 2 010 3

8. Right side 3 011 3 37th to 39th

9. Below 4 100 3 Location

10. Above 5 101 3

11. Front 6 110 3

12. Behind 7 111 3

DC Meetig Presentation 11
GA Encoding contd..
S.No Description Actual GA Code Byte String
. Value length Location

ORIENTATIONS
13. No Rotation 0 00 2

14. Only 1 01 2 40th to 41st


Horizontal Location
15. Only 2 10 2
Vertical
16. All Rotation 3 11 2

DC Meetig Presentation 12
EXAMPLE FOR GA ENCODING
Box 1 Box 2 Box 3 Box 4
Length : 4 mts 5 mts 4 mts 7 mts
Breadth : 4 mts 5 mts 5 mts 4 mts
Height : 4 mts 7 mts 6 mts 5 mts
Position : Left side
Orientation : No constraint
• Parent 1 :
100 100 100 101 101 111 100 101 110
111 100 101 010 11
Similarly
• Parent 2 :
10010111011110010110010010010110111101111
DC Meetig Presentation 13
Module III
GENETIC ALGORITHM
• Genetic Algorithm is a search technique
used to find approximate or best solution
to optimization and search problems.
Stages of Genetic Algorithm
1. Generate Population randomly.
2. Choose the initial population.
3. Evaluate the fitness value.
4. Select the best pair.
5. Reproduction or Cross over.
6. Mutation
7. Repeat until terminating condition reached.
DC Meetig Presentation 14
Cooking A Cookie
9 0 3 2 4 4 3 1 3 6

8 0 0 1 4 6 5 6 4 3

7 2 0 2 4 7 5 4 4 6

6 4 0 2 4 8 7 6 6 1

5 0 4 6 8 9 8 7 6 4

Sugar In 4 2 6 1 1 8 5 1 4 3
Kilogr
ams 3 2 3 4 4 6 7 7 6 3

2 0 1 2 3 4 4 1 4 4

1 0 1 2 3 7 3 5 4 1

1 2 3 4 5 6 7 8 9
Flour in Kilograms
Initialization
– Many individuals are randomly generated from
the initial population.
– Random generation is similar to Roulette
Wheel selection.
• Example:
– Parents : 1-1, 1-2, … 2-2, …3-5, … 6-8,..9-
9.

• Fitness Value : Quality of the Cookie


» 1-1= 0 ; 1-2 = 0 ; 2-2 = 1 ; 5-5 = 9 ; 9-9 = 6
Reproduction / Crossover
– Reproduction is to generate a new generation
population.

– The new generation child shares the


characteristics of both parents.

• Mutation
– Mutation is used to ensure that potential solution
are not lost and it only brings innovations in the
new generations.
• Cross Over:
– Parent 1 : 5 – 1
– Parent 2 : 2 – 4
• After Cross Over (First Generation)
• Child 1 : 5 – 4
• Child 2 : 2 – 1
• Fitness Value for child 2 : 2 – 1 is 1 => low
survival of fitness so the child dies
• Fitness Value for child 1 : 5 – 4 is 8 => high
survival of fitness.
• Mutation:
–Child 1 : 5 – 4
• Randomly change the gene 4 to 5
• Child 1 = 5 – 5
–The Fitness value = 9 (Optimal
solution)
GA STAGE I :
GENERATE POPULATION RANDOMLY

Mostly individuals are randomly generated for


the initial population.

Population size depends upon the nature of


the problem. – (for this work population size
-100)
Random generation is similar to Roulette
Wheel selection. (for this work randomize
function in Visual Basic software)
Example:
Randomly Generated Parents :
• 10010111011110010110010010010110111101111
DC Meetig Presentation 20
GA Stage II
EVALUATING THE FITNESS FUNCTION

Fitness Function
F(x) = packed volume + constraint penalty

Packed Volume =
sum of (Length(x) * Length(y) * Length(z) ) of all boxes

Constraint Penalty = check for constraints


Subjected to Length(x) < Container Length(x)
Length(y) < Container Length(y)
Length(z) < Container Length(z)

DC Meetig Presentation 21
GA Stage III
SELECTION OF POPULATION
– During each successive epoch, a
proportion of the existing population is
selected for breeding of new
generation. i.e. selecting the fittest
parent for next generation.

– Individual selection for breeding is


mainly depend on fitness value.

DC Meetig Presentation 22
GA Stage IV
REPRODUCTION / CROSS OVER

– Reproduction is to generate a new generation


of population.

– The new generation child shares the


characteristics of both parents.

– For further breeding parents are selected


from the new generation and the process
repeats.

DC Meetig Presentation 23
Example for Crossover

Paren crossover crossover new


t No Mating pool pair site generation

1 01011 2 2 01001

2 11001 1   11011

3 11001 4 3 11011

4 11111 3   11101
DC Meetig Presentation 24
GA Stage IV
MUTATION
Mutation is used to ensure that potential
solution are not lost and it only brings
innovations in the new generations.
Randomly swap the gene

Mutation Mutant
Parent Location parent

11001 3 11101

DC Meetig Presentation 25
GA Stage V
TERMINATION
– The generation is repeated until the
termination condition is reached.
– Some of the commonly used termination
conditions are:
• If a solution reached minimum criteria.
• If fixed number of generations reached.
• If allotted time/money/cost reached.
• If successive iteration no longer produce
better result.
• By manual inspection.
• And so on.DC Meetig Presentation 26
APPLICATIONS
 Artificial Creativity.
 Container loading optimization.
 Automated design, including composite material design,
Mechatronics design and multi-objective design for weight savings,
etc.
 Configuration applications, particularly physics applications of
optimal molecule configurations.
 Learning fuzzy rule base using genetic algorithms.
 Linguistic analysis
 Mobile communications infrastructure optimization.
 Molecular Structure Optimization (Chemistry).
 Multiple population topologies and interchange methodologies.
 Optimization of data compression systems.
 Plant floor layout optimization.
 Scheduling applications, including job-shop scheduling.
 Software engineering
 Solving the machine-component grouping problem
 Design of water distribution systems.
 Distributed computer network topologies.
 Electronic circuit design, known as Evolvable hardware
 And many more. DC Meetig Presentation 27
Module IV
DECODING

Reverse process of encoding.


Converting the GA chromosomes into
real values.
Feasibility condition also checked in
this stage.

DC Meetig Presentation 28
Module V
RESULT
OUTPUT :

.
Optimal combination of boxes with maximal
usage of container volume

DC Meetig Presentation 29
Proposed GUI to display output

DC Meetig Presentation 30
Proposed GUI to display output

DC Meetig Presentation 31
1D BIN PACKING
Optimizing only one parameter.

Minimizing no. of CD’s in Recording


songs. i.e. length of the song is only one
criteria.

Commonly used 1D Bin Packing


Algorithm are:
◦ First Fit Algorithm (FFA).
◦ First Fit Decreasing Algorithm (FFDA).
◦ Refined First Fit Algorithm (RFFA).
◦ Best Fit Algorithm (BFA).
◦ Best Fit Decreasing Algorithm (BFDA)
◦ Annealing-Genetic Algorithm (AGA).
◦ And so on… DC Meetig Presentation 32
2D – BIN PACKING
Allocating Rectangles in Rectangular
box. i.e. optimizing two parameters.
• Slide Pack Algorithm
– Place a box at one corner of bin & allow to fall to
farthest corner of bin.
• Skyline Pack Algorithm
– For each and every box all its position and orientation
are checked.
• Nesting Algorithm
– Grouping the similar boxes and placing into bin.
• Branch and Bound Algorithm.
• Knapsack Algorithm.
• And so on…
DC Meetig Presentation 33
3D-BIN PACKING
Placing Number of Boxes in to a bigger
Box. i.e. optimizing 3 parameters
simultaneously.

Classification:
– Homogenous and Heterogeneous problems.
– Single and Multiple Container Loading.

DC Meetig Presentation 34
BIN-PACKING ALGORITHMS

Stability
Stability
Heuristic
method
method
Knapsack

Decomp Strip
3D BIN-PACKING Packing
ALGORITHMS
Wall Hybrid
building
Algorithm Geometric
Tree
Generating Method
Heuristic

DC Meetig Presentation 35
The Next Big Step

Genetic
Algorithm
n

Heuristic Tech.
io
ut

Optimization Tech.
ol

Experiences
Ev

Trial & Error Methods


(Middle Ages)

Computational Time
DC Meetig Presentation 36
DETAILS OF THE DEVELOPED SIMPLE
GENETIC ALGORITHM PROGRAM
Software
SoftwarePlatform
PlatformSelected:
Selected: Visual
VisualBasic
Basic
Reference
Reference :: Reference
ReferenceBooks
Books(Goldberg)
(Goldberg)
Problem
Problem :: Finding
Findingthe
themaximum
maximum value
valuefor
forthe
the
function
functionXX2
2

Assumed
AssumedInput
Inputparameters
parameters ::
Population
Populationsize
size: : 44
String
Stringlength
length : : 3,4,5,…9
3,4,5,…9
Termination
Termination : : 100
100Generations
Generationsorordesired
desiredvalues.
values.
Crossover
Crossover :: Single
Singlepoint
pointcrossover
crossover
Mutation
Mutation :: 11%%
Type
Type :: Binary
Binarycoded
codedGA
GA
Fitness
Fitnessfunction
function
F(x) = X 2
F(x) = X2

DC Meetig Presentation 37
PROBLEM DEFINITION &
EXPECTED RESULT
Expected
String For Binary Actual Real
S.No. Output
length Digit Number (X)
F(x) = X2
1 3 111 7 49
2 4 1111 15 225
3 5 11111 31 961
4 6 111111 63 3969
5 7 1111111 127 16129
6 8 11111111 511 261121
7 9 111111111 1023
DC Meetig Presentation
1046529 38
DEVELOPED GUI FOR USER INPUT

DC Meetig Presentation 39
INITIALIZING THE PARAMETERS

Generation = 100
Mutation probability = 0.01
Desired value = square of real value for the
given string length
No of parents = 4
String length = 5
DC Meetig Presentation 40
RANDOM GENERATION OF PARENTS
USING RANDOMIZE FUNCTION
For
Forj j==11totono
noofofparents
parents
For
Fori i==11totostrlength
strlength
Randomize
Randomize
Genome(j)
Genome(j)==genome(j)
genome(j)&&CInt(Rnd())
CInt(Rnd())
Eg:
Eg:
Parent No Generated Parent
Parent 1/1 00000
Parent 2/1 01011
Parent 3/1 11001
Parent 4/1 11001
DC Meetig Presentation 41
FINDING THE FITNESS VALUE FOR THE
RANDOMLY GENERATED PARENTS
Converting the binary string into real number
and squaring

For i = 1 to strlength
temp = temp + (gene(k) * (2 ^ (i - 1)))
k=k–1
Parent No Generated Parent X value
Eg:
Parent 1/1 00000 0
Parent 2/1 01011 11
Parent 3/1 11001 25
DC Meetig Presentation 42
Parent 4/1 11001 25
CHECK FOR DESIRED VALUE
• If the value of best parent = desired value
then terminate
• Else repeat steps

DC Meetig Presentation 43
KILLING THE WORST PARENT AND
REPRODUCING NEW MATING POOL
Calculating the survival value =
Calculated fitness value / Average of fitness value

If survival value = 0 then


that parent will be removed

Elseif survival value = 1 then


that parent will remain in population

Else survival value = 2 then


that parent will be repeated twice in the
population and soDCon.
Meetig Presentation 44
SELECT MATING PARENTS RANDOMLY
Gener
X
Parent ated Functio Value Value/ Actual Mating crossove crossov
valu
No Paren n Value /sum avg count pool r pair er site
e
t
Parent
00000 0 0 0 0 0 01011 2 2
1/1

Parent
01011 11 11 0.180 0.7213 1 11001 1
2/1

Parent
11001 25 25 0.409 1.6393 2 11001 4 2
3/1

Parent
11001 25 25 0.409
DC Meetig 1.6393
Presentation 2 11001 3 45
4/1
CROSSOVER

Mating Crossover New


Crossover pair
pool site generation

01011 2 2 01001

11001 1 11011

11001 4 2 11001

11001 3 11001

DC Meetig Presentation 46
MUTATION
Apply Mutation operator
 It will be applied to only 1 % of generations.
 Mutation site selected will be random
 swapping of binary digit occurs at that site.

Repeat the steps 4 to 10 until achieving the


terminating condition.
Terminating Condition:
Repeat until 100 generations occurs. Or
Until desired value is obtained

DC Meetig Presentation 47
GENERATION I
Actu
Pare Genera X Functi al Mati cross cross new Mut Muta
nt ted val on Value Value coun ng over over gener Loc, nt
No Parent ue Value /sum /avg t pool pair site ation Str Child

Par
ent 010 0100
1/1 00000 0 0 0 0 0 11 2 2 1    
0.18 0.72
Par 032 131
ent 786 147 110 1101 110
2/1 01011 11 11 9 5 1 01 1   1 0, 11
0.40 1.63
Par 983 934
ent 606 426 110 1100
3/1 11001 25 25 6 2 2 01 4 2 1    
0.40 1.63
Par 983 934
ent 606 426Presentation 110
DC Meetig 1100 48
4/1 11001 25 25 6 2 2 01 3   1    
GENERATION II
Par 0.10 0.41 11 11
ent 4651 8604 01 10
1/2 01001 9 9 163 651 0 1 2 2 11001 3, 1

Par 0.31 1.25 11


ent 2 3953 5813 00
2/2 11011 7 27 488 953 1 1 1   11011    

Par 0.29 1.16 11


ent 2 0697 2790 00
3/2 11001 5 25 674 698 1 1 4 4 11001    

Par 0.29 1.16 11


ent 2 0697 2790 00
DC Meetig Presentation 49
4/2 11001 5 25 674 698 1 1 3   11001    
GENERATION III
Par 0.27 1.09 11 11
ent 2 3584 4339 10 11
1/3 11101 9 29 906 623 1 1 2 3 11111 0, 1

Par 0.25 1.01 11


ent 2 4716 8867 01
2/3 11011 7 27 981 925 1 1 1   11001    

Par 0.23 0.94 11


ent 2 5849 3396 00
3/3 11001 5 25 057 226 1 1 4 3 11001    

Par 0.23 0.94 11


ent 2 5849 3396 00
DC Meetig Presentation 50
4/3 11001 5 25 057 226 1 1 3   11001    
GENERATION IV

Parent 1/4 11111 31 31

Parent 2/4 11001 25 25

Parent 3/4 11001 25 25

Parent 4/4 11001


DC Meetig Presentation
25 25 51
INITIALLY ASSUMED ENCODING
S.No.
PROCEDURE
Description Actual Value GA Code Byte length String Location

Box Specification
1. Length 4 100 3 0th to 2nd location
2. 5 101 3
3. 6 110 3
4. 7 111 3
5. Breadth -do- -do- 3 3rd to 5th Location
6. Height -do- -do- 3 6th to 8th Location
Box Position
7. Left side 2 010 3 37th to 39th Location
8. Right side 3 011 3
9. Under 4 100 3
10. Above 5 101 3

11. Front 6 110 3


12. Behind 7 111 3

Orientations
13. No Rotation 0 00 2 40th to 41st Location
14. Only Horizontal 1 01 2
DC Meetig Presentation 52
15. Only Vertical 2 10 2
INITIALIZING THE PARAMETERS

Generation
Generation ==500
500
Mutation
Mutationprobability
probability ==0.01
0.01
Desired
Desiredvalue
value ==Maximum
MaximumValue
Valuegenerated
generated
No.
No.ofofparents
parents ==100
100
String
Stringlength
length ==42
42

DC Meetig Presentation 53
CONCLUSION
• In this research work a new heuristic
algorithm using genetic approach will be
developed to maximize the space
utilization in container with wide Varity of
boxes along with practical constraints.

• Thus this research work will solve most of


the challenging problems faced in the
container loading.
DC Meetig Presentation 54
REFERENCE
S.No Title Author Journal Year Ref No
H.C.W. Lau,
Elsevier Expert
An AI approach for optimizing T.M. Chan, W.T.
1 Systems with 2009 in press
multi-pallet loading operations Tsui *, G.T.S.
Applications
Ho, K.L. Choy
Evolutionary based heuristic for Elsevier Computers & 55 (2008)
2 Adam Stawowy 2008
bin packing problem Industrial Engineering 465–474
Tackling the container loading Napoleão
LNCS
problem: a hybrid approach Nepomuceno,
Springer-Verlag 4446, pp.
3 based on integer linear Plácido Pinheiro, 2007
Berlin Heidelberg 154 – 165,
programming and genetic and André L.V.
2007
algorithms Coelho
Elsevier - Robotics
Using genetic algorithms to Felix T.S. Chan,
and Computer- 23 (2007)
4 solve quality-related bin packing K.C. Au, L.Y. 2007
Integrated 71–81
problem Chan, T.L. Lau
Manufacturing
An improved heuristic recursive ZHANG De-Fu1
strategy based on genetic CHEN Sheng- Acta Automation Vol 33 No
5 2007
algorithm for the strip DC Meeting Presentation
Da1 LIU Yan-
Slide
Sinica 9 Sep
55 2007
Reference contd..
A hybrid genetic algorithm Eleni Elsevier -European 183
for the two-dimensional Hadjiconstantin Journal of (2007)
6 2007
single large object placement ou a, Manuel Operational 1150–
problem Iori Research 1166
Genetically designed 978-1-
7 heuristics for the bin packing Oana Muntean ACM 2007 59593-
problem 698-1

Using tree search bounds to


Elsevier - European
enhance a genetic algorithm Kathryn A
8 Journal of 2006 390-402
approach to two rectangle Downs land
Operation research
packing problems

A randomized heuristic for Mykolas


INFORMATION
the container loading Juraitis, Tomas 2006, Vol.
9 TECHNOLOGY 2006
problem: further Stonys, Arūnas 35, No. 1
AND CONTROL
investigations Starinskas
Bin packing using genetic Armando
DC Meeting Presentation IEEE - Computer 0-7695-
10 Slide 2005 56
algorithm Ponce Perez society 2283-1/05
Research Work
using GA

DC Meetig Presentation 57
DC Meetig Presentation 58

You might also like