Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Branch and bound technique
1. 1 Mehta Ishani
2nd
M.E.(C.S.E)
Solving traveling salesman and water jug
problem using Branch and Bound Technique
Introduction
Branch and bound is a systematic method for solving optimization problems that
applies where the greedy method and dynamic programming fail.
Branch-and-bound is an approach developed for solving discrete and
combinatorial optimization problems.
Problem
The discrete optimization problems are problems in which the decision variables
assume discrete values from a specified set.
The combinatorial optimization problems, on the other hand, are problems of
choosing the best combination out of all possible combinations.
The major difficulty with these problems is that we do not have any optimality
conditions to check if a given (feasible) solution is optimal or not. In order to guarantee
a given feasible solution's optimality is "to compare" it with every other feasible solution.
To do this explicitly, amounts to total enumeration of all possible alternatives
which is computationally prohibitive due to the NP-Completeness. Therefore, this
comparison must be done implicitly, resulting in partial enumeration of all possible
alternatives.
Solution
Branch and bound methods solve a discrete optimization problem by breaking up
its feasible set into successively smaller subsets, calculating bounds on the objective
function value over each subset, and using them to discard certain subsets from further
consideration.
The procedure ends when each subset has either produced a feasible solution,
or was shown to contain no better solution than the one already in hand. The best
solution found during the procedure is a global optimum.
The general idea of B&B is a BFS-like search for the optimal solution, but not all
nodes get expanded (i.e., their children generated). Rather, a carefully selected criterion
determines which node to expand and when, and another criterion tells the algorithm
when an optimal solution has been found.
The method was first proposed by A. H. Land and A. G. Doig in 1960 for
discrete programming
2. 2 Mehta Ishani
2nd
M.E.(C.S.E)
Steps for branch and bound algorithm
1. 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.
Water Jug
Now let us see how the branch - and -bound search could be used to find the
shortest solution to the water- jug problem. Unfortunately although this algorithm is
more efficient and simple. It requires exponential time. The exact amount of time it
saves for particular problem depends on the order in which the paths are explored. And
also in this problem, there is a possibility that the algorithm enters into an indefinite loop.
For example, consider the following configuration generated in the process of
generating a path.
Initial state (0,0)
Goal state (2,0)
Path 1:
(0,0) -> (4,0) -> (1,3) -> (1,0) -> (0,1) -> (4,1) -> (2,3) -> (2,0)
Since goal node is reached so put in queue
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
P1
3. 3 Mehta Ishani
2nd
M.E.(C.S.E)
Path 3:
(0,0) -> (0,3) -> (3,3) -> (4,2) -> (0,2) -> (2,0)
Goal node is reached then put in queue
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
The Traveling Salesman Problem
The traveling salesman problem consists of a salesman and a set of cities. The
salesman has to visit each one of the cities starting from a certain one (e.g. the
hometown) and returning same city. The challenge of the problem is that the traveling
salesman wants to minimize the total length of the trip.
Why the Traveling Salesman Problem?
NP-hard
Brute Force takes O(n!) to complete
Algorithms to solve take one of two forms:
o Exact algorithms
Branch and Bound O(2n)
Linear Programming
o Heuristic algorithms
Nearest neighbor O( log n )
Pair wise exchange
Randomized improvement (genetic algorithms)
Many real world applications:
Special properties of the Traveling Salesman Problem that make it suitable for
Branch and Bound:
o As you build your solution, cost increases.
o Partial solutions have valid costs (lower bound costs)
P1 P3
P3 P1
4. 4 Mehta Ishani
2nd
M.E.(C.S.E)
Solution steps
o Given a complete, weighted graph on n nodes, find the least weight Hamiltonian
cycle, a cycle that visits every node once.
o Though this problem is easy enough to explain, it is very difficult to solve.
o Finding all the Hamiltonian cycles of a graph takes exponential time. Therefore,
TSP is in the class NP.
For example the path
Path1 {A, B, C, D, E, A} - length 24
Path2 {A, B, C, E, D, A} - length 31
Path 3 {A,B,D,C,E,A} - length 21
Hence our queue is
After sorting queue is
Hence Optimal Solution is Path 3
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.
Summery
Thus Branch and Bound is:
o a general search method.
o minimize a function f(x), where x is restricted to some feasible region.
P1 P2 P3
P3 P1 P2