-
Notifications
You must be signed in to change notification settings - Fork 3
[Model] Maximum2Satisfiability #807
Description
Motivation
MAXIMUM 2-SATISFIABILITY (P257) from Garey & Johnson, A9 LO5. A classical NP-hard optimization problem. MAX-2-SAT serves as a key source for reductions to graph optimization problems:
- As source: R35 (→ GraphPartitioning), R37 (→ MaxCut), R157 (→ OpenHemisphere), R268 (→ MaximumBipartiteSubgraph)
- As target: R201 (3SAT →)
Definition
Name: Maximum2Satisfiability
Reference: Garey & Johnson, Computers and Intractability, A9 LO5
Mathematical definition:
INSTANCE: Set U of variables, collection C of clauses over U such that each clause c ∈ C has |c| = 2.
OBJECTIVE: Find a truth assignment for U that maximizes the number of simultaneously satisfied clauses in C.
Variables
- Count: n = |U| (one binary variable per boolean variable in U)
- Per-variable domain: {0, 1} — 0 represents FALSE, 1 represents TRUE
- Meaning: x_i = 1 if variable u_i is assigned TRUE, x_i = 0 if FALSE. The objective is to maximize the number of satisfied clauses (each clause is a disjunction of exactly 2 literals).
Schema (data type)
Type name: Maximum2Satisfiability
Variants: none
| Field | Type | Description |
|---|---|---|
clauses |
Vec<(Literal, Literal)> |
Collection of 2-literal clauses; each clause is a disjunction of exactly 2 literals |
num_variables |
usize |
Number of boolean variables in U |
Where Literal encodes a variable index and its sign (positive or negated).
Complexity
- Best known exact algorithm: Williams (2004) reduces MAX-2-SAT to MAX TRIANGLE via fast matrix multiplication, achieving O*(2^(0.7905 · n)) time, where n is the number of variables. This uses the current best matrix multiplication exponent ω < 2.3714 (Alman, Duan, Williams, Xu, Xu, Zhou, 2024), giving ω/3 ≈ 0.7905. Branch-and-bound algorithms by Shen and Zhang (2005) achieve bounds parameterized by the number of clauses m, progressing from O(m · 2^(m/3.44)) to O(m · 2^(m/5)). [Williams, "Maximum 2-satisfiability", Encyclopedia of Algorithms, 2004; Shen & Zhang, "Improving exact algorithms for MAX-2-SAT", Annals of Mathematics and AI, 2005.]
Extra Remark
Full book text:
INSTANCE: Set U of variables, collection C of clauses over U such that each clause c∈C has |c|=2, positive integer K≤|C|.
QUESTION: Is there a truth assignment for U that simultaneously satisfies at least K of the clauses in C?
Reference: [Garey, Johnson, and Stockmeyer, 1976]. Transformation from 3SAT.
Comment: Solvable in polynomial time if K=|C| (e.g.,see [Even, Itai, and Shamir, 1976]).
Note: The original G&J formulation is a decision problem with threshold K. We use the equivalent optimization formulation: maximize the number of satisfied clauses.
How to solve
- It can be solved by (existing) bruteforce. (Enumerate all 2^n truth assignments; count satisfied clauses for each; return the maximum.)
- It can be solved by reducing to integer programming. (Binary ILP: for each clause introduce a binary indicator; maximize sum of indicators subject to clause constraints.) See companion issue [Rule] Maximum2Satisfiability to ILP #961.
- Other: When all clauses must be satisfied simultaneously, reduces to 2-SAT which is solvable in polynomial time.
Reduction Rule Crossref
- [Rule] Maximum2Satisfiability to ILP #961 — [Rule] Maximum2Satisfiability to ILP (direct ILP formulation)
Example Instance
Input:
Variables: U = {x_1, x_2, x_3, x_4} (n = 4)
Clauses (7 clauses, each with exactly 2 literals):
- (x_1 ∨ x_2)
- (x_1 ∨ ¬x_2)
- (¬x_1 ∨ x_3)
- (¬x_1 ∨ ¬x_3)
- (x_2 ∨ x_4)
- (¬x_3 ∨ ¬x_4)
- (x_3 ∨ x_4)
Why no assignment satisfies all 7:
Clauses {1, 2} = (x_1 ∨ x_2) and (x_1 ∨ ¬x_2) form a complementary pair on x_2: if x_1 = FALSE, then exactly one of these two clauses fails (depending on x_2). Similarly, clauses {3, 4} = (¬x_1 ∨ x_3) and (¬x_1 ∨ ¬x_3) form a complementary pair on x_3: if x_1 = TRUE, then exactly one of these two fails. Regardless of x_1's value, at least one complementary pair loses a clause, so at most 6 out of 7 can be satisfied.
Optimal assignment (6 out of 7):
x_1 = TRUE, x_2 = TRUE, x_3 = FALSE, x_4 = TRUE
- (T ∨ T) = T ✓
- (T ∨ F) = T ✓
- (F ∨ F) = F ✗
- (F ∨ T) = T ✓
- (T ∨ T) = T ✓
- (T ∨ F) = T ✓
- (F ∨ T) = T ✓
Expected Outcome
Optimal value: Max(6) — the maximum number of simultaneously satisfiable clauses is 6. There are 6 optimal assignments in total (3 with x_1 = TRUE and 3 with x_1 = FALSE), confirming that x_1 is not forced.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status