Finish Ln18-DP-ZeroOneKnapsack & Ln19-DP-ContextFreeGrammar#25
Merged
colinaaa merged 5 commits intocolinaaa:masterfrom Dec 18, 2020
Merged
Finish Ln18-DP-ZeroOneKnapsack & Ln19-DP-ContextFreeGrammar#25colinaaa merged 5 commits intocolinaaa:masterfrom
colinaaa merged 5 commits intocolinaaa:masterfrom
Conversation
L-LYR
reviewed
Dec 18, 2020
| \section{基本思路} | ||
|
|
||
| \subsection{贪心法} | ||
| 事实证明贪心法无法得到0-1背包问题的最优解。给出物体列表以及属性如下表所示: |
L-LYR
reviewed
Dec 18, 2020
| \subsection{一个常数优化} | ||
| \textbf{上面空间优化之后伪代码中的第二重循环的下限$C_i$也可以可以改进}。它可以被优化为$max(V-\sum_{i}^{N}W_i,C_i)$,所以二层循环就可以变成 | ||
| $$ | ||
| for \ \ v \ \ in \ \ range(V,max(V-\sum_{i}^{N}W_i,C_i),-1) |
Collaborator
There was a problem hiding this comment.
。。。参考的背包九讲吧23333。。。原文这个地方写的是错的而且一直没改,容积减价值W_i的和是个什么优化?这里应当减重量C_i的和。(参考原项目的一个PR)
这一句是python代码,建议修改一下格式,不要用公式块吧。
Contributor
Author
There was a problem hiding this comment.
嗯,这里确实有问题,我去改一下
L-LYR
requested changes
Dec 18, 2020
L-LYR
approved these changes
Dec 18, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Ln18 DP-ZeroOneKnapsack Notes