And so you could construct all subsets, check that the weight is less than the weight of the knapsack, and then choose the subset with the maximum value.
因此你可以构建所有子问题,判断它的重量,是否小于背包的重量,然后选择值最大的子问题。
And now we want to find the subset of a that has the maximum value, subject to the weight constraint.
会有一个值与其对应,现在我们想要找出满足,重量约束条件的a的最大值子集。
So here's where we have 30 elements, 40 and a maximum weight of 40.
所以这里我们有30个元素,最大重量是。
So how would we go about solving this problem if I told you not only was there a maximum weight, but there was a maximum volume. Well, we want to go back and attack it exactly the way we attacked it the first time, which was write some mathematical formulas.
有些时候两个都重要,所以如果我告诉你这里不仅有,最大重量还有最大容量,我们应该怎么解决这个问题呢?,好了,我们想回过来然后,和第一次一样看看这个问题。
应用推荐