Solving traveling salesman and water jug problem using Branch and
Bound Technique
Prepared By
Mehta Ishani
04/08/20232
IntroductionBranch and Bound method for solving optimization problems
approach developed for solving discrete and combinatorial optimization problems
04/08/20233
Problem domaindiscrete optimization problems
(decision variables assume discrete values)
combinatorial optimization problems(choosing the best combination)
04/08/20234
DifficultyNo optimality conditions
To ensure optimality perform comparison
Explicit comparison results in NP Completeness
Implicit comparison results partial enumeratoin
04/08/20235
SolutionBranch and Bound technique breaking up its feasible set into successively
smaller subsets calculating bounds on the objective function
value discard certain subsets
The method was first proposed by A. H. Land and A. G. Doig in 1960 for discrete programming
04/08/20236
Steps1)Place the start node of zero path length on the queue.2)Until the queue is empty or a goal node has been
found do the following: (i) Determine if the s first path in the queue contains a good node. (ii) If the first path contains a goal node exit with success.(iii) If the first path does not contain a good node remove the path from the queue and form new paths by extending the removed paths by on step.(iv)Compute the cost of the new paths and add them to the queue.(v) Sort the paths on the queue with lowest-cost path in front.
3)otherwise exit with failure.
04/08/20237
Water JugInitial state (0,0)Goal state (2,0)
Path p1:(0,0) -> (4,0) -> (1,3) -> (1,0) -> (0,1) -> (4,1) -
> (2,3) -> (2,0)
P1
04/08/20238
Water Jug Path 2: (0,0) -> (0,3) -> (3,3)->(3,0)->(4,0)->(0,0) Since this results infinite loop then not to put in
queue
Path 3: (0,0) -> (0,3) -> (3,3) -> (4,2) -> (0,2) -> (2,0)
P1
P3 P1
04/08/20239
Water Jug Now path 1 contains 8 states and path 2
contains 6 states after performing sorting the queue is
Thus our optimal solution is Path 3
P1 P3
04/08/202310
Traveling Salesman Problem
04/08/202311
Problem NP-hard Brute Force takes O(n!) to complete Algorithms to solve take one of two forms:
Exact algorithms Branch and Bound O(2n) Linear Programming
Heuristic algorithms Nearest neighbor O( log n ) Pair wise exchange Randomized improvement (genetic algorithms)
Many real world applications:
04/08/202312
Solution Special properties of the Traveling Salesman
Problem that make it suitable for Branch and Bound: As you build your solution, cost increases. Partial solutions have valid costs (lower bound
costs)
04/08/202313
Steps Given a complete, weighted graph on n nodes,
find the least weight Hamiltonian cycle, a cycle that visits every node once.
Though this problem is easy enough to explain, it is very difficult to solve.
Finding all the Hamiltonian cycles of a graph takes exponential time. Therefore, TSP is in the class NP.
04/08/202314
Solution
Path1 {A, B, C, D, E, A} - length 24
P1
04/08/202315
Solution
Path2 {A, B, C, E, D, A} - length 31
P2 P1
04/08/202316
Solution
Path 3 {A,B,D,C,E,A} - length 21
P3 P2 P1
04/08/202317
Solution After perform sorting queue is
Hence Optimal Solution is Path 3
P2 P1 P3
04/08/202318
Pros and Cons An enhancement of backtracking However, it is much slower. Indeed, it often
leads to exponential time complexities in the worst case.
On the other hand, if applied carefully, it can lead to algorithms that run reasonably fast on average.
04/08/202319
Summery Thus Branch and Bound is:
a general search method. minimize a function f(x), where x is restricted to
some feasible region.
04/08/202320
THANK YOU