<s>
Branch	B-Algorithm
and	I-Algorithm
bound	I-Algorithm
(	O
BB	O
,	O
B&B	O
,	O
or	O
BnB	O
)	O
is	O
a	O
method	O
for	O
solving	O
optimization	O
problems	O
by	O
breaking	O
them	O
down	O
into	O
smaller	O
sub-problems	O
and	O
using	O
a	O
bounding	O
function	O
to	O
eliminate	O
sub-problems	O
that	O
cannot	O
contain	O
the	O
optimal	O
solution	O
.	O
</s>
<s>
It	O
is	O
an	O
algorithm	O
design	B-Algorithm
paradigm	I-Algorithm
for	O
discrete	O
and	O
combinatorial	O
optimization	O
problems	O
,	O
as	O
well	O
as	O
mathematical	O
optimization	O
.	O
</s>
<s>
A	O
branch-and-bound	B-Algorithm
algorithm	I-Algorithm
consists	O
of	O
a	O
systematic	O
enumeration	O
of	O
candidate	O
solutions	O
by	O
means	O
of	O
state	B-Algorithm
space	I-Algorithm
search	I-Algorithm
:	O
the	O
set	O
of	O
candidate	O
solutions	O
is	O
thought	O
of	O
as	O
forming	O
a	O
rooted	O
tree	B-Data_Structure
with	O
the	O
full	O
set	O
at	O
the	O
root	O
.	O
</s>
<s>
The	O
algorithm	O
explores	O
branches	O
of	O
this	O
tree	B-Data_Structure
,	O
which	O
represent	O
subsets	O
of	O
the	O
solution	O
set	O
.	O
</s>
<s>
If	O
no	O
bounds	O
are	O
available	O
,	O
the	O
algorithm	O
degenerates	O
to	O
an	O
exhaustive	B-Algorithm
search	I-Algorithm
.	O
</s>
<s>
The	O
name	O
"	O
branch	B-Algorithm
and	I-Algorithm
bound	I-Algorithm
"	O
first	O
occurred	O
in	O
the	O
work	O
of	O
Little	O
et	O
al	O
.	O
</s>
<s>
on	O
the	O
traveling	B-Algorithm
salesman	I-Algorithm
problem	I-Algorithm
.	O
</s>
<s>
The	O
goal	O
of	O
a	O
branch-and-bound	B-Algorithm
algorithm	I-Algorithm
is	O
to	O
find	O
a	O
value	O
that	O
maximizes	O
or	O
minimizes	O
the	O
value	O
of	O
a	O
real-valued	O
function	O
,	O
called	O
an	O
objective	O
function	O
,	O
among	O
some	O
set	O
of	O
admissible	O
,	O
or	O
candidate	O
solutions	O
.	O
</s>
<s>
Branching	O
alone	O
would	O
amount	O
to	O
brute-force	B-Algorithm
enumeration	O
of	O
candidate	O
solutions	O
and	O
testing	O
them	O
all	O
.	O
</s>
<s>
To	O
improve	O
on	O
the	O
performance	O
of	O
brute-force	B-Algorithm
search	I-Algorithm
,	O
a	O
B&B	O
algorithm	O
keeps	O
track	O
of	O
bounds	O
on	O
the	O
minimum	O
that	O
it	O
is	O
trying	O
to	O
find	O
,	O
and	O
uses	O
these	O
bounds	O
to	O
"	O
prune	B-Algorithm
"	O
the	O
search	O
space	O
,	O
eliminating	O
candidate	O
solutions	O
that	O
it	O
can	O
prove	O
will	O
not	O
contain	O
an	O
optimal	O
solution	O
.	O
</s>
<s>
Turning	O
these	O
principles	O
into	O
a	O
concrete	O
algorithm	O
for	O
a	O
specific	O
optimization	O
problem	O
requires	O
some	O
kind	O
of	O
data	B-General_Concept
structure	I-General_Concept
that	O
represents	O
sets	O
of	O
candidate	O
solutions	O
.	O
</s>
<s>
(	O
Typically	O
,	O
the	O
subsets	O
are	O
disjoint	B-Algorithm
to	O
prevent	O
the	O
algorithm	O
from	O
visiting	O
the	O
same	O
candidate	O
solution	O
twice	O
,	O
but	O
this	O
is	O
not	O
required	O
.	O
</s>
<s>
Using	O
these	O
operations	O
,	O
a	O
B&B	O
algorithm	O
performs	O
a	O
top-down	O
recursive	O
search	O
through	O
the	O
tree	B-Data_Structure
of	O
instances	O
formed	O
by	O
the	O
branch	O
operation	O
.	O
</s>
<s>
This	O
pruning	B-Algorithm
step	O
is	O
usually	O
implemented	O
by	O
maintaining	O
a	O
global	O
variable	O
that	O
records	O
the	O
minimum	O
upper	O
bound	O
seen	O
among	O
all	O
instances	O
examined	O
so	O
far	O
.	O
</s>
<s>
The	O
following	O
is	O
the	O
skeleton	O
of	O
a	O
generic	O
branch	B-Algorithm
and	I-Algorithm
bound	I-Algorithm
algorithm	I-Algorithm
for	O
minimizing	O
an	O
arbitrary	O
objective	O
function	O
.	O
</s>
<s>
To	O
obtain	O
an	O
actual	O
algorithm	O
from	O
this	O
,	O
one	O
requires	O
a	O
bounding	O
function	O
,	O
that	O
computes	O
lower	O
bounds	O
of	O
on	O
nodes	O
of	O
the	O
search	B-Data_Structure
tree	I-Data_Structure
,	O
as	O
well	O
as	O
a	O
problem-specific	O
branching	O
rule	O
.	O
</s>
<s>
As	O
such	O
,	O
the	O
generic	O
algorithm	O
presented	O
here	O
is	O
a	O
higher-order	B-Language
function	I-Language
.	O
</s>
<s>
Using	O
a	O
heuristic	B-Algorithm
,	O
find	O
a	O
solution	O
to	O
the	O
optimization	O
problem	O
.	O
</s>
<s>
(	O
If	O
no	O
heuristic	B-Algorithm
is	O
available	O
,	O
set	O
to	O
infinity	O
.	O
)	O
</s>
<s>
Initialize	O
a	O
queue	B-Application
to	O
hold	O
a	O
partial	O
solution	O
with	O
none	O
of	O
the	O
variables	O
of	O
the	O
problem	O
assigned	O
.	O
</s>
<s>
Loop	O
until	O
the	O
queue	B-Application
is	O
empty	O
:	O
</s>
<s>
Take	O
a	O
node	O
off	O
the	O
queue	B-Application
.	O
</s>
<s>
Else	O
,	O
store	O
on	O
the	O
queue	B-Application
.	O
</s>
<s>
Several	O
different	O
queue	B-Application
data	B-General_Concept
structures	I-General_Concept
can	O
be	O
used	O
.	O
</s>
<s>
This	O
FIFO	O
queue-based	O
implementation	O
yields	O
a	O
breadth-first	B-Algorithm
search	I-Algorithm
.	O
</s>
<s>
A	O
stack	B-Application
(	O
LIFO	B-Application
queue	I-Application
)	O
will	O
yield	O
a	O
depth-first	B-Algorithm
algorithm	O
.	O
</s>
<s>
A	O
best-first	B-Algorithm
branch	B-Algorithm
and	I-Algorithm
bound	I-Algorithm
algorithm	I-Algorithm
can	O
be	O
obtained	O
by	O
using	O
a	O
priority	B-Application
queue	I-Application
that	O
sorts	O
nodes	O
on	O
their	O
lower	O
bound	O
.	O
</s>
<s>
Examples	O
of	O
best-first	B-Algorithm
search	I-Algorithm
algorithms	O
with	O
this	O
premise	O
are	O
Dijkstra	B-Algorithm
's	I-Algorithm
algorithm	I-Algorithm
and	O
its	O
descendant	O
A*	B-Protocol
search	I-Protocol
.	O
</s>
<s>
The	O
depth-first	B-Algorithm
variant	O
is	O
recommended	O
when	O
no	O
good	O
heuristic	B-Algorithm
is	O
available	O
for	O
producing	O
an	O
initial	O
solution	O
,	O
because	O
it	O
quickly	O
produces	O
full	O
solutions	O
,	O
and	O
therefore	O
upper	O
bounds	O
.	O
</s>
<s>
A	O
C++	B-Language
-like	O
pseudocode	O
implementation	O
of	O
the	O
above	O
is	O
:	O
</s>
<s>
The	O
functions	O
(	O
objective_function	O
)	O
and	O
(	O
lower_bound_function	O
)	O
are	O
treated	O
as	O
function	B-Language
objects	I-Language
as	O
written	O
,	O
and	O
could	O
correspond	O
to	O
lambda	B-General_Concept
expressions	I-General_Concept
,	O
function	B-Language
pointers	I-Language
and	O
other	O
types	O
of	O
callable	O
objects	O
in	O
the	O
C++	B-Language
programming	I-Language
language	I-Language
.	O
</s>
<s>
When	O
is	O
a	O
vector	O
of	O
,	O
branch	B-Algorithm
and	I-Algorithm
bound	I-Algorithm
algorithms	I-Algorithm
can	O
be	O
combined	O
with	O
interval	B-Algorithm
analysis	I-Algorithm
and	O
contractor	B-Algorithm
techniques	O
in	O
order	O
to	O
provide	O
guaranteed	O
enclosures	O
of	O
the	O
global	O
minimum	O
.	O
</s>
<s>
Branch-and-bound	B-Algorithm
may	O
also	O
be	O
a	O
base	O
of	O
various	O
heuristics	B-Algorithm
.	O
</s>
<s>
present	O
a	O
generalization	O
of	O
branch	B-Algorithm
and	I-Algorithm
bound	I-Algorithm
that	O
also	O
subsumes	O
the	O
A*	B-Protocol
,	O
B*	B-Protocol
and	O
alpha-beta	B-Algorithm
search	I-Algorithm
algorithms	O
.	O
</s>
<s>
The	O
first	O
step	O
is	O
to	O
relax	O
the	O
integer	B-Algorithm
constraint	I-Algorithm
.	O
</s>
<s>
We	O
choose	O
the	O
variable	O
with	O
the	O
maximum	O
fractional	O
part	O
,	O
in	O
this	O
case	O
becomes	O
the	O
parameter	O
for	O
the	O
branch	B-Algorithm
and	I-Algorithm
bound	I-Algorithm
method	O
.	O
</s>
