-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Finish Ln18-DP-ZeroOneKnapsack & Ln19-DP-ContextFreeGrammar #25
Conversation
src/Ln18-DP-ZeroOneKnapsack.tex
Outdated
\section{基本思路} | ||
|
||
\subsection{贪心法} | ||
事实证明贪心法无法得到0-1背包问题的最优解。给出物体列表以及属性如下表所示: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这句话放后面吧。。事实还没列出来呢
src/Ln18-DP-ZeroOneKnapsack.tex
Outdated
\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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
。。。参考的背包九讲吧23333。。。原文这个地方写的是错的而且一直没改,容积减价值W_i的和是个什么优化?这里应当减重量C_i的和。(参考原项目的一个PR)
这一句是python代码,建议修改一下格式,不要用公式块吧。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
嗯,这里确实有问题,我去改一下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
其他的暂时没看出啥问题,在参考文献里面加一条背包九讲吧。
Add Ln18 DP-ZeroOneKnapsack Notes