SlideShare a Scribd company logo
1 of 35
Branch and Bound
( unit-vii )
 Backtracking is effective for subset or permutation
problems.
 Backtracking is not good for optimization problems.
 This drawback is rectified by using Branch And Bound
technique.
 Branch And Bound is applicable for only optimization
problems.
 Branch and Bound also uses bounding function similar to
backtracking.
Problem state :-
Each node in the tree is a problem state.
State Space :-
All paths from the root to problem states define the state
space of the problem.
Terminology of tree organization
Solution States :-
These are those problem states S for which the
path from the root to S define a tuple in the
solution space.
Solution Space :-
All paths from the root to solution states define
the solution space of the problem.
1
34
18
50
2
8 13 19
3
5 7 12
10 15 17 23
21 26 28 33
31 37 39 44
42 47 9 55
53 58 60 65
63
4 6 11
9 14 16 22
20 25 27 32
30 36 38 43
41 46 48 54
52 57 59 64
62
29 35 40
24 51 56 61
45
X1=1
X1=2 X1=3
X1=4
2 3 4 1 3 4
1 2 4 1 2 3
3 4 2 4 2 3 3 4 1 4 1 3 2 4 1 4 1 2 2 3 1 3 1 2
4 3 4 2 3 2 4 3 4 1 3 1 4 2 4 1 2 1 3 2 3 1 2 1
x2=
x3=
x4=
Tree organization of the 4-queens solution space. Nodes are numbered as in depth
first search.
Ex :-
– A node which has been generated and all of whose
children have not yet been generated is called a live
node.
– The live node whose children are currently being
generated is called E-node ( Expanding node ).
– A dead node is a generated node which can not to be
expanded further or all of whose children have been
generated.
Branch And Bound
Nodes will be expanded in three ways.
• FIFO branch and bound-- queue
• LIFO branch and bound-- stack
• Least-Cost (or max priority) branch and bound)—priority
queue.
• Least-cost branch and bound directs the search
to the parts which most likely to contain the answer.
Ex:- 4 – Queens Problem
FIFO Branch And Bound Algorithm
18 19 20 21 22 23 24 25 26 27 28 29
6 7 8 9 10 11 12 13 14 15 16 17
2 3 4 5
1
30
Answer node
Portion of 4 – queens state space tree
generated by FIFO branch and bound
2 3 4 1 3 4 1 2 4 1
2
3
x1=1
2
3 4
 In this case backtracking method is
superior than branch and bound method.
Least Cost ( LC) search :-
• In both FIFO and LIFO branch and bound the selection
rule for the next E-node does not give any preference to
a node that has a very good chance of getting an answer
node quickly.
• In the above example when node 22 is generated, it
should have become obvious that this node will lead to
an answer node in one move.
• However , the FIFO rule first requires the expansion of
all live nodes generated before node 22 was expanded.
• The search for an answer node can be speeded by using
an “intelligent “ ranking function c (.) for live nodes.
• The next E-node is selected on the basis of this ranking
function.
• If we use ranking function that assigns node 22 a better
rank than all other live nodes , then node 22 will become
the E-node following node 29.
^
• The ideal way to assign ranks will be on the basis of the
additional effort ( cost) needed to reach an answer node
from the live node.
For any node x, this could be
1) The number of nodes in the subtree with root x that need
to be generated before an answer node is generated.
OR more simply
2) The number of levels in the subtree with root x that need
to be generated to get an answer node.
Using cost measure 2,
 In the above fig. the cost of the root is 4 ( node 30 is four
levels from node 1) .
 The difficulty with cost functions is that computing the
cost of the node usually involves a search of the subtree
x for an answer node.
 Hence , by the time the cost of a node is determined ,
that subtree has been searched and there is no need to
explore x again. For this reason , search algorithms
usually rank nodes only on the basis of an estimated
cost g( . ) .
^
 Let g(x) be an estimate of the additional cost needed to
reach an answer node from x.
 Then , node x is assigned a rank using a function c(.) such
that
c(.) = h(x) + g(x)
where
h(x) is the cost of reaching x from the root
^
^
^ ^
Actual cost function c(.) is defined as follows:
if x is an answer node , then c(x) is the cost of reaching
x from the root .
if x is not an answer node , then c(x)=∞, it means that
subtree with root x contains no answer node.
otherwise c(x) equal to the cost of a minimum cost
node in the subtree with root x.
 c(.) is an approximation to c(.)
