Skip to content

[Rule] ClosestVectorProblem to QUBO #91

@GiggleLiu

Description

@GiggleLiu

Source: ClosestVectorProblem<i32> (integer basis variant, #90)
Target: QUBO
Motivation: Enables solving CVP on quantum annealers and Ising machines via QUBO formulation.
Reference: Canale, Qureshi & Viola, "Qubo model for the Closest Vector Problem", arXiv:2304.03616 (2023)

Reduction Algorithm

Notation:

  • Source instance: integer basis A ∈ Z^{m×n} with columns a₁, ..., aₙ, target vector t ∈ R^m
  • Per-variable bounds: x_i ∈ [lo_i, hi_i] (from CVP's VarBounds)
  • G = AᵀA (Gram matrix), h = Aᵀt
  • Target instance: QUBO matrix Q ∈ R^{N×N}, where N = total binary variables

Variable mapping:

  1. For each integer coefficient x_i with bounds [lo_i, hi_i], let R_i = hi_i - lo_i (range).
  2. Binary-encode each x_i as x_i = lo_i + Σⱼ 2ʲ b_{i,j} using L_i = ⌈log₂(R_i + 1)⌉ binary variables.
  3. Total binary variables: N = Σᵢ L_i.
  4. When 2^{L_i} > R_i + 1, some binary assignments map to out-of-range values; a penalty term with weight M (larger than the maximum objective range) is added to Q for those assignments.

Note: The paper derives a theoretical bound K_i ≤ 2^{⌈n(log₂ n + log₂ b)⌉} (where b = max|A_{ij}|, Proposition 2.4) for the unbounded case. This implementation uses the tighter explicit VarBounds stored on the CVP instance.

Objective transformation:
The CVP objective ‖Ax - t‖₂² expands as:

Ax - t‖₂² = xᵀGx - 2hx + tt

Substituting x_i = lo_i + Σⱼ 2ʲ b_{i,j} into the quadratic form xᵀGx - 2hx and using b² = b for binary variables, we obtain a quadratic function in the N binary variables. The off-diagonal Q entries are scaled Gram matrix entries: Q_{(i,j),(k,l)} = 2^{j+l} · G_{ik} for distinct variable pairs; diagonal entries absorb linear terms from the lower-bound offsets and the h vector. The constant tt is dropped (does not affect the optimal binary assignment).

Solution extraction:
Given optimal binary vector b*, reconstruct x_i = lo_i + Σⱼ 2ʲ b*_{i,j} for each i.

Size Overhead

Target metric (code name) Expression
num_vars Σᵢ ⌈log₂(R_i + 1)⌉, where R_i = hi_i - lo_i per variable

Validation Method

  • Compare source/target optimal values on small instances using brute-force CVP solver and brute-force QUBO solver
  • Cross-check with the canonical example below

Example

Use the canonical 2D CVP instance from the codebase:

Source CVP:

  • A = [[2, 0], [1, 2]] (columns: a₁=(2,0), a₂=(1,2))
  • t = (2.8, 1.5)
  • Bounds: x₁ ∈ [-2, 4], x₂ ∈ [-2, 4]

Intermediate values:

  • G = AᵀA = [[4, 2], [2, 5]]
  • h = Aᵀt = (5.6, 5.8)
  • L₁ = L₂ = ⌈log₂(7)⌉ = 3 bits each → N = 6 binary variables
  • Encoding: x₁ = -2 + b₀ + 2b₁ + 4b₂, x₂ = -2 + b₃ + 2b₄ + 4b₅

Target QUBO (6×6 upper-triangular Q):

b₀ b₁ b₂ b₃ b₄ b₅
b₀ −31.2 16 32 4 8 16
b₁ −54.4 64 8 16 32
b₂ −76.8 16 32 64
b₃ −34.6 20 40
b₄ −59.2 80
b₅ −78.4

Verification:

  • Optimal CVP solution: x = (1, 1), distance = √0.29 ≈ 0.539
  • Binary encoding: b = (1, 1, 0, 1, 1, 0) (offset 3 = 011₂ for each variable)
  • QUBO value: bᵀQb = −107.4
  • Reconstruction: −107.4 + 97.6 (substitution constant) + 10.09 (‖t‖²) = 0.29 = ‖Axt‖₂² ✓

Metadata

Metadata

Assignees

No one assigned

    Labels

    GoodAn issue passed all checks.ruleA new reduction rule to be added.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions