TSP Using Branchandbound
TSP Using Branchandbound
• TSP can be stated as follows, consider that there are n cities and
travelling salesman has to visit each city exactly once and has to
return to the city from where he has started.
• Finding shortest hamiltonian circuit of a graph.
• Computing lower bounds using the formula.
• LB=∑ (sum of costs of the two least cost edges
vε V adjacent to v) / 2
a b c d e
LB = [(1+ 3) + (3 + 6) + (1+ 2) + (3 + 4) + (2 + 3)]/2
= 28/2=14.(this is the root of the state space tree)
• Compute the distances at level 1 a-b,a-c,a-d,a-e.
• Compute the distances at level 2 a-b-c,a-b-d,
a-b-e.
• Compute the distances at level 3 a-b-c-d,a-b-c-e
and a-b-d-c,a-b-d-e.
• Thus the state space tree can be
LB = [(1+ 3) + (3 + 6) + (1+ 2) + (3 + 4) + (2 + 3)]/2
= 28/2=14.(this is the root of the state space tree)
Node 1:consider distance a-b in computation of the
corresponding vertices along with 1 minimum
distance. Find 2 least cost edges adjacent to V/2.
a=a-b + a-c=3+1=4 (consider a-b here)
b=a-b+b-c=3+6=9 (consider a-b here)
c=a-c+c-e=1+2=3 LB=4+9+3+7+5=28/2=14
d=d-e+c-d=3+4=7
e=c-e+d-e=2+3=5
Node 2:consider distance a-c in computation of the
corresponding vertices along with 1 minimum
distance. Find 2 least cost edges adjacent to V/2.
a=a-b + a-c=3+1=4 (consider a-c here)
b=a-b+b-c=3+6=9
c=a-c+c-e=1+2=3 (consider a-c here)
d=d-e+c-d=3+4=7
e=c-e+d-e=2+3=5
LB=4+9+3+7+5=28/2=14
Node 3:consider distance a-d in computation of the
corresponding vertices along with 1 minimum
distance. Find 2 least cost edges adjacent to V/2.
a=a-c + a-d=1+5=6 (consider a-d here)
b=a-b+b-c=3+6=9
c=a-c+c-e=1+2=3
d=d-e+a-d=3+5=8 (consider a-d here)
e=c-e+d-e=2+3=5
LB=6+9+3+8+5=31/2=15.5=16
Node 4:consider distance a-e in computation of
the corresponding vertices along with 1
minimum distance. Find 2 least cost edges
adjacent to V/2.
a=a-c + a-e=1+8=9 (consider a-e here)
b=a-b+b-c=3+6=9
c=a-c+c-e=1+2=3
d=c-d+d-e=4+3=7
e=c-e+a-e=2+8=10 (consider a-e here)
LB=9+9+3+7+10=38/2=19
Node 5:consider distance a-b-c .including edges
(a-b),(b-c) wherever possible. Find 2 least cost
edges adjacent to V/2.
a=a-b + a-c=3+1=4 (consider a-b here)
b=a-b+b-c=3+6=9
c=a-c+b-c=1+6=7 (consider b-c here)
d=d-c+d-e=4+3=7
e=c-e+d-e=2+3=5
LB=4+9+7+7+5=32/2=16
Same as node 6 (a-b-d),node 7 (a-b-e)
Node 8:consider distance a-b-c-d (e,a).including
edges (a-b),(b-c) ,(c-d) (e,a)wherever possible. Find
2 least cost edges adjacent to V/2.
a=a-b + a-e=3+8=11 (consider a-b & e,ahere)
b=a-b+b-c=3+6=9 (consider a-b,b-c here)
c=b-c+c-d=6+4=10 (consider b-c,c-d here)
d=c-d+d-e=4+3=7 (consider c-d here)
e=a-e+d-e=8+3=11(consider a-e here)
LB=11+9+10+7+11=48/2=24
• Same as node 9 a-b-c-e(d,a)
• Same as node 10 a-b-d-c (e,a)
Node 11:consider distance a-b-d-e (c,a).including edges
(a-b),(b-d) ,(d-e) (c,a)wherever possible. Find 2 least
cost edges adjacent to V/2.
a=a-b + a-c=3+1=4 (consider a-b & e,ahere)
b=a-b+b-d=3+7=10 (consider a-b,b-c here)
c=a-c+c-e=1+2=3 (consider b-c,c-d here)
d=b-d+d-e=7+3=10 (consider c-d here)
e=c-e+d-e=2+3=5(consider a-e here)
LB=4+10+3+10+5=32/2=16
• At node 11 we get optimum tour .
• Hence the optimal tour of TSP is a-b-d-e-c-a with
cost 16.
Approximation Algorithm for NP-Hard Problems
• If an NP hard pblm can be solved in polynomial time then all
NP-complete pblms can also be solved in polynomial time.
• All NP-complete pblms are NP-hard but all NP-hard pblms cannot be
NP-complete.
• A pblm is NP-complete if it belongs to NP-class and also every pblm
in NP can also be solved in polynomial time.
• The Np class pblms are the decision pblms that can be solved by
non-deterministic polynomial algorithms.
• non-deterministic-no particular rule is defined.
• Approximation Algorithm for TSP