Motivation
PR #1010 adds ThreeDimensionalMatching → ThreePartition, which creates an indirect ILP path:
3DM → ThreePartition → ResourceConstrainedScheduling → ILP
This chain has O(n^2) blowup: a 5-triple canonical example produces 114,075 binary ILP variables, causing HiGHS to hang and CI to time out (2+ hours).
A direct ThreeDimensionalMatching → ILP reduction produces 5 variables and 9 constraints for the same instance.
Source
ThreeDimensionalMatching
Target
ILP<bool>
Reference
Alexander Schrijver, Combinatorial Optimization: Polyhedra and Efficiency, Springer, 2003, Section 29.11. Book metadata: https://books.google.com/books?id=mqGeSQ6dJycC.
This is the standard textbook 0-1 ILP pattern for set packing / set covering / matching problems: use one binary variable per candidate set (here, per triple) and enforce incidence constraints so each required element is covered exactly once. The direct ThreeDimensionalMatching → ILP rule is exactly that formulation specialized to the three coordinate classes W, X, and Y.
Reduction Checklist
| # |
Item |
Value |
| 1 |
Source |
ThreeDimensionalMatching |
| 2 |
Target |
ILP<bool> |
| 3 |
Reduction |
Let k = universe_size, let the triples be t_0, ..., t_{n-1} where n = num_triples, and create one binary variable x_j for each j in {0, ..., n-1}. For each element value in each dimension W, X, and Y, add an equality constraint requiring exactly one selected triple to contain that value in that dimension. This is a feasibility reduction with an empty objective. |
| 4 |
Solution extraction |
Identity: x_j = 1 means triple t_j is selected |
| 5 |
Correctness |
The W constraints force each W element to appear exactly once, the X constraints force each X element to appear exactly once, and the Y constraints force each Y element to appear exactly once. Therefore feasible ILP solutions are exactly perfect 3-dimensional matchings, and vice versa. |
| 6 |
Overhead |
num_vars = "num_triples", num_constraints = "3 * universe_size" |
| 7 |
Example |
For universe_size = 3 and triples [(0,1,2),(1,0,1),(2,2,0),(0,0,0),(1,2,2)], the target ILP has variables x_0, ..., x_4 and the 9 equality constraints listed below. Its unique feasible solution is x = [1,1,1,0,0], corresponding to triples t_0, t_1, t_2. |
| 8 |
Solving |
Direct ILP via HiGHS |
| 9 |
Reference |
Schrijver (2003), Combinatorial Optimization: Polyhedra and Efficiency, Section 29.11 |
Implementation Pattern
Follow src/rules/exactcoverby3sets_ilp.rs — nearly identical structure (binary variable per subset, exact-cover constraints per element). The only difference is 3 groups of constraints (one per dimension W, X, Y) instead of 1.
Reduction Algorithm
Given a ThreeDimensionalMatching instance:
- let
k = universe_size
- let the triple list be
M = {t_0, ..., t_{n-1}}, where n = num_triples
- write each triple as
t_j = (a_j, b_j, c_j) with a_j, b_j, c_j in {0, ..., k-1}
Construct an ILP<bool> instance as follows:
- Introduce one binary decision variable
x_j in {0,1} for each triple index j in {0, ..., n-1}.
- For each
a in {0, ..., k-1}, add the W-dimension exact-cover constraint
sum_{j : a_j = a} x_j = 1.
- For each
b in {0, ..., k-1}, add the X-dimension exact-cover constraint
sum_{j : b_j = b} x_j = 1.
- For each
c in {0, ..., k-1}, add the Y-dimension exact-cover constraint
sum_{j : c_j = c} x_j = 1.
- Use an empty objective with
ObjectiveSense::Minimize, since this is a pure feasibility problem.
- Extract a source witness by selecting exactly those triples
t_j with x_j = 1.
Size Overhead
| Target metric |
Formula |
num_vars |
n = num_triples |
num_constraints |
3k = 3 * universe_size |
Validation Method
Validate the rule in three complementary ways:
- Closed-loop witness check on the canonical example: solve the source
ThreeDimensionalMatching instance by brute force, solve the reduced ILP instance with HiGHS, extract the selected triples, and confirm the extracted witness is a perfect 3-dimensional matching for the source.
- Infeasible-instance check: use a small instance where some coordinate value cannot be covered exactly once and confirm that both the source problem and the reduced ILP instance are infeasible.
- Cross-check against the existing indirect path: on small brute-force-solvable instances, compare the direct
ThreeDimensionalMatching → ILP result against the current indirect path ThreeDimensionalMatching → ThreePartition → ResourceConstrainedScheduling → ILP to ensure both produce the same yes/no answer while the direct path has strictly smaller exported overhead.
Example
1. Source instance
Let k = 3 and let the triples be
t_0 = (0,1,2)
t_1 = (1,0,1)
t_2 = (2,2,0)
t_3 = (0,0,0)
t_4 = (1,2,2)
So the source instance is:
ThreeDimensionalMatching::new(
3,
vec![(0,1,2), (1,0,1), (2,2,0), (0,0,0), (1,2,2)],
)
2. Construction
Create five binary ILP variables x_0, x_1, x_2, x_3, x_4, one for each triple.
The exact-cover constraints are:
W-dimension constraints
- value
0 appears in t_0 and t_3: x_0 + x_3 = 1
- value
1 appears in t_1 and t_4: x_1 + x_4 = 1
- value
2 appears only in t_2: x_2 = 1
X-dimension constraints
- value
0 appears in t_1 and t_3: x_1 + x_3 = 1
- value
1 appears only in t_0: x_0 = 1
- value
2 appears in t_2 and t_4: x_2 + x_4 = 1
Y-dimension constraints
- value
0 appears in t_2 and t_3: x_2 + x_3 = 1
- value
1 appears only in t_1: x_1 = 1
- value
2 appears in t_0 and t_4: x_0 + x_4 = 1
The ILP uses an empty objective because it is only checking feasibility.
3. Target instance
The resulting target problem is an ILP<bool> instance with:
num_vars = 5
num_constraints = 9
objective = []
sense = ObjectiveSense::Minimize
Solving the constraints forces:
x_0 = 1 from constraint 5
x_1 = 1 from constraint 8
x_2 = 1 from constraint 3
x_3 = 0 from constraints 1, 4, or 7
x_4 = 0 from constraints 2, 6, or 9
Hence the extracted witness is the triple set {t_0, t_1, t_2}, which covers each value in W, X, and Y exactly once, so it is a perfect 3-dimensional matching.
Files to Create/Modify
src/rules/threedimensionalmatching_ilp.rs — reduction implementation
src/unit_tests/rules/threedimensionalmatching_ilp.rs — tests (closed-loop, structure, infeasible case)
src/rules/mod.rs — add mod threedimensionalmatching_ilp; (feature-gated ilp-solver)
src/example_db/rule_builders.rs — add canonical example builder
docs/paper/reductions.typ — add reduction-rule entry
- Run
cargo run --example export_graph and make regenerate-fixtures
Priority
Blocks PR #1010 — without this, CI hangs for 2+ hours because model_specs_are_optimal tries the indirect 3-step path.
BibTeX
@book{schrijver2003combinatorial,
author = {Schrijver, Alexander},
title = {Combinatorial Optimization: Polyhedra and Efficiency},
publisher = {Springer},
year = {2003},
isbn = {9783540443896}
}
Motivation
PR #1010 adds
ThreeDimensionalMatching → ThreePartition, which creates an indirect ILP path:This chain has
O(n^2)blowup: a 5-triple canonical example produces 114,075 binary ILP variables, causing HiGHS to hang and CI to time out (2+ hours).A direct
ThreeDimensionalMatching → ILPreduction produces 5 variables and 9 constraints for the same instance.Source
ThreeDimensionalMatchingTarget
ILP<bool>Reference
Alexander Schrijver, Combinatorial Optimization: Polyhedra and Efficiency, Springer, 2003, Section 29.11. Book metadata: https://books.google.com/books?id=mqGeSQ6dJycC.
This is the standard textbook 0-1 ILP pattern for set packing / set covering / matching problems: use one binary variable per candidate set (here, per triple) and enforce incidence constraints so each required element is covered exactly once. The direct
ThreeDimensionalMatching → ILPrule is exactly that formulation specialized to the three coordinate classesW,X, andY.Reduction Checklist
ThreeDimensionalMatchingILP<bool>k = universe_size, let the triples bet_0, ..., t_{n-1}wheren = num_triples, and create one binary variablex_jfor eachj in {0, ..., n-1}. For each element value in each dimensionW,X, andY, add an equality constraint requiring exactly one selected triple to contain that value in that dimension. This is a feasibility reduction with an empty objective.x_j = 1means triplet_jis selectedWconstraints force eachWelement to appear exactly once, theXconstraints force eachXelement to appear exactly once, and theYconstraints force eachYelement to appear exactly once. Therefore feasible ILP solutions are exactly perfect 3-dimensional matchings, and vice versa.num_vars = "num_triples",num_constraints = "3 * universe_size"universe_size = 3and triples[(0,1,2),(1,0,1),(2,2,0),(0,0,0),(1,2,2)], the target ILP has variablesx_0, ..., x_4and the 9 equality constraints listed below. Its unique feasible solution isx = [1,1,1,0,0], corresponding to triplest_0, t_1, t_2.Implementation Pattern
Follow
src/rules/exactcoverby3sets_ilp.rs— nearly identical structure (binary variable per subset, exact-cover constraints per element). The only difference is 3 groups of constraints (one per dimensionW,X,Y) instead of 1.Reduction Algorithm
Given a
ThreeDimensionalMatchinginstance:k = universe_sizeM = {t_0, ..., t_{n-1}}, wheren = num_triplest_j = (a_j, b_j, c_j)witha_j, b_j, c_j in {0, ..., k-1}Construct an
ILP<bool>instance as follows:x_j in {0,1}for each triple indexj in {0, ..., n-1}.a in {0, ..., k-1}, add theW-dimension exact-cover constraintsum_{j : a_j = a} x_j = 1.b in {0, ..., k-1}, add theX-dimension exact-cover constraintsum_{j : b_j = b} x_j = 1.c in {0, ..., k-1}, add theY-dimension exact-cover constraintsum_{j : c_j = c} x_j = 1.ObjectiveSense::Minimize, since this is a pure feasibility problem.t_jwithx_j = 1.Size Overhead
num_varsn = num_triplesnum_constraints3k = 3 * universe_sizeValidation Method
Validate the rule in three complementary ways:
ThreeDimensionalMatchinginstance by brute force, solve the reduced ILP instance with HiGHS, extract the selected triples, and confirm the extracted witness is a perfect 3-dimensional matching for the source.ThreeDimensionalMatching → ILPresult against the current indirect pathThreeDimensionalMatching → ThreePartition → ResourceConstrainedScheduling → ILPto ensure both produce the same yes/no answer while the direct path has strictly smaller exported overhead.Example
1. Source instance
Let
k = 3and let the triples bet_0 = (0,1,2)t_1 = (1,0,1)t_2 = (2,2,0)t_3 = (0,0,0)t_4 = (1,2,2)So the source instance is:
2. Construction
Create five binary ILP variables
x_0, x_1, x_2, x_3, x_4, one for each triple.The exact-cover constraints are:
W-dimension constraints0appears int_0andt_3:x_0 + x_3 = 11appears int_1andt_4:x_1 + x_4 = 12appears only int_2:x_2 = 1X-dimension constraints0appears int_1andt_3:x_1 + x_3 = 11appears only int_0:x_0 = 12appears int_2andt_4:x_2 + x_4 = 1Y-dimension constraints0appears int_2andt_3:x_2 + x_3 = 11appears only int_1:x_1 = 12appears int_0andt_4:x_0 + x_4 = 1The ILP uses an empty objective because it is only checking feasibility.
3. Target instance
The resulting target problem is an
ILP<bool>instance with:num_vars = 5num_constraints = 9objective = []sense = ObjectiveSense::MinimizeSolving the constraints forces:
x_0 = 1from constraint 5x_1 = 1from constraint 8x_2 = 1from constraint 3x_3 = 0from constraints 1, 4, or 7x_4 = 0from constraints 2, 6, or 9Hence the extracted witness is the triple set
{t_0, t_1, t_2}, which covers each value inW,X, andYexactly once, so it is a perfect 3-dimensional matching.Files to Create/Modify
src/rules/threedimensionalmatching_ilp.rs— reduction implementationsrc/unit_tests/rules/threedimensionalmatching_ilp.rs— tests (closed-loop, structure, infeasible case)src/rules/mod.rs— addmod threedimensionalmatching_ilp;(feature-gatedilp-solver)src/example_db/rule_builders.rs— add canonical example builderdocs/paper/reductions.typ— addreduction-ruleentrycargo run --example export_graphandmake regenerate-fixturesPriority
Blocks PR #1010 — without this, CI hangs for 2+ hours because
model_specs_are_optimaltries the indirect 3-step path.BibTeX