当前位置:网站首页>0 8 动态规划(Dynamic Programming)
0 8 动态规划(Dynamic Programming)
2022-07-29 06:45:00 【51CTO】
动态规划,简称DP
是求解最优化问题的一种常用策略
通常的使用套路(一步一步优化)
① 暴力递归(自顶向下,出现了重叠子问题)
② 记忆化搜索(自顶向下)
③ 递推(自底向上)
动态规划的常规步骤
动态规划中的“动态”可以理解为是“会变化的状态”
① 定义状态(状态是原问题、子问题的解)
* 比如定义 dp(i) 的含义
② 设置初始状态(边界)
* 比如设置 dp(0) 的值
③ 确定状态转移方程
* 比如确定 dp(i) 和 dp(i – 1) 的关系
动态规划的一些相关概念
来自维基百科的解释
Dynamic Programming is a method for solving a complex problem by breaking it down into a collection of simpler subproblems, solving each of those subproblems just once, and storing their solutions.
① 将复杂的原问题拆解成若干个简单的子问题
② 每个子问题仅仅解决1次,并保存它们的解
③ 最后推导出原问题的解
可以用动态规划来解决的问题,通常具备2个特点
最优子结构(最优化原理):通过求解子问题的最优解,可以获得原问题的最优解
无后效性
* 某阶段的状态一旦确定,则此后过程的演变不再受此前各状态及决策的影响(未来与过去无关)
* 在推导后面阶段的状态时,只关心前面阶段的具体状态值,不关心这个状态是怎么一步步推导出来的
详细应用查看数据结构学习资料pdf
边栏推荐
- Flink实时仓库-DWD层(流量域)模板代码
- CAN&CANFD综合测试分析软件LKMaster与PCAN-Explorer 6分析软件的优势对比
- buck电路boot和ph引脚实测
- 怎么会不喜欢呢,CICD中轻松发送邮件
- SSH password free login - two virtual machines establish password free channel two-way trust
- 使用VsCode配置MySQL实现连接、查询、等功能
- WPF简单登录页面的完成案例
- DM data guard cluster setup
- VMware16创建虚拟机:Win11无法安装
- 330. 按要求补齐数组
猜你喜欢
随机推荐
JS chicken laying eggs and egg laying chickens. Who appeared earlier, object or function? Is function an instance of function?
LeetCode 879. 盈利计划
win11系统错误:由于找不到 iertutil.dll,无法继续执行代码。重新安装程序可能会解决此问题
Cesium反射
Is online legend software testing training really so black hearted? Are they all scams?
Flink real-time warehouse DWD layer (order placing multiple tables to realize join operation) template code
Problems encountered in vmware16 installing virtual machines
如何使用gs_expansion扩展节点
自定义事件
Variables and encryption in ansible
Vmware16 create virtual machine: win11 cannot be installed
约瑟夫环问题
After three years of outsourcing, the salary of automatic testing after job hopping is twice that of the original. The secret is
MutationObserver文档学习
实现改变一段文字的部分颜色效果
最新百亿量化私募名单
Student achievement ranking system based on C language design
Comparison of advantages between can & canfd integrated test analysis software lkmaster and PCA Explorer 6 analysis software
Tp6 use protobuf
Redis Basics









