Repository navigation
🧩 Constraint Solving POTD:Problem of the Day: Vertex Cover via SAT Encoding #66104
Closed
Replies: 1 comment
|
This discussion has been marked as outdated by Constraint Solving — Problem of the Day. A newer discussion is available at Discussion #66531. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem Statement
The vertex cover problem asks: given an undirected graph with vertices and edges, find a minimum-size subset of vertices such that every edge has at least one endpoint in the subset.
Concrete Instance:
Consider a 5-vertex graph:
A valid vertex cover might be
{1, 3, 4}(size 3), where each edge touches at least one chosen vertex. The goal is to find the smallest such set.Input/Output:
G = (V, E)and (optionally) a budgetkS ⊆ Vwhere for every(u, v) ∈ E, eitheru ∈ Sorv ∈ S, minimizing|S|Why It Matters
Network security: Detecting compromised devices in a communication network—cover vertices (secured nodes) to monitor all connections. Protein interaction networks: Identifying key proteins that interact with many others to reduce experimental validation costs. Code coverage: Selecting minimal test cases to exercise all code paths (edges = dependencies, vertices = tests).
Modeling Approaches
Approach 1: Direct SAT Encoding (Decision Variant)
For a fixed budget
k, encode the decision problem into CNF:Decision Variables:
x_i ∈ {0, 1}for each vertexi, wherex_i = 1means vertexiis in the cover.Constraints:
(u, v), requirex_u ∨ x_v(at least one endpoint selected)∑ x_i = k(or≤ k)—encoded as a cardinality constraint in CNFTrade-offs:
kvalues requires re-encoding; cardinality encoding can blow up in sizeExample SAT Model (CNF)
Approach 2: Integer Linear Programming (ILP)
Model vertex cover as an optimization problem:
Variables:
x_i ∈ {0, 1}for each vertexiObjective:
Minimize
∑_{i=1}^{|V|} x_iConstraints:
For each edge
(u, v):x_u + x_v ≥ 1Trade-offs:
kApproach 3: Hybrid SAT + Incremental Search
Interleave SAT solving with an outer loop on
k:k = |E|(trivial upper bound: any edge endpoint set)k(encoded with unit propagation shortcuts)kand retrykis optimalTrade-offs:
Key Techniques
1. CNF Encoding of Constraints
The edge-coverage constraint
x_u ∨ x_vis already in CNF—one clause per edge. Cardinality constraints like∑ x_i ≤ krequire auxiliary variables (Tseitin transformation) or specialized encodings (totalizer, sorter networks).2. Symmetry & Lower Bounds
Vertex degree can guide heuristics: high-degree vertices are "more likely" in a minimal cover. Greedy lower bounds (e.g., maximal matching gives a lower bound of
|matching|) help prune the search space.3. SAT Solver Internals
Modern solvers employ:
x_u ∨ x_vwithx_u = 0forcesx_v = 1Challenge Corner
Can you encode the optimization problem directly in SAT without an outer loop?
One approach: use a SAT-based optimization framework (like SAT-IP hybrids or core-guided MaxSAT). Alternatively, think about how a SAT solver could learn that no vertex cover of size
< kexists, automatically finding the minimum.Advanced: How would you handle weighted vertex cover (minimize
∑ w_i x_i) using SAT? Is incremental weakening of cardinality constraints practical?References
All reactions