我只知道通过分支和绑定,可以减少程序以获得解决方案,但这只会对有解决方案空间树的问题有所帮助....
答案 0 :(得分:4)
动态编程(通常称为DP)是解决特定类问题的一种非常强大的技术。它要求非常优雅的方法和简单的思维,编码部分非常容易。
这个想法非常简单,如果你已经解决了给定输入的问题,那么保存结果以备将来参考,以避免再次解决同样的问题。不久'记住你的过去' 。
如果给定的问题可以分解为较小的子问题,并且这些较小的子问题又被分成仍然较小的子问题,并且在这个过程中,如果你观察到一些过度使用的子问题强>,那么它对DP来说是一个很大的暗示。此外,子问题的最优解决方案有助于给定问题的最优解(称为最优子结构属性)。
1.) Top-Down : Start solving the given problem by breaking it down. If you see that the problem has been solved already, then just return the saved answer. If it has not been solved, solve it and save the answer. This is usually easy to think of and very intuitive. This is referred to as Memoization.
2.) Bottom-Up : Analyze the problem and see the order in which the sub-problems are solved and start solving from the trivial subproblem, up towards the given problem. In this process, it is guaranteed that the subproblems are solved before solving the problem. This is referred to as Dynamic Programming.
http://www.cs.umsl.edu/~sanjiv/classes/cs5130/lectures/bb.pdf
答案 1 :(得分:0)
动态编程需要递归结构(例如,CRLS中的最佳子结构)。也就是说,在给定状态下,可以基于部分解来表征最优决策。
分支和绑定是更通用的,用于通过解空间的隐式枚举来解决更多难题。