📜  回溯和Branch-N-Bound技术之间的区别

📅  最后修改于: 2021-04-23 22:27:40             🧑  作者: Mango

算法是为解决复杂问题而定义的有条不紊的步骤序列。

在本文中,我们将看到两种这样的算法之间的区别,即回溯和分支定界技术。

在深入探讨差异之前,让我们首先了解这些算法中的每一种。

回溯:回溯是一种通用算法,用于查找某些计算问题(尤其是约束满足问题)的所有解决方案,该算法会逐步为解决方案构建可能的候选对象,并在确定无法完成候选对象以最终成为候选对象时立即放弃该候选对象。有效的解决方案。它是一种算法技术,它通过尝试逐步构建一个解决方案来递归地解决问题,一次删除一个解决方案,以消除在任何时间点都无法满足问题约束的那些解决方案(此处称为时间)达到搜索树的任何级别所花费的时间)。

分支和边界:分支和边界是一种针对离散和组合优化问题以及数学优化的算法设计范例。分支定界算法由候选解的系统枚举组成。即,候选解决方案的集合被认为是形成了以整个集合为根的一棵有根的树。该算法探索该树的分支,这些分支代表解决方案集的子集。在枚举分支的候选解之前,先根据最佳解上的估计上限和下限检查分支,如果该分支无法产生比该算法到目前为止找到的最佳解更好的解,则将其丢弃。

下表说明了两种算法之间的区别:

Parameter Backtracking Branch and Bound
Approach Backtracking is used to find all possible solutions available to a problem. When it realises that it has made a bad choice, it undoes the last choice by backing it up. It searches the state space tree until it has found a solution for the problem.  Branch-and-Bound is used to solve optimisation problems. When it realises that it already has a better optimal solution that the pre-solution leads to, it abandons that pre-solution. It completely searches the state space tree to get optimal solution.
Traversal Backtracking traverses the state space tree by DFS(Depth First Search) manner. Branch-and-Bound traverse the tree in any manner, DFS or BFS.
Function Backtracking involves feasibility function. Branch-and-Bound involves a bounding function.
Problems Backtracking is used for solving Decision Problem. Branch-and-Bound is used for solving Optimisation Problem.
Searching In backtracking, the state space tree is searched until the solution is obtained. In Branch-and-Bound as the optimum solution may be present any where in the state space tree, so the tree need to be searched completely.
Efficiency Backtracking is more efficient. Branch-and-Bound is less efficient.
Applications Useful in solving N-Queen Problem, Sum of subset. Useful in solving Knapsack Problem, Travelling Salesman Problem.