^
 A FIFO or LIFO search always generates the state space tree by
levels.
 What we need is more “intelligent” search method .
 We can associate a cost c(x) with each node x in the state space
tree.
 The cost c(x) is the length of a path from the root to a nearest goal
node( if any ) in the subtree with root x.
Thus in the above fig c(1)=c(4)=c(10)=c(23)=3.
 When such a cost function is available, a very efficient search can
be carried out.
 In this search strategy , the only nodes to become E-nodes are
nodes on the path from the root to a nearest goal node.
 Unfortunately, this is an impractical.
We can only compute estimate c(x) of c(x). we can write
c(x)=f(x) +g(x), where f(x) is the length of the path from
the root to node x and g(x) is an estimate of the length
of a shortest path from x to a goal node in the subtree
with root x.
one possible choice for g( x ) is
g( x ) = number of nonblank tiles not in their goal
position.
^
^ ^
^
^
^
Control Abstraction of LC-Search:-
Algorithm LCSearch( t )
// search tree t for answer node
{
if *t is an answer node then output *t and return;
E=t // E-node
repeat
{
for each child x of E do
{
if x is an answer node then output the path
from x to t and return;
Add( x ); // x is a new live node
( x ->parent )=E // pointer for path to root
}
if there are no more live nodes then
{
write(“ No answer node “);
return;
}
E=Least();
} until ( false )
}
• ( x ->parent )=E is to print answer path.
Bounding:-
 The bounding functions are used to avoid the generation of sub
trees that do not contain the answer nodes. In bounding upper and
lower bounds are generated at each node.
 A cost function c(.) such that c (x)<=c(x) is used to provide the lower
bounds on solutions obtainable from any node x.
 If upper is an upper bound on the cost of a minimum cost solution,
then all live nodes x with c (x) >upper can be killed.
 upper is updated whenever a child is generated.
^
^
^
Job sequencing with deadlines
• The objective of this problem is to select a subset j of n
jobs such that all jobs in j can be completed by their
deadlines and the penalty incurred is minimum among all
possible subsets j. such a j is optimal.
Ex:- let n=4
Job index pi di ti
1 5 1 1
2 10 3 2
3 6 2 1
4 3 1 1
The solution space for this instance consists of all possible subsets of
the job index set (1,2,3,4 ).
This space can be organized into a tree in two ways .
1. Using fixed size tuple formulation.
2.Using variable size tuple formulation.
1
2
3 4
5
6 7
12 14
13
8
9 10
15
11
X1=1 X1=2 X1=3
X1=4
X2=2
X2=3
X2=4
X3=3 X3=4 X3=4
X2=3 X2=4 X2=4
X3=4
C =0
^
C =0
C =0
C =10
C =5 C =15 C =21
C =15
C =11
C =5
^
^
^
^
^
^
^
^
^
U =19
U =24
U =14
U =18
U =21
U =9
U =13
U =8
U =11
U =15
C =8
 The above fig corresponds to the variable tuple size
formulation.
 Square nodes represent infeasible subsets.
 All nonsquare nodes are answer nodes.
 Node 9 represents an optimal solution and is the only
minimum-cost answer node. For this node j=(2,3) and
the penalty ( cost ) is 8.
A cost function c() for the above solution space can be
defined as
• For any circular node x, c(x) is the minimum penalty
corresponding to any node in the subtree with root x.
• The value of c(x)=∞ for a square node.
In the above fig c(3)=8 , c(2)=9 , and c(1)=8 etc.
Clearly c(1) is the penalty corresponding to an optimal
selection j.
4 5 6 7
2 3
1
9 10 11 12 13 14 15
19 21 22 23 25 26 27 28 29 30 31
24
0
24
0
24
0
X1=1 X1=0
X2=1 X2=0 X2=0
X2=1
X3=1
X3=1 X3=1 X3=1 X3=0
X3=0
X3=0
X4=0
X4=1
X3=0
Job sequencing with deadlines
Fixed size tuple formulation
FIFO Branch and Bound
Refer page no.391
LIFO Branch and Bound
Do it yourself.
LC Branch and Bound
Refer page no.392
0/1 Knapsack Problem
 Generally Branch and Bound will minimize the objective
function.
 The 0/1 knapsack problem is a maximization problem.
 This difficulty can be avoided by replacing the objective
