what is difference between backtracking and branch and bound method

6
What is Difference between backtracking and branch and bound method? Backtracking [1] It is used to find all possible solutions available to the problem. [2] It traverse tree by DFS(Depth First Search). [3] It realizes that it has made a bad choice & undoes the last choice by backing up. [4] It search the state space tree until it found a solution. [5] It involves feasibility function. Branch-and-Bound (BB) [1] It is used to solve optimization problem. [2] It may traverse the tree in any manner, DFS or BFS. [3] It realizes that it already has a better optimal solution that the pre-solution leads to so it abandons that pre-solution. [4] It completely searches the state space tree to get optimal solution. [5] It involves bounding function. The difference between branch-&-bound and backtracking is used for optimization problem does not limit us to a particular way of traversing the tree We compute a number at a node to determine whether the node is promising. If that bound is no better than the value of the best solution found so far, the node is nonpromising. breadth-first search (queue) Algorithm in page 224 Figure 6.1 best-first search (priority queue)we can compare the bounds of promising nodes and visit the children of the one with the best bound. best-first search with branch-&-bound pruning breadth-first search with branch-&-bound pruning

Upload: mahi-on-d-rockzz

Post on 01-Nov-2014

51 views

Category:

Documents


0 download

DESCRIPTION

DAA

TRANSCRIPT

Page 1: What is Difference Between Backtracking and Branch and Bound Method

What is Difference between backtracking and branch and bound method?Backtracking

[1] It is used to find all possible solutions available to the problem.[2] It traverse tree by DFS(Depth First Search).[3] It realizes that it has made a bad choice & undoes the last choice by backing up.[4] It search the state space tree until it found a solution.[5] It involves feasibility function.   Branch-and-Bound (BB)

[1] It is used to solve optimization problem.[2] It may traverse the tree in any manner, DFS or BFS.[3] It realizes that it already has a better optimal solution that the pre-solution leads to so it abandons that pre-solution.[4] It completely searches the state space tree to get optimal solution.[5] It involves bounding function.

The difference between branch-&-bound and backtracking is used for optimization problem does not limit us to a particular way of traversing the tree

We compute a number at a node to determine whether the node is promising. If that bound is no better than the value of the best solution found so far, the node is nonpromising.

breadth-first search (queue)Algorithm in page 224

Figure 6.1

best-first search (priority queue):we can compare the bounds of promising nodes and visit the children of the one with the best bound.

best-first search with branch-&-bound pruning breadth-first search with branch-&-bound pruningNIT 4 : Backtracking and Branch and BoundBacktracking – N Queen’s problem – Hamiltonian circuit problem – Subset sum problem – Branch and Bound – Assignment problem – Knapsack problem – Traveling salesman problem.

Two marks:1. What are the state space algorithms?Backtracking and Branch-and-bound are called state-space algorithms as they generate state-space tree while solving the problem.

2. What are the differences between exhaustive search method and state-space algorithms?State-space algorithms make it possible to solve some larger instances of difficult combinatorial problems. Unlike exhaustive search, state-space algorithms generate candidate solutions one component at a time and evaluate the partially constructed solutions. If no potential values of the remaining components can lead to a solution, the remaining components are not generated at all.

3. What are the differences between backtracking and branch-and-bound methods?

Page 2: What is Difference Between Backtracking and Branch and Bound Method

(i) Branch-and-Bound algorithms can be applied only to optimization problems.Backtracking is more often not applied to non-optimization.(ii) Branch-and-bound generates nodes by Best-first rule.Backtracking generates tree by depth-first rule.

4. Define Backtracking.Backtracking is the technique that constructs one component at a time, and evaluate such partially constructed candidates as:¨ If a partially constructed solution can be developed further without violating the problem’s constraints, taking the first remaining legitimate option for the next component does it.¨ If there is no legitimate option for the next component, no alternatives for any remaining component need to be considered. In this case, the algorithm backtracks to replace the last component of the partially constructed solution with its next option.

5. What is a state-space tree?The tree construted to implement backtracking with the choices for the components is called the state-space tree. Its root represents initial state before the search for a solution and the nodes at each level represent the choices made for the corresponding component of a solution.

6. What is promising and non-promising node?A node in state-space tree is said to be promising, if it corresponds to a partially constructed solution that may still lead to complete solution. Otherwise, that node is non-promising.

7. What is N-Queen’s problem? Give any one solution to 6-Queen’s problem.N-Queen’s problem is to place n-queens on an n x n chessboard, such that no two queens attack each other by being in the same row or in the same column or on the same diagonal.One of the solutions to 6-Queen’s problem isQ Q QQ Q Q

8. What is a Hamiltonian circuit?A Hamiltonian circuit in a graph is the path that starts and ends at the same vertex and passes through all the other vertices exactly once.

9. What is a subset sum problem? Find the subset from the set S={1,2,3,4}, for the sum d=7 using backtracking.A subset sum problem finds a subset of a given set S={s1,s2,..sn}of n positive integers, whose sum is equal to a given positive integer d.Draw the backtracking tree to find the subset.Result: {1,2,4}, {3,4}.

10. Write the general algorithm for backtracking.Algorithm Backtrack(X[1..i])//Gives a template of a generic backtracking algorithm.//Input : X[1..i] specifies first I promising components of a solution.//Output : All the tuples representing the problems solutions.If X[1..i] is a solution write X[1..i]

Page 3: What is Difference Between Backtracking and Branch and Bound Method

elsefor each element x ε Si+1 consistent with X[1..i] and the constraints doX[i+1] ß xBacktrack (X[1..i+1])

11. Explain Branch-and-bound method.The branch-and-bound method uses the state-space tree. The state-space tree provides the nodes which are bound on the best value of the objective function on any solution, that can be obtained by adding further components to the partial solution represented by the node. It considers the lower bound for minimization problem and the upper bound for maximization problem. The non-promising nodes will be terminated if no solution obtained from it can yield better solution than the one already available. The result is the value of the best solution obtained so far.

12. What is a feasible solution and optimal solution?A feasible solution is a point in the problem’s state-space that satisfies all the problem’s constraints. An optimal solution is a feasible solution, with the best value of the objective function.

13. What are the reasons for terminating search path at current node in the state-space tree?· The value of the nodes bound is not better than the value of the best solution seen so far.· The node represents no feasible solutions, because the constraints of the problem are already violated.· The subset of feasible solutions represented by the node consists of a single point – here we compare the value of the objective function for this feasible solution with that of the best solution seen so far and update the latter with the former, if the new solution is better.14. What is Assignment problem?The Assignment problem assign n people to n jobs, so that the total cost of the assignment is as small as possible. That is, there are n people who need to be assigned to execute n jobs, one person per job. The cost of assigning ith person to jth job is C[i,j]. Find the assignment with the smallest total cost.

15. What is Knapsack problem? How it could be solved by branch-and-bound problems?There are n items of known weights w1,w2..wn and the values are v1,v2..vn. The capacity of Knapsack is W. Find the most valuable subset of items, that fit into knapsack.· To solve branch-and-bound problem, the steps are:· Order the items given in descending order, by their value-to-weight ratios.· Construct the state-space tree as binary tree. Each node on ith level indicate inclusion of item to the set, if the node is left child, otherwise exclusion of the item.

16. What is travelling salesman problem? How it could be solved using branch-and-bound technique?The travelling salesman problem is to find the shortest tour through a given set of n cities that visits each city exactly once before returning to the city where it started. Travelling salesman problem as it finds the shortest tour, it computes the lower bound. To compute lower bound, Find the sum Si of the distances from city i to the nearest cities.Compute sum S of these n numbers. Divide S by 2 to find lower bound. Set a constraint such that any city should be visited before another. This reduces more work in generating all-pairs of permutations.

16 Marks:1. State the difference between branch and bound and backtracking. And write about minimization and maximization problems. (6).Hints : Refer Question two marks 3 – Minimization problem – Maximization problem – Steps for Branch and bound – Steps for Backtracking.

Page 4: What is Difference Between Backtracking and Branch and Bound Method

2. Write any two solutions for 8- Queen’s problem and Write the steps for solving it using backtracking.Hints: Problem description of n-queen’s problem – Write about backtracking – General algorithm of backtracking -Draw state space tree of 8-Queen’s problem till any two solutions is found – Explain the steps done to find the solution.

3. Find the Hamiltonian circuit for the graph corresponding to the following adjacency matrix and explain about the steps in detail.A B C D E FA 0 1 0 0 1 0B 1 0 1 0 1 0C 0 1 0 1 1 1D 0 0 1 0 1 0E 1 1 1 1 0 1F 0 0 1 0 1 0Hints : Explain Hamiltonian circuit – Draw the Graph from the adjacency matrix- Write about backtracking- General algorithm of backtracking -Draw backtracking tree – Explain the steps – Write the conclusion.

4. For the given subset S= { 1, 3, 7, 9, 13}, find the subsets, whose sum will be equivalent to d= 13.Hints : Problem description for subset-sum problem – Write about backtracking – General algorithm of backtracking - Draw the subset sum tree using backtracking – Explain the steps – Conclusion.

5. For the following cost matrix, assign job to 4 persons.

Job1 Job2 Job3 Job4 7 3 2 6 Person15 2 6 8 Person2 2 5 1 4 Person34 6 2 3 Person4Hints : Problem description for Job assignment problem – Write about branch and bound problem – Explain the steps for solving minimization problem – Draw state-space tree – Conclusion.

6. If there is a Knapsack of capacity W= 6 and the weights and values of the items are mentioned as below, solve the knapsack problem, with branch and bound technique.Item no Weight Value1 4 $402 3 $123 1 $154 2 $40