Q 1.A If you were to try to use BFS on the Figure 4 example, what would be the unloading sequence returned for all of the
packages?
Conditions: The sequence must ensure stability, and not remove packages that will cause other(s) to fall. Only packages that
can be removed without causing others to fall are considered viable successors and may be added to the frontier.
The successors will be added to the frontier following row precedence of: A>B>C>D>E and column precedence of 1>2>3>4.
This rule adds the package at the highest location to the frontier first. Thus if multiple packages share the same row, we would
choose the one in the leftmost column.
Use FIFO priority to break ties for successor nodes with the same cost
From ED POST. The sort will only happen to the successors. Not the entire frontier.
FROM ED POST: Successors will be the ALL the children of a node in terms of a search tree.
Assumption- When a package (parent) is removed, a successor is defined as a child node (package) that gets eligible for
removal due to the removal of the parent node. For instance if A2 is removed B2 becomes eligible for removal. For example if
A2 is removed B2 is now the top package and eligible for removal and is a potential successor. We only sort this and not the
entier frontier ie. C4, D1, E3 on step 1.
Explore A2:
Frontier={C4, D1, E3, B2}
Explore C4:
Frontier={D1, E3, B2, D4} ,
Explore D1:
Frontier={E3, B2, D4,E1}
Explore E3:
(no child node and so no successor)
Frontier={B2, D4,E1}
Explore B2:
Frontier={ D4,E1,C2}
Explore D4:
Frontier={E1,C2,E4}
Explore E1:
(no child node and so no successor)
Frontier={C2,E4}
Explore C2
Frontier={E4,D2}
Explore E4
(no child node and so no successor)
, Frontier={D2}
Explore D2
Frontier={E2}
Explore E2 and STOP
FINAL
A͏︋͏󠄅︇︄2͏︋󠄅︇︄-͏︋󠄅︇︄C4
͏︋󠄅︇︄ ͏︋󠄅︇︄-͏︋󠄅︇︄D1
͏︋󠄅︇︄ ͏︋󠄅︇︄-͏︋󠄅︇︄E͏︋󠄅︇︄3͏︋󠄅︇︄-͏︋󠄅︇︄B͏︋󠄅︇︄2͏︋󠄅︇︄-͏︋󠄅︇︄D4
͏︋󠄅︇︄ ͏︋󠄅︇︄-͏︋󠄅︇︄E1
͏︋󠄅︇︄ ͏︋󠄅︇︄-͏︋󠄅︇︄C2
͏︋󠄅︇︄ ͏︋󠄅︇︄-͏︋󠄅︇︄E͏︋󠄅︇︄4͏︋󠄅︇︄-͏︋󠄅︇︄D͏︋󠄅︇︄2͏︋󠄅︇︄-͏︋󠄅︇︄E͏︋󠄅︇︄2͏︋󠄅︇︄25.683
͏︆͏󠄁󠄌󠄅󠄄A͏︆󠄁󠄌󠄅󠄄2͏︆󠄁󠄌󠄅󠄄-͏︆󠄁󠄌󠄅󠄄C4
͏︆󠄁󠄌󠄅󠄄 ͏︆󠄁󠄌󠄅󠄄-͏︆󠄁󠄌󠄅󠄄D1
͏︆󠄁󠄌󠄅󠄄 ͏︆󠄁󠄌󠄅󠄄-͏︆󠄁󠄌󠄅󠄄E͏︆󠄁󠄌󠄅󠄄3͏︆󠄁󠄌󠄅󠄄-͏︆󠄁󠄌󠄅󠄄B͏︆󠄁󠄌󠄅󠄄2͏︆󠄁󠄌󠄅󠄄-͏︆󠄁󠄌󠄅󠄄D͏︆󠄁󠄌󠄅󠄄4͏︆󠄁󠄌󠄅󠄄-͏︆󠄁󠄌󠄅󠄄E͏︆󠄁󠄌󠄅󠄄1͏︆󠄁󠄌󠄅󠄄-͏︆󠄁󠄌󠄅󠄄C2
͏︆󠄁󠄌󠄅󠄄 ͏︆󠄁󠄌󠄅󠄄-͏︆󠄁󠄌󠄅󠄄E͏︆󠄁󠄌󠄅󠄄4͏︆󠄁󠄌󠄅󠄄-͏︆󠄁󠄌󠄅󠄄D͏︆󠄁󠄌󠄅󠄄2͏︆󠄁󠄌󠄅󠄄-͏︆󠄁󠄌󠄅󠄄E͏︆󠄁󠄌󠄅󠄄2͏︆󠄁󠄌󠄅󠄄
Q 2.A.1
Parent1 = [X1 = 20, X2 = 40, X3 = 30, X4 = 10, X5 = 20]
Parent2 = [X1 = 30, X2 = 10, X3 = 20, X4 = 40, X5 = 10]
Crossover point index 4,
C1= [X1 = 20, X2 = 40, X3 = 30, X4 = 40, X5 = 10]
Total Damage= 10 X1+ 20 X2 + 30 X3 +40 X4 +50 X5 = 10*20+20*40+30*30+40*40+50*10= 4000
M=20+40+30+40+10=140
Variety penalty = 1000 * (1-(40/140))
Fitness function E(X) = Total damage - Variety penalty = 4000 – (1000 * (1-(40/140) )= 3285.714286 (rounded off to 6 digits)
Q 2.A2
Parent1 = [X1 = 20, X2 = 40, X3 = 30, X4 = 10, X5 = 20]
Parent2 = [X1 = 30, X2 = 10, X3 = 20, X4 = 40, X5 = 10]
Crossover point index 4,
C2= [X1 = 30, X2 = 10, X3 = 20, X4 = 10, X5 = 20]
Total Damage= 10 X1+ 20 X2 + 30 X3 +40 X4 +50 X5 = 10*30+20*10+30*20+40*10+50*20= 2500
M=30+10+20+10+20=90
Variety penalty = 1000 * (1-(30)/90
Fitness function E(X) = Total damage - Variety penalty = 2500 – (1000 * (1-(30)/90) = 1833.333333 (rounded off to 6 digits)
Q 2.A3
C2= [X1 = 30, X2 = 10, X3 = 20, X4 = 10, X5 = 20]
C3= [X1 = 30, X2 = 30, X3 = 20, X4 = 10, X5 = 20]
Total Damage= 10 X1+ 20 X2 + 30 X3 +40 X4 +50 X5 = 10*30+20*30+30*20+40*10+50*20= 2900
M=30+30+20+10+20=110
Variety penalty = 1000 * (1-(30)/110
Fitness function E(X) = Total damage - Variety penalty = 2900 – (1000 * (1-(30)/110) = 2172.727273 (rounded off to 6 digits)