Skip to content
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

Merged
merged 5 commits into from
Dec 18, 2020

Conversation

Huqingnan123
Copy link
Contributor

Add Ln18 DP-ZeroOneKnapsack Notes

@colinaaa colinaaa requested a review from L-LYR December 18, 2020 09:46
@colinaaa colinaaa added the new chapter 新章节 label Dec 18, 2020
@colinaaa colinaaa changed the title Ln18-DP-ZeroOneKnapsack WIP: Ln18-DP-ZeroOneKnapsack Dec 18, 2020
@Huqingnan123 Huqingnan123 changed the title WIP: Ln18-DP-ZeroOneKnapsack Ln18-DP-ZeroOneKnapsack Dec 18, 2020
\section{基本思路}

\subsection{贪心法}
事实证明贪心法无法得到0-1背包问题的最优解。给出物体列表以及属性如下表所示:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这句话放后面吧。。事实还没列出来呢

\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)
Copy link
Collaborator

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代码,建议修改一下格式,不要用公式块吧。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

嗯,这里确实有问题,我去改一下

Copy link
Collaborator

@L-LYR L-LYR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其他的暂时没看出啥问题,在参考文献里面加一条背包九讲吧。

@Huqingnan123 Huqingnan123 changed the title Ln18-DP-ZeroOneKnapsack Finish Ln18-DP-ZeroOneKnapsack & Ln19-DP-ContextFreeGrammar Dec 18, 2020
@colinaaa colinaaa merged commit 29f6e0c into colinaaa:master Dec 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new chapter 新章节
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants