Skip to content

Commit efecea8

Browse files
authored
Merge pull request #1387 from virinci/patch-1
Fix the remainder group size in binary grouping solution of the multiple knapsack problem
2 parents 820fc4a + e92615f commit efecea8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/dynamic_programming/knapsack.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ Let $A_{i, j}$ denote the $j^{th}$ item split from the $i^{th}$ item. In the tri
116116

117117
The grouping is made more efficient by using binary grouping.
118118

119-
Specifically, $A_{i, j}$ holds $2^j$ individual items ($j\in[0,\lfloor \log_2(k_i+1)\rfloor-1]$).If $k_i + 1$ is not an integer power of $2$, another bundle of size $k_i-2^{\lfloor \log_2(k_i+1)\rfloor-1}$ is used to make up for it.
119+
Specifically, $A_{i, j}$ holds $2^j$ individual items ($j\in[0,\lfloor \log_2(k_i+1)\rfloor-1]$).If $k_i + 1$ is not an integer power of $2$, another bundle of size $k_i-(2^{\lfloor \log_2(k_i+1)\rfloor}-1)$ is used to make up for it.
120120

121121
Through the above splitting method, it is possible to obtain any sum of $\leq k_i$ items by selecting a few $A_{i, j}$'s. After splitting each item in the described way, it is sufficient to use 0-1 knapsack method to solve the new formulation of the problem.
122122

0 commit comments

Comments
 (0)