function ∑ pixi by - ∑ pixi .
Note:
1. All live nodes with c(x) > upper can be
killed when they are about to become
E-nodes .
^
^
1
2 3
7
8 9
4
6
5
-38
-32
-38
-32
-38
-32
-38
-32 -38
-38
-38
-38
-20
-20
-32
-22
-22
-36
Upper number = c
Lower number = u
^
LC Branch and Bound Solution
k
Answer node
EX:- n=4, ( p1,p2,p3,p4 )= (10,10,12,18 )
( w1,w2,w3,w4 ) = ( 2,4,6,9 ), m=15
Process: The calculation of U and C is as
follows.
U(1) - Scan through the objects from left to
right and put into the knapsack until
the first object that does not fit is
encontered.
C(1) – Similar to U(1) except that it also
considers a fraction of the first object
that does not fit the knapsack.
Continue this process until an answer node is
found.
^
^
FIFO Branch and Bound
1
2
3
9
12 13
4
8
5
-38
-32
-38
-32
-38
-32
-38
-32 -38
-38
-38
-38
-20
-20
-32
-27
-22
-36
6 7
10 11
-32
-27
k
-28
-28
Upper number = c
Lower number = u
^
Answer node
Home Work :-
1. Draw the portion of the state space tree generated by
LCBB and FIFIBB for the following knapsack problem.
a) n=5, ( p1,p2,p3,p4,p5 ) = ( 10,15,6,8,4 ),
( w1,w2,w3,w4,w5 )= ( 4,6,3,4,2 ) and m=12
b) n=5, ( p1,p2,p3,p4,p5 )= ( w1,w2,w3,w4,w5 )=
( 4,4,5,8,9 ) and m=15.

More Related Content

Similar to designanalysisalgorithm_unit-v-part2.pptx

MTH 2001 Project 2Instructions• Each group must choos.docx
MTH 2001 Project 2Instructions• Each group must choos.docxMTH 2001 Project 2Instructions• Each group must choos.docx
MTH 2001 Project 2Instructions• Each group must choos.docxgilpinleeanna
 
lecture01_lecture01_lecture0001_ceva.pdf
lecture01_lecture01_lecture0001_ceva.pdflecture01_lecture01_lecture0001_ceva.pdf
lecture01_lecture01_lecture0001_ceva.pdfAnaNeacsu5
 
15 puzzle problem using branch and bound
15 puzzle problem using branch and bound15 puzzle problem using branch and bound
15 puzzle problem using branch and boundAbhishek Singh
 
The world of loss function
The world of loss functionThe world of loss function
The world of loss function홍배 김
 
super vector machines algorithms using deep
super vector machines algorithms using deepsuper vector machines algorithms using deep
super vector machines algorithms using deepKNaveenKumarECE
 
AOT2 Single Variable Optimization Algorithms.pdf
AOT2 Single Variable Optimization Algorithms.pdfAOT2 Single Variable Optimization Algorithms.pdf
AOT2 Single Variable Optimization Algorithms.pdfSandipBarik8
 
CLIQUE Automatic subspace clustering of high dimensional data for data mining...
CLIQUE Automatic subspace clustering of high dimensional data for data mining...CLIQUE Automatic subspace clustering of high dimensional data for data mining...
CLIQUE Automatic subspace clustering of high dimensional data for data mining...Raed Aldahdooh
 
Hardware Acceleration for Machine Learning
Hardware Acceleration for Machine LearningHardware Acceleration for Machine Learning
Hardware Acceleration for Machine LearningCastLabKAIST
 
Anomaly detection using deep one class classifier
Anomaly detection using deep one class classifierAnomaly detection using deep one class classifier
Anomaly detection using deep one class classifier홍배 김
 
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWERUndecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWERmuthukrishnavinayaga
 
This quiz is open book and open notes/tutorialoutlet
This quiz is open book and open notes/tutorialoutletThis quiz is open book and open notes/tutorialoutlet
This quiz is open book and open notes/tutorialoutletBeardmore
 
Module 3 polynomial functions
Module 3   polynomial functionsModule 3   polynomial functions
Module 3 polynomial functionsdionesioable
 

Similar to designanalysisalgorithm_unit-v-part2.pptx (20)

MTH 2001 Project 2Instructions• Each group must choos.docx
MTH 2001 Project 2Instructions• Each group must choos.docxMTH 2001 Project 2Instructions• Each group must choos.docx
MTH 2001 Project 2Instructions• Each group must choos.docx
 
Mit6 094 iap10_lec03
Mit6 094 iap10_lec03Mit6 094 iap10_lec03
Mit6 094 iap10_lec03
 
lecture01_lecture01_lecture0001_ceva.pdf
lecture01_lecture01_lecture0001_ceva.pdflecture01_lecture01_lecture0001_ceva.pdf
lecture01_lecture01_lecture0001_ceva.pdf
 
15 puzzle problem using branch and bound
15 puzzle problem using branch and bound15 puzzle problem using branch and bound
15 puzzle problem using branch and bound
 
03 optimization
03 optimization03 optimization
03 optimization
 
The world of loss function
The world of loss functionThe world of loss function
The world of loss function
 
backtracking 8 Queen.pptx
backtracking 8 Queen.pptxbacktracking 8 Queen.pptx
backtracking 8 Queen.pptx
 
super vector machines algorithms using deep
super vector machines algorithms using deepsuper vector machines algorithms using deep
super vector machines algorithms using deep
 
AOT2 Single Variable Optimization Algorithms.pdf
AOT2 Single Variable Optimization Algorithms.pdfAOT2 Single Variable Optimization Algorithms.pdf
AOT2 Single Variable Optimization Algorithms.pdf
 
AppsDiff3c.pdf
AppsDiff3c.pdfAppsDiff3c.pdf
AppsDiff3c.pdf
 
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
 
CLIQUE Automatic subspace clustering of high dimensional data for data mining...
CLIQUE Automatic subspace clustering of high dimensional data for data mining...CLIQUE Automatic subspace clustering of high dimensional data for data mining...
CLIQUE Automatic subspace clustering of high dimensional data for data mining...
 
Unit 2
Unit 2Unit 2
Unit 2
 
Hardware Acceleration for Machine Learning
Hardware Acceleration for Machine LearningHardware Acceleration for Machine Learning
Hardware Acceleration for Machine Learning
 
Anomaly detection using deep one class classifier
Anomaly detection using deep one class classifierAnomaly detection using deep one class classifier
Anomaly detection using deep one class classifier
 
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWERUndecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
 
This quiz is open book and open notes/tutorialoutlet
This quiz is open book and open notes/tutorialoutletThis quiz is open book and open notes/tutorialoutlet
This quiz is open book and open notes/tutorialoutlet
 
Unit 2
Unit 2Unit 2
Unit 2
 
Greedy Algorithms with examples' b-18298
Greedy Algorithms with examples'  b-18298Greedy Algorithms with examples'  b-18298
Greedy Algorithms with examples' b-18298
 
Module 3 polynomial functions
Module 3   polynomial functionsModule 3   polynomial functions
Module 3 polynomial functions
 

Recently uploaded

How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 

Recently uploaded (20)

How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 

designanalysisalgorithm_unit-v-part2.pptx

  • 1. Branch and Bound ( unit-vii )  Backtracking is effective for subset or permutation problems.  Backtracking is not good for optimization problems.  This drawback is rectified by using Branch And Bound technique.  Branch And Bound is applicable for only optimization problems.  Branch and Bound also uses bounding function similar to backtracking.
  • 2. Problem state :- Each node in the tree is a problem state. State Space :- All paths from the root to problem states define the state space of the problem. Terminology of tree organization
  • 3. Solution States :- These are those problem states S for which the path from the root to S define a tuple in the solution space. Solution Space :- All paths from the root to solution states define the solution space of the problem.
  • 4. 1 34 18 50 2 8 13 19 3 5 7 12 10 15 17 23 21 26 28 33 31 37 39 44 42 47 9 55 53 58 60 65 63 4 6 11 9 14 16 22 20 25 27 32 30 36 38 43 41 46 48 54 52 57 59 64 62 29 35 40 24 51 56 61 45 X1=1 X1=2 X1=3 X1=4 2 3 4 1 3 4 1 2 4 1 2 3 3 4 2 4 2 3 3 4 1 4 1 3 2 4 1 4 1 2 2 3 1 3 1 2 4 3 4 2 3 2 4 3 4 1 3 1 4 2 4 1 2 1 3 2 3 1 2 1 x2= x3= x4= Tree organization of the 4-queens solution space. Nodes are numbered as in depth first search. Ex :-
  • 5. – A node which has been generated and all of whose children have not yet been generated is called a live node. – The live node whose children are currently being generated is called E-node ( Expanding node ). – A dead node is a generated node which can not to be expanded further or all of whose children have been generated.
  • 6. Branch And Bound Nodes will be expanded in three ways. • FIFO branch and bound-- queue • LIFO branch and bound-- stack • Least-Cost (or max priority) branch and bound)—priority queue.
  • 7. • Least-cost branch and bound directs the search to the parts which most likely to contain the answer.
  • 8. Ex:- 4 – Queens Problem FIFO Branch And Bound Algorithm
  • 9. 18 19 20 21 22 23 24 25 26 27 28 29 6 7 8 9 10 11 12 13 14 15 16 17 2 3 4 5 1 30 Answer node Portion of 4 – queens state space tree generated by FIFO branch and bound 2 3 4 1 3 4 1 2 4 1 2 3 x1=1 2 3 4
  • 10.  In this case backtracking method is superior than branch and bound method.
  • 11. Least Cost ( LC) search :- • In both FIFO and LIFO branch and bound the selection rule for the next E-node does not give any preference to a node that has a very good chance of getting an answer node quickly. • In the above example when node 22 is generated, it should have become obvious that this node will lead to an answer node in one move. • However , the FIFO rule first requires the expansion of all live nodes generated before node 22 was expanded.
  • 12. • The search for an answer node can be speeded by using an “intelligent “ ranking function c (.) for live nodes. • The next E-node is selected on the basis of this ranking function. • If we use ranking function that assigns node 22 a better rank than all other live nodes , then node 22 will become the E-node following node 29. ^
  • 13. • The ideal way to assign ranks will be on the basis of the additional effort ( cost) needed to reach an answer node from the live node. For any node x, this could be 1) The number of nodes in the subtree with root x that need to be generated before an answer node is generated. OR more simply 2) The number of levels in the subtree with root x that need to be generated to get an answer node. Using cost measure 2,  In the above fig. the cost of the root is 4 ( node 30 is four levels from node 1) .
  • 14.  The difficulty with cost functions is that computing the cost of the node usually involves a search of the subtree x for an answer node.  Hence , by the time the cost of a node is determined , that subtree has been searched and there is no need to explore x again. For this reason , search algorithms usually rank nodes only on the basis of an estimated cost g( . ) . ^
  • 15.  Let g(x) be an estimate of the additional cost needed to reach an answer node from x.  Then , node x is assigned a rank using a function c(.) such that c(.) = h(x) + g(x) where h(x) is the cost of reaching x from the root ^ ^ ^ ^
  • 16. Actual cost function c(.) is defined as follows: if x is an answer node , then c(x) is the cost of reaching x from the root . if x is not an answer node , then c(x)=∞, it means that subtree with root x contains no answer node. otherwise c(x) equal to the cost of a minimum cost node in the subtree with root x.  c(.) is an approximation to c(.) ^
  • 17.  A FIFO or LIFO search always generates the state space tree by levels.  What we need is more “intelligent” search method .  We can associate a cost c(x) with each node x in the state space tree.  The cost c(x) is the length of a path from the root to a nearest goal node( if any ) in the subtree with root x. Thus in the above fig c(1)=c(4)=c(10)=c(23)=3.  When such a cost function is available, a very efficient search can be carried out.  In this search strategy , the only nodes to become E-nodes are nodes on the path from the root to a nearest goal node.
  • 18.  Unfortunately, this is an impractical. We can only compute estimate c(x) of c(x). we can write c(x)=f(x) +g(x), where f(x) is the length of the path from the root to node x and g(x) is an estimate of the length of a shortest path from x to a goal node in the subtree with root x. one possible choice for g( x ) is g( x ) = number of nonblank tiles not in their goal position. ^ ^ ^ ^ ^ ^
  • 19. Control Abstraction of LC-Search:- Algorithm LCSearch( t ) // search tree t for answer node { if *t is an answer node then output *t and return; E=t // E-node repeat { for each child x of E do { if x is an answer node then output the path from x to t and return; Add( x ); // x is a new live node ( x ->parent )=E // pointer for path to root }
  • 20. if there are no more live nodes then { write(“ No answer node “); return; } E=Least(); } until ( false ) } • ( x ->parent )=E is to print answer path.
  • 21. Bounding:-  The bounding functions are used to avoid the generation of sub trees that do not contain the answer nodes. In bounding upper and lower bounds are generated at each node.  A cost function c(.) such that c (x)<=c(x) is used to provide the lower bounds on solutions obtainable from any node x.  If upper is an upper bound on the cost of a minimum cost solution, then all live nodes x with c (x) >upper can be killed.  upper is updated whenever a child is generated. ^ ^ ^
  • 22. Job sequencing with deadlines • The objective of this problem is to select a subset j of n jobs such that all jobs in j can be completed by their deadlines and the penalty incurred is minimum among all possible subsets j. such a j is optimal.
  • 23. Ex:- let n=4 Job index pi di ti 1 5 1 1 2 10 3 2 3 6 2 1 4 3 1 1 The solution space for this instance consists of all possible subsets of the job index set (1,2,3,4 ). This space can be organized into a tree in two ways . 1. Using fixed size tuple formulation. 2.Using variable size tuple formulation.
  • 24. 1 2 3 4 5 6 7 12 14 13 8 9 10 15 11 X1=1 X1=2 X1=3 X1=4 X2=2 X2=3 X2=4 X3=3 X3=4 X3=4 X2=3 X2=4 X2=4 X3=4 C =0 ^ C =0 C =0 C =10 C =5 C =15 C =21 C =15 C =11 C =5 ^ ^ ^ ^ ^ ^ ^ ^ ^ U =19 U =24 U =14 U =18 U =21 U =9 U =13 U =8 U =11 U =15 C =8
  • 25.  The above fig corresponds to the variable tuple size formulation.  Square nodes represent infeasible subsets.  All nonsquare nodes are answer nodes.  Node 9 represents an optimal solution and is the only minimum-cost answer node. For this node j=(2,3) and the penalty ( cost ) is 8.
  • 26. A cost function c() for the above solution space can be defined as • For any circular node x, c(x) is the minimum penalty corresponding to any node in the subtree with root x. • The value of c(x)=∞ for a square node. In the above fig c(3)=8 , c(2)=9 , and c(1)=8 etc. Clearly c(1) is the penalty corresponding to an optimal selection j.
  • 27. 4 5 6 7 2 3 1 9 10 11 12 13 14 15 19 21 22 23 25 26 27 28 29 30 31 24 0 24 0 24 0 X1=1 X1=0 X2=1 X2=0 X2=0 X2=1 X3=1 X3=1 X3=1 X3=1 X3=0 X3=0 X3=0 X4=0 X4=1 X3=0 Job sequencing with deadlines Fixed size tuple formulation
  • 28. FIFO Branch and Bound Refer page no.391
  • 29. LIFO Branch and Bound Do it yourself.
  • 30. LC Branch and Bound Refer page no.392
  • 31. 0/1 Knapsack Problem  Generally Branch and Bound will minimize the objective function.  The 0/1 knapsack problem is a maximization problem.  This difficulty can be avoided by replacing the objective function ∑ pixi by - ∑ pixi .
  • 32. Note: 1. All live nodes with c(x) > upper can be killed when they are about to become E-nodes . ^ ^
  • 33. 1 2 3 7 8 9 4 6 5 -38 -32 -38 -32 -38 -32 -38 -32 -38 -38 -38 -38 -20 -20 -32 -22 -22 -36 Upper number = c Lower number = u ^ LC Branch and Bound Solution k Answer node EX:- n=4, ( p1,p2,p3,p4 )= (10,10,12,18 ) ( w1,w2,w3,w4 ) = ( 2,4,6,9 ), m=15 Process: The calculation of U and C is as follows. U(1) - Scan through the objects from left to right and put into the knapsack until the first object that does not fit is encontered. C(1) – Similar to U(1) except that it also considers a fraction of the first object that does not fit the knapsack. Continue this process until an answer node is found. ^ ^
  • 34. FIFO Branch and Bound 1 2 3 9 12 13 4 8 5 -38 -32 -38 -32 -38 -32 -38 -32 -38 -38 -38 -38 -20 -20 -32 -27 -22 -36 6 7 10 11 -32 -27 k -28 -28 Upper number = c Lower number = u ^ Answer node
  • 35. Home Work :- 1. Draw the portion of the state space tree generated by LCBB and FIFIBB for the following knapsack problem. a) n=5, ( p1,p2,p3,p4,p5 ) = ( 10,15,6,8,4 ), ( w1,w2,w3,w4,w5 )= ( 4,6,3,4,2 ) and m=12 b) n=5, ( p1,p2,p3,p4,p5 )= ( w1,w2,w3,w4,w5 )= ( 4,4,5,8,9 ) and m=15.