-
Notifications
You must be signed in to change notification settings - Fork 3
[Model] MinimumMatrixCover #931
Description
Motivation
MATRIX COVER (MS13) from Garey & Johnson, A1.2. Given an n×n matrix A of nonneg integers, find a sign assignment f: {1,...,n} → {-1,+1} that minimizes the quadratic form Σ a_ij f(i)f(j). NP-complete in the strong sense, even for positive definite A (Garey and Johnson). The problem is connected to MAX CUT: the adjacency matrix of a graph gives a Matrix Cover instance where minimizing the quadratic form corresponds to maximizing cut edges. Applications in combinatorial optimization, spin glass models, and graph partitioning.
Definition
Name: MinimumMatrixCover
Reference: Garey & Johnson, Computers and Intractability, A1.2 MS13
Mathematical definition:
INSTANCE: n×n matrix A = [a_ij] of nonneg integers.
OBJECTIVE: Find a function f: {1,...,n} → {-1,+1} that minimizes Σ_{1≤i,j≤n} a_ij · f(i) · f(j).
Variables
- Count: n (one per row/column index)
- Per-variable domain: {0, 1} (mapped to {-1,+1} via f(i) = 2x_i - 1)
- Meaning: The sign assignment for each index. The objective is to minimize the quadratic form over these ±1 variables.
Schema (data type)
Type name: MinimumMatrixCover
Variants: none (unique input structure)
| Field | Type | Description |
|---|---|---|
matrix |
Vec<Vec<i64>> |
n×n matrix A of nonneg integers |
Complexity
- Best known exact algorithm: O*(2^num_rows) by enumerating all 2^n sign assignments. NP-complete in the strong sense (Garey and Johnson; transformation from MAXIMUM CUT).
- Complexity string:
"2^num_rows"
Extra Remark
Full book text:
INSTANCE: n×n matrix A = [a_ij] of nonneg integers, positive integer K.
QUESTION: Does there exist a function f: {1,...,n} → {-1,+1} such that Σ_{1≤i,j≤n} a_ij · f(i) · f(j) ≤ K?
Reference: Transformation from MAXIMUM CUT.
Comment: NP-complete in the strong sense, even for positive definite A.
Note: The original G&J formulation is a decision problem with threshold K (upper bound). We use the equivalent optimization formulation: minimize the quadratic form. Note that for nonneg matrices, maximizing the form is trivial (f = all +1 gives Σ a_ij), but minimizing it is NP-hard — the challenge is finding sign assignments that produce enough negative cross-terms.
How to solve
- It can be solved by (existing) bruteforce. (Enumerate all 2^n sign assignments and evaluate the quadratic form; return the minimum.)
- It can be solved by reducing to integer programming. (Linearize the quadratic form via McCormick envelopes on binary variables.) See companion issue [Rule] MinimumMatrixCover to ILP #971.
- Other:
Reduction Rule Crossref
- [Rule] MinimumMatrixCover to ILP #971 — [Rule] MinimumMatrixCover to ILP (direct ILP formulation)
Example Instance
Input:
Matrix A (4×4, symmetric, zero diagonal):
0 3 1 0
3 0 0 2
1 0 0 4
0 2 4 0
Sum of all entries: 20.
Optimal sign assignment: f = (-1, +1, +1, -1), value = -20.
Verification: Σ a_ij f(i)f(j) =
- a_{01}·f(0)·f(1) = 3·(-1)·(+1) = -3 (×2 for symmetry)
- a_{02}·f(0)·f(2) = 1·(-1)·(+1) = -1 (×2)
- a_{13}·f(1)·f(3) = 2·(+1)·(-1) = -2 (×2)
- a_{23}·f(2)·f(3) = 4·(+1)·(-1) = -4 (×2)
- Total = 2·(-3-1-2-4) = -20 ✓
The assignment partitions indices into {0,3} (sign -1) and {1,2} (sign +1). All edges cross the partition, so every term contributes negatively.
Suboptimal assignment: f = (+1, +1, -1, -1), value = 8.
Trivial assignment: f = (+1, +1, +1, +1), value = 20 (maximum, all terms positive).
Expected Outcome
Optimal value: Min(-20) — the minimum of the quadratic form is -20. Out of 16 sign assignments, there are 7 distinct values: -20, -8, -4, 0, 4, 8, 20. The optimal is achieved by placing all-connected pairs on opposite sides of the partition.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status