-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Source: Knapsack
Target: ClosestVectorProblem
Motivation: Embeds the Knapsack problem into a lattice structure, enabling solving via lattice reduction algorithms (LLL, BKZ). This is a classical reduction used in cryptanalysis of knapsack-based cryptosystems (Merkle–Hellman).
Reference: Lagarias & Odlyzko, "Solving Low-Density Subset Sum Problems", JACM 32(1), 1985
Reduction Algorithm
Notation:
- Source:
$n$ items with weights$w_0, \ldots, w_{n-1}$ , values$v_0, \ldots, v_{n-1}$ , capacity$C$ - Target: CVP with lattice basis
$B \in \mathbb{Z}^{(n+2) \times n}$ and target vector$\mathbf{t} \in \mathbb{Q}^{n+2}$
Lattice basis construction:
- Rows
$0$ to$n-1$ : identity matrix$I_n$ (enforces binary structure via target$\tfrac{1}{2}$ ) - Row
$n$ : weight vector$\mathbf{w}$ - Row
$n+1$ : value vector$\mathbf{v}$
Target vector:
where
CVP problem: Find
Why it works:
- The identity block produces residuals
$(x_i - \tfrac{1}{2})^2$ , which equal$\tfrac{1}{4}$ when$x_i \in {0, 1}$ and are larger otherwise — this encourages binary solutions. - Row
$n$ produces residual$(\sum w_i x_i - C)^2 = 0$ when the capacity constraint is tight. - Row
$n+1$ produces residual$(\sum v_i x_i - V^*)^2 = 0$ when the value is optimal.
Solution extraction: The CVP solution
Size Overhead
| Target metric (code name) | Polynomial (using symbols above) |
|---|---|
lattice_dimension |
|
num_basis_vectors |
Validation Method
Closed-loop testing: solve Knapsack by brute-force (
Example
Source instance:
| Item | Weight | Value |
|---|---|---|
| 0 | 2 | 3 |
| 1 | 3 | 4 |
| 2 | 4 | 5 |
| 3 | 5 | 7 |
Brute-force optimal: select items
CVP formulation:
Basis
| col 0 | col 1 | col 2 | col 3 | |
|---|---|---|---|---|
| row 0 | 1 | 0 | 0 | 0 |
| row 1 | 0 | 1 | 0 | 0 |
| row 2 | 0 | 0 | 1 | 0 |
| row 3 | 0 | 0 | 0 | 1 |
| row 4 | 2 | 3 | 4 | 5 |
| row 5 | 3 | 4 | 5 | 7 |
Target:
Verification (all 16 binary vectors):
| Weight | Value | Feasible? | ||
|---|---|---|---|---|
| 7 | 10 | 1.00 | yes | |
| 7 | 9 | 2.00 | yes | |
| 5 | 7 | 14.00 | yes | |
| 9 | 12 | 9.00 | no | |
| 2 | 3 | 75.00 | yes |
The optimal