algorithm's People
algorithm's Issues
Dynamics Programming --- Overview
Dyanmics Programming
1、适用的范围:
最优化问题
2、基本概念:
一个问题分解为多个阶段来解决,每个阶段有多种决策,每个决策会带来收益,每个阶段的收益只 取决于当前状态和决策;
3、特点:
子问题有大量的重叠,一般应对此种问题需要的方案是打表避免重复,但是这个解决方案是通过空间换时间的方式来解决问题。
4、一般解题步骤:
1> 确定状态和收益
2> 初始状态和终止状态
3> 确定决策集合
4> 是否无后效性
5> 收益如何表示
主要问题:如何把问题转化成状态转移方程,也就是如何描述收益,从一个阶段到另一个阶段。
实例一:LIS(Longest Increasing Subsequence)
问题:给定一个数列,求它的最长单增的子序列。如,给定10,4,20,10,15,13则{4,10,15}和{4,10,13}都是解
解题步骤:
- 确定状态和收益:f(i)表示以第i项结尾的最长单增子序列的长度;
- 初始状态:f(0) = 0
终止状态:max{f(1), f(2), f(3) ... f(i)}; - 确定决策集合:已知全部决策f(x), x < i, 如果ai > ax,则显然可以把ai连接在ax的后面;
- 无后效性: f(i)只与决策x相关;
- 收益表示:由定义f(i) = max{f(x)| x < i且ai>ax} + 1, 如果该集合是空集,则对应max值为0。
LCS: Longest Common Subsequence
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.