Skip to content

Commit 61f059c

Browse files
isPANNclaude
andauthored
feat: add 20 problem models with ILP rules (#976)
* feat: add Maximum2Satisfiability model (#807) MAX-2-SAT optimization problem — maximize satisfied 2-literal clauses. Includes model, tests, CLI create support, canonical example, and paper entry. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add Maximum2Satisfiability → ILP reduction rule (#961) Direct ILP formulation for MAX-2-SAT: binary clause indicators with linking constraints. Includes closed-loop tests, ILP solver verification, canonical example, and paper entry. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add MinimumEdgeCostFlow model and ILP rule (#810, #962) Fixed-charge network flow problem: minimize total price of arcs with nonzero flow subject to capacity, conservation, and flow requirement. ILP formulation uses integer flow + binary indicator variables. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add MaximumDomaticNumber model and ILP rule (#878, #963) Maximum domatic number: partition vertices into maximum number of disjoint dominating sets. ILP uses n²+n binary variables with partition, domination, and linking constraints. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add MinimumMetricDimension model and ILP rule (#880, #964) Metric dimension: minimum resolving set where all vertices have distinct distance vectors. ILP uses n binary variables with n*(n-1)/2 pair-distinguishing constraints from BFS distances. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add MaximumLeafSpanningTree model and ILP rule (#897, #965) Edge-selection spanning tree problem maximizing leaf count. ILP uses single-commodity flow for connectivity with leaf-detection constraints. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add MinimumGraphBandwidth model and ILP rule (#876) Permutation-based graph bandwidth minimization: find vertex ordering minimizing maximum edge stretch. ILP uses assignment variables with position-linking and edge-stretch constraints. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add MinimumMatrixCover model and ILP rule (#931, #971) Quadratic form minimization over ±1 sign assignments. ILP uses McCormick linearization with auxiliary variables for bilinear terms. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add MaximumLikelihoodRanking model and ILP rule (#930, #969) Permutation-based ranking to minimize disagreement cost in comparison matrix. ILP uses pairwise ordering variables with transitivity constraints. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add MinimumWeightDecoding model and ILP rule (#923, #968) GF(2) minimum-weight codeword problem: find binary vector with minimum Hamming weight satisfying Hx ≡ s (mod 2). ILP linearizes modular constraints with integer slack variables. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add Clustering model (#927) Distance-based clustering feasibility problem: partition elements into ≤K clusters with all intra-cluster distances ≤ B. NP-complete for K≥3. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add MinimumWeightAndOrGraph model (#933) AND/OR DAG solution subgraph: minimize arc weight subject to AND (all children) and OR (at least one child) gate constraints. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add NumericalMatchingWithTargetSums model and ILP rule (#817) Bipartite matching with target pair sums. ILP creates variables only for compatible (x_i, y_j, B_k) triples where sizes sum to target. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add MinimumAxiomSet model (#869) Deductive closure minimization: find smallest axiom subset whose iterative closure under implication rules yields all true sentences. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add MinimumFaultDetectionTestSet model (#935) DAG fault detection: find minimum input-output path set covering all vertices. Uses BFS reachability for coverage computation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add MinimumRegisterSufficiencyForLoops model (#873) Circular arc graph coloring for loop register allocation: assign registers minimizing count with no two conflicting variables sharing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add MinimumCapacitatedSpanningTree model and ILP rule (#901, #966) Capacitated spanning tree: minimize edge weight with subtree requirement constraints. ILP uses requirement-weighted flow for connectivity and capacity enforcement. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add OptimumCommunicationSpanningTree model and ILP rule (#906, #967) Communication spanning tree: minimize weighted path-cost sum over vertex pairs. ILP uses multi-commodity flow for path routing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add MaxCut/SimpleGraph/One variant (MaximumBipartiteSubgraph alias) (#887) Registers the unit-weight MaxCut variant with alias MaximumBipartiteSubgraph. Complexity: O*(2^(0.7907n)) via Williams 2004. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add SquareTiling model (#820) Wang tiling: place tile types on N×N grid with matching edge colors. NP-complete via reduction from Directed Hamiltonian Path. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add ThreeMatroidIntersection model (#851) Common independent set in three partition matroids: find K elements independent in all three. NP-complete via 3-Dimensional Matching. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: resolve needless_range_loop clippy warnings on Rust 1.94 Use iterator enumerate() instead of range indexing in clustering validation, likelihood ranking ILP objective, and matrix cover ILP. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add MinimumCodeGenerationOneRegister model (#900) One-register machine code generation: find minimum instruction sequence (LOAD/STORE/OP) to evaluate expression DAG. Uses permutation config for evaluation order with greedy register simulation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add MinimumCodeGenerationUnlimitedRegisters model (#902) Unlimited-register 2-address code generation: minimize instructions (OPs + copies) where left operand register is destroyed by each OP. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add MinimumCodeGenerationParallelAssignments model (#903) Parallel assignment scheduling: find execution ordering minimizing backward dependencies where overwritten variables are still needed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add MinimumDecisionTree model (#932) Object identification via binary tests: find decision tree minimizing total external path length. Config encodes flattened complete binary tree with test assignments at internal nodes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat: add MinimumDisjunctiveNormalForm model (#936) Two-level logic minimization: find minimum-term DNF via Quine-McCluskey prime implicant enumeration then minimum set cover. Config selects subset of precomputed prime implicants covering all minterms. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat: add VertexCover decision problem (#986) Decision version of MinimumVertexCover: given graph G and threshold k, determine whether a vertex cover of size ≤ k exists. One of Karp's 21 NP-complete problems. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * refactor: simplify review — remove duplication, precompute, improve efficiency - MinimumDecisionTree: remove redundant second traversal and dead `object_placed` state in simulate(), use HashSet for leaf uniqueness - VertexCover: reuse `is_vertex_cover_config` from MinimumVertexCover instead of duplicating the covering check - Clustering: extract `is_valid_partition` helper, fix `&Vec` return type to `&[Vec]`, use single-pass cluster grouping - MinimumDisjunctiveNormalForm: use HashSet for QMC dedup (O(1) vs O(n)), drop unused covered-minterms tracking - MinimumMetricDimension: precompute all-pairs BFS distance matrix in constructor to avoid redundant BFS per evaluate() call Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: add missing paper entries for 5 ILP reduction rules Added problem-def + reduction-rule entries for MaximumDomaticNumber, MinimumMetricDimension, MinimumGraphBandwidth, MinimumCapacitatedSpanningTree. Added reduction-rule entry for MinimumMatrixCover. Fixed QMC prime implicant ordering to be deterministic (sorted). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: harden ILP reductions, DRY bfs_distances, add CLI create for new models - Fix MaximumDomaticNumber ILP linking constraints (per-vertex x_{v,i} ≤ y_i) and update doc comment + overhead formula to match - Add bounds checking in MaximumDomaticNumber::evaluate_partition - Remove duplicate bfs_distances from MetricDimension ILP, reuse public fn - Strengthen MinimumGraphBandwidth ILP tests with exact value assertions - Add CLI create support for VertexCover, MinimumDecisionTree, MinimumDisjunctiveNormalForm, SquareTiling Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 423506c commit 61f059c

89 files changed

Lines changed: 15151 additions & 60 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/paper/reductions.typ

Lines changed: 937 additions & 1 deletion
Large diffs are not rendered by default.

docs/paper/references.bib

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,27 @@ @inproceedings{bouchez2006
1010
doi = {10.1007/978-3-540-72521-3_21}
1111
}
1212

13+
@inproceedings{ahoJohnsonUllman1977,
14+
author = {Alfred V. Aho and Steven C. Johnson and Jeffrey D. Ullman},
15+
title = {Code Generation for Machines with Multiregister Operations},
16+
booktitle = {Proceedings of the 4th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages},
17+
pages = {21--28},
18+
year = {1977},
19+
publisher = {ACM},
20+
doi = {10.1145/512950.512953}
21+
}
22+
23+
@article{brunoSethi1976,
24+
author = {John Bruno and Ravi Sethi},
25+
title = {Code Generation for a One-Register Machine},
26+
journal = {Journal of the ACM},
27+
volume = {23},
28+
number = {3},
29+
pages = {502--510},
30+
year = {1976},
31+
doi = {10.1145/321958.321974}
32+
}
33+
1334
@article{sethi1975,
1435
author = {Ravi Sethi},
1536
title = {Complete Register Allocation Problems},
@@ -1615,3 +1636,30 @@ @article{yannakakis1980
16151636
year = {1980},
16161637
doi = {10.1137/0138030}
16171638
}
1639+
1640+
@inproceedings{edmonds1970,
1641+
author = {Jack Edmonds},
1642+
title = {Submodular functions, matroids, and certain polyhedra},
1643+
booktitle = {Combinatorial Structures and Their Applications},
1644+
pages = {69--87},
1645+
year = {1970},
1646+
publisher = {Gordon and Breach}
1647+
}
1648+
1649+
@article{doron2024,
1650+
author = {Ilan Doron-Arad and Ariel Kulik and Hadas Shachnai},
1651+
title = {You (Almost) Can't Beat Brute Force for 3-Matroid Intersection},
1652+
journal = {arXiv preprint arXiv:2412.02217},
1653+
year = {2024}
1654+
}
1655+
1656+
@article{fomin2019,
1657+
author = {Fedor V. Fomin and Daniel Lokshtanov and Fahad Panolan and Saket Saurabh},
1658+
title = {Exact Algorithms via Monotone Local Search},
1659+
journal = {Journal of the ACM},
1660+
volume = {66},
1661+
number = {2},
1662+
pages = {1--23},
1663+
year = {2019},
1664+
doi = {10.1145/3277568}
1665+
}

problemreductions-cli/src/cli.rs

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,16 @@ Flags by problem type:
227227
SpinGlass --graph, --couplings, --fields
228228
KColoring --graph, --k
229229
KClique --graph, --k
230+
VertexCover (VC) --graph, --k
230231
MinimumMultiwayCut --graph, --terminals, --edge-weights
231232
MonochromaticTriangle --graph
232233
PartitionIntoTriangles --graph
233234
GeneralizedHex --graph, --source, --sink
234235
IntegralFlowWithMultipliers --arcs, --capacities, --source, --sink, --multipliers, --requirement
236+
MinimumEdgeCostFlow --arcs, --edge-weights (prices), --capacities, --source, --sink, --requirement
235237
MinimumCutIntoBoundedSets --graph, --edge-weights, --source, --sink, --size-bound
236238
HamiltonianCircuit, HC --graph
239+
MaximumLeafSpanningTree --graph
237240
LongestCircuit --graph, --edge-weights
238241
BoundedComponentSpanningForest --graph, --weights, --k, --bound
239242
UndirectedFlowLowerBounds --graph, --capacities, --lower-bounds, --source, --sink, --requirement
@@ -247,10 +250,12 @@ Flags by problem type:
247250
PathConstrainedNetworkFlow --arcs, --capacities, --source, --sink, --paths, --requirement
248251
Factoring --target, --m, --n
249252
BinPacking --sizes, --capacity
253+
Clustering --distance-matrix, --k, --diameter-bound
250254
CapacityAssignment --capacities, --cost-matrix, --delay-matrix, --cost-budget, --delay-budget
251255
ProductionPlanning --num-periods, --demands, --capacities, --setup-costs, --production-costs, --inventory-costs, --cost-bound
252256
SubsetProduct --sizes, --target
253257
SubsetSum --sizes, --target
258+
MinimumAxiomSet --n, --true-sentences, --implications
254259
Numerical3DimensionalMatching --w-sizes, --x-sizes, --y-sizes, --bound
255260
Betweenness --n, --sets (triples a,b,c)
256261
CyclicOrdering --n, --sets (triples a,b,c)
@@ -270,6 +275,7 @@ Flags by problem type:
270275
ComparativeContainment --universe, --r-sets, --s-sets [--r-weights] [--s-weights]
271276
X3C (ExactCoverBy3Sets) --universe, --sets (3 elements each)
272277
3DM (ThreeDimensionalMatching) --universe, --sets (triples w,x,y)
278+
ThreeMatroidIntersection --universe, --partitions, --bound
273279
SetBasis --universe, --sets, --k
274280
MinimumCardinalityKey --num-attributes, --dependencies
275281
PrimeAttributeName --universe, --deps, --query
@@ -284,6 +290,9 @@ Flags by problem type:
284290
ConsecutiveOnesMatrixAugmentation --matrix (0/1), --bound
285291
ConsecutiveOnesSubmatrix --matrix (0/1), --k
286292
SparseMatrixCompression --matrix (0/1), --bound
293+
MaximumLikelihoodRanking --matrix (i32 rows, semicolon-separated)
294+
MinimumMatrixCover --matrix (i64 rows, semicolon-separated)
295+
MinimumWeightDecoding --matrix (JSON 2D bool), --rhs (comma-separated booleans)
287296
FeasibleBasisExtension --matrix (JSON 2D i64), --rhs, --required-columns
288297
SteinerTree --graph, --edge-weights, --terminals
289298
MultipleCopyFileAllocation --graph, --usage, --storage
@@ -333,10 +342,19 @@ Flags by problem type:
333342
D2CIF --arcs, --capacities, --source-1, --sink-1, --source-2, --sink-2, --requirement-1, --requirement-2
334343
MinimumDummyActivitiesPert --arcs [--num-vertices]
335344
FeasibleRegisterAssignment --arcs, --assignment, --k [--num-vertices]
345+
MinimumFaultDetectionTestSet --arcs, --inputs, --outputs [--num-vertices]
346+
MinimumWeightAndOrGraph --arcs, --source, --gate-types, --weights [--num-vertices]
347+
MinimumCodeGenerationOneRegister --arcs [--num-vertices]
348+
MinimumCodeGenerationParallelAssignments --num-variables, --assignments
349+
MinimumCodeGenerationUnlimitedRegisters --left-arcs, --right-arcs [--num-vertices]
350+
MinimumRegisterSufficiencyForLoops --loop-length, --loop-variables
336351
RegisterSufficiency --arcs, --bound [--num-vertices]
337352
CBQ --domain-size, --relations, --conjuncts-spec
338353
IntegerExpressionMembership --expression (JSON), --target
339354
MinimumGeometricConnectedDominatingSet --positions (float x,y pairs), --radius
355+
MinimumDecisionTree --test-matrix (JSON 2D bool), --num-objects, --num-tests
356+
MinimumDisjunctiveNormalForm (MinDNF) --num-vars, --truth-table
357+
SquareTiling (WangTiling) --num-colors, --tiles, --grid-size
340358
ILP, CircuitSAT (via reduction only)
341359
342360
Geometry graph variants (use slash notation, e.g., MIS/KingsSubgraph):
@@ -547,6 +565,9 @@ pub struct CreateArgs {
547565
/// Partition groups for arc-index partitions (semicolon-separated, e.g., "0,1;2,3")
548566
#[arg(long)]
549567
pub partition: Option<String>,
568+
/// Three partition matroids for ThreeMatroidIntersection (pipe-separated matroids, semicolon-separated groups, e.g., "0,1,2;3,4,5|0,3;1,4;2,5|0,4;1,5;2,3")
569+
#[arg(long)]
570+
pub partitions: Option<String>,
550571
/// Arc bundles for IntegralFlowBundles (semicolon-separated groups of arc indices, e.g., "0,1;2,5;3,4")
551572
#[arg(long)]
552573
pub bundles: Option<String>,
@@ -631,6 +652,12 @@ pub struct CreateArgs {
631652
/// Directed arcs for directed graph problems (e.g., 0>1,1>2,2>0)
632653
#[arg(long)]
633654
pub arcs: Option<String>,
655+
/// Left operand arcs for MinimumCodeGenerationUnlimitedRegisters (e.g., 1>3,2>3,0>1)
656+
#[arg(long)]
657+
pub left_arcs: Option<String>,
658+
/// Right operand arcs for MinimumCodeGenerationUnlimitedRegisters (e.g., 1>4,2>4,0>2)
659+
#[arg(long)]
660+
pub right_arcs: Option<String>,
634661
/// Arc-index equality constraints for IntegralFlowHomologousArcs (semicolon-separated, e.g., "2=5;4=3")
635662
#[arg(long)]
636663
pub homologous_pairs: Option<String>,
@@ -824,6 +851,51 @@ pub struct CreateArgs {
824851
/// Output arcs (transition-to-place) for NonLivenessFreePetriNet (e.g., "0>1,1>2,2>3")
825852
#[arg(long)]
826853
pub output_arcs: Option<String>,
854+
/// Gate types for MinimumWeightAndOrGraph (comma-separated: AND, OR, or L for leaf, e.g., "AND,OR,OR,L,L,L,L")
855+
#[arg(long)]
856+
pub gate_types: Option<String>,
857+
/// Input vertex indices (comma-separated, e.g., "0,1")
858+
#[arg(long)]
859+
pub inputs: Option<String>,
860+
/// Output vertex indices (comma-separated, e.g., "5,6")
861+
#[arg(long)]
862+
pub outputs: Option<String>,
863+
/// True sentence indices for MinimumAxiomSet (comma-separated, e.g., "0,1,2,3,4,5,6,7")
864+
#[arg(long)]
865+
pub true_sentences: Option<String>,
866+
/// Implications for MinimumAxiomSet (semicolon-separated "antecedents>consequent", e.g., "0>2;0>3;1>4;2,4>6")
867+
#[arg(long)]
868+
pub implications: Option<String>,
869+
/// Loop length N for MinimumRegisterSufficiencyForLoops
870+
#[arg(long)]
871+
pub loop_length: Option<usize>,
872+
/// Variables as semicolon-separated start,duration pairs for MinimumRegisterSufficiencyForLoops (e.g., "0,3;2,3;4,3")
873+
#[arg(long)]
874+
pub loop_variables: Option<String>,
875+
/// Parallel assignments for MinimumCodeGenerationParallelAssignments (semicolon-separated "target:read1,read2" entries, e.g., "0:1,2;1:0;2:3;3:1,2")
876+
#[arg(long)]
877+
pub assignments: Option<String>,
878+
/// Number of variables for MinimumCodeGenerationParallelAssignments
879+
#[arg(long)]
880+
pub num_variables: Option<usize>,
881+
/// Truth table for MinimumDisjunctiveNormalForm (comma-separated 0/1, e.g., "0,1,1,1,1,1,1,0")
882+
#[arg(long)]
883+
pub truth_table: Option<String>,
884+
/// Test matrix for MinimumDecisionTree (JSON 2D bool array, e.g., '[[true,true,false],[true,false,false]]')
885+
#[arg(long)]
886+
pub test_matrix: Option<String>,
887+
/// Number of tests for MinimumDecisionTree
888+
#[arg(long)]
889+
pub num_tests: Option<usize>,
890+
/// Tiles for SquareTiling (semicolon-separated top,right,bottom,left tuples, e.g., "0,1,2,0;0,0,2,1;2,1,0,0;2,0,0,1")
891+
#[arg(long)]
892+
pub tiles: Option<String>,
893+
/// Grid size N for SquareTiling (N x N grid)
894+
#[arg(long)]
895+
pub grid_size: Option<usize>,
896+
/// Number of colors for SquareTiling
897+
#[arg(long)]
898+
pub num_colors: Option<usize>,
827899
}
828900

829901
#[derive(clap::Args)]

0 commit comments

Comments
 (0)