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

📅  最后修改于: 2021-09-15 01:45:23             🧑  作者: 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.

如果您希望与专家一起参加现场课程,请参阅DSA 现场工作专业课程学生竞争性编程现场课程。