Skip to content

feat: add 38 problem models#960

Merged
zazabap merged 22 commits intomainfrom
batch-models
Mar 31, 2026
Merged

feat: add 38 problem models#960
zazabap merged 22 commits intomainfrom
batch-models

Conversation

@isPANN
Copy link
Copy Markdown
Collaborator

@isPANN isPANN commented Mar 30, 2026

Summary

Batch implementation of 38 problem models from the Ready column of the project board. Each model includes full implementation with tests, CLI support, canonical examples, and paper entries.

Models added (37 new, 1 generalized):

Algebraic (6)

Issue Model Type ILP
#853 AlgebraicEquationsOverGF2 Satisfaction No
#549 EquilibriumPoint Satisfaction No (nonlinear)
#840 MinimumMatrixDomination Optimization No
#854 MinimumWeightSolutionToLinearEquations Optimization No
#536 QuadraticCongruences Satisfaction No (quadratic)
#537 SimultaneousIncongruences Satisfaction No (modular)

Formula (3)

Issue Model Type ILP
#867 NonTautology Satisfaction No
#861 OneInThreeSatisfiability Satisfaction No
#855 Planar3Satisfiability Satisfaction No

Graph (14)

Issue Model Type ILP
#898 BoundedDiameterSpanningTree Satisfaction No
#896 DegreeConstrainedSpanningTree Satisfaction No
#813 DirectedHamiltonianPath Satisfaction Yes
#831 HamiltonianPathBetweenTwoVertices Satisfaction No
#885 Kernel Satisfaction No
#838 MaximumAchromaticNumber Optimization No
#836 MinimumCoveringByCliques Optimization No
#856 MinimumGeometricConnectedDominatingSet Optimization No
#837 MinimumIntersectionGraphBasis Optimization No
#832 MinimumMaximalMatching Optimization Yes
#883 MonochromaticTriangle Satisfaction No
#834 PartitionIntoCliques Satisfaction No
#833 PartitionIntoForests Satisfaction No (acyclicity)
#835 PartitionIntoPerfectMatchings Satisfaction No

Set (2)

Issue Model Type ILP
#830 SetSplitting Satisfaction Yes
#806 ThreeDimensionalMatching Satisfaction No

Misc (13)

Issue Model Type ILP
#839 Betweenness Satisfaction No
#917 CyclicOrdering Satisfaction No
#811 DynamicStorageAllocation Optimization No
#899 FeasibleRegisterAssignment Satisfaction No
#442 MinimumInternalMacroDataCompression Optimization Yes
#495 MinimumTardinessSequencing (generalized W param) Optimization Yes (both variants)
#921 NonLivenessFreePetriNet Satisfaction No
#808 Numerical3DimensionalMatching Satisfaction No
#506 OpenShopScheduling Optimization Yes
#504 PreemptiveScheduling Optimization Yes
#496 SequencingToMinimizeTardyTaskWeight Optimization Yes
#499 SequencingWithDeadlinesAndSetUpTimes Satisfaction Yes
#852 SubsetProduct Satisfaction No

Notable changes:

  • MinimumTardinessSequencing generalized with W type parameter (One for unit-length, i32 for arbitrary lengths)
  • Added WeightElement and VariantParam implementations for usize in src/types.rs
  • 9 direct ILP reduction rules added

Closes

Fixes #442, fixes #495, fixes #496, fixes #499, fixes #504, fixes #506, fixes #536, fixes #537, fixes #549, fixes #806, fixes #808, fixes #811, fixes #813, fixes #830, fixes #831, fixes #832, fixes #833, fixes #834, fixes #835, fixes #836, fixes #837, fixes #838, fixes #839, fixes #840, fixes #852, fixes #853, fixes #854, fixes #855, fixes #856, fixes #861, fixes #867, fixes #883, fixes #885, fixes #896, fixes #898, fixes #899, fixes #917, fixes #921

Test plan

  • make check (fmt + clippy + test) passes
  • make paper compiles without errors
  • All new models have ≥3 test functions per model
  • ILP rules have closed-loop and brute-force comparison tests
  • Canonical examples verified via example-db invariants

🤖 Generated with Claude Code

isPANN and others added 14 commits March 30, 2026 04:03
Implement the internal macro data compression problem (GJ SR23) with
direct ILP reduction, CLI support, canonical example, and paper entry.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add W type parameter to MinimumTardinessSequencing: W=One for unit-length
tasks (existing behavior), W=usize for arbitrary task lengths. Includes
ILP reduction for both variants, canonical examples, and updated tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Implement the weighted tardy task scheduling problem (GJ SS3) with
direct ILP reduction, CLI support, canonical example, and paper entry.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Implement the scheduling feasibility problem with compiler-class setup
times (GJ SS6) with direct ILP reduction, CLI support, and paper entry.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Implement multiprocessor preemptive scheduling (GJ SS12) with binary
time-slot assignment, direct ILP<i32> reduction, CLI support, and paper entry.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Implements the Open Shop Scheduling optimization model (minimize makespan)
with a direct ILP reduction using disjunctive formulation (binary ordering
variables + integer start times + makespan objective). Canonical example
uses the 4 jobs × 3 machines instance with true optimal makespan = 8.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implement the quadratic congruences feasibility problem (GJ AN1) with
brute-force solver, CLI support, canonical example, and paper entry.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Implement the simultaneous incongruences feasibility problem (GJ AN2)
with brute-force solver, CLI support, canonical example, and paper entry.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Implement the discrete Nash equilibrium existence problem (GJ AN15)
with brute-force solver, CLI support, canonical example, and paper entry.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Implement directed Hamiltonian path feasibility problem with ILP
reduction, CLI support, canonical example, and paper entry.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Implement hypergraph 2-colorability / set splitting feasibility problem
(GJ SP4) with ILP reduction, CLI support, canonical example, and paper entry.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Implement the fixed-endpoint Hamiltonian path problem (GJ Chapter 3)
with brute-force solver, CLI support, canonical example, and paper entry.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Implement minimum maximal matching / minimum edge dominating set (GJ GT10)
with ILP reduction, CLI support, canonical example, and paper entry.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Implement vertex arboricity / partition into forests feasibility problem
(GJ GT14) with brute-force solver, CLI support, canonical example, and
paper entry.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 30, 2026

Codecov Report

❌ Patch coverage is 98.69571% with 94 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.01%. Comparing base (0f51be6) to head (c1e4e89).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/models/misc/non_liveness_free_petri_net.rs 93.72% 16 Missing ⚠️
src/models/graph/bounded_diameter_spanning_tree.rs 92.46% 11 Missing ⚠️
...aic/minimum_weight_solution_to_linear_equations.rs 92.00% 8 Missing ⚠️
src/models/formula/one_in_three_satisfiability.rs 91.04% 6 Missing ⚠️
src/models/graph/minimum_covering_by_cliques.rs 93.50% 5 Missing ⚠️
...c/models/graph/minimum_intersection_graph_basis.rs 91.93% 5 Missing ⚠️
.../rules/sequencingwithdeadlinesandsetuptimes_ilp.rs 96.03% 4 Missing ⚠️
src/models/algebraic/minimum_matrix_domination.rs 96.34% 3 Missing ⚠️
src/models/formula/non_tautology.rs 94.54% 3 Missing ⚠️
src/models/formula/planar_3_satisfiability.rs 94.54% 3 Missing ⚠️
... and 16 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #960      +/-   ##
==========================================
+ Coverage   97.91%   98.01%   +0.09%     
==========================================
  Files         673      764      +91     
  Lines       72756    80775    +8019     
==========================================
+ Hits        71240    79169    +7929     
- Misses       1516     1606      +90     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

isPANN and others added 3 commits March 30, 2026 11:21
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
# Conflicts:
#	problemreductions-cli/src/commands/create.rs
#	src/models/mod.rs
…ght parameter

Replace standalone `usize` weight type with `i32`, which integrates into
the existing One → i32 → f64 variant hierarchy. This enables natural
edges between MinimumTardinessSequencing<One> and <i32> variants in the
reduction graph. Remove now-unnecessary WeightElement and VariantParam
impls for usize from types.rs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@zazabap
Copy link
Copy Markdown
Collaborator

zazabap commented Mar 31, 2026

Agentic Review Report

Structural Check

Build Status: All green (test, clippy, fmt-check pass)

Model Structural Completeness (37 new models)

# Check Status
1 Model files exist PASS — all 37
2 inventory::submit! present PASS — all 37
3 Serialize, Deserialize on struct PASS — all 37
4 Problem trait impl PASS — all 37
5 Aggregate value present PASS — all 37
6 #[cfg(test)] + #[path] test link PASS — all 37
7 Test file exists PASS — all 37
8 Test file has >= 3 test functions PASS — all 37
9 Registered in category mod.rs PASS — all 37
10 Re-exported in models/mod.rs FAIL — 4 missing: QuadraticCongruences, OpenShopScheduling, PreemptiveScheduling, SequencingWithDeadlinesAndSetUpTimes
11 declare_variants! registration PASS — all 37
12 CLI resolve_alias entry FAIL — 0/37 models have alias entries (file not modified)
13 CLI create support FAILOpenShopScheduling missing from create.rs (36/37 present)
14 Canonical model example PASS — all 37
15 Paper display-name entry PASS — all 37
16 Paper problem-def block PASS — all 37

Rule Structural Completeness (9 ILP rules)

# Check Status
1 Rule file exists PASS — all 9
2 #[reduction] macro PASS — all 9
3 ReductionResult impl PASS — all 9
4 ReduceTo impl PASS — all 9
5 Test file + closed-loop test PASS — all 9
6 Registered in rules/mod.rs PASS — all 9
7 Canonical rule example PASS — all 9
8 Paper reduction-rule entry PASS — all 9

Overhead Expression Verification

Rule Status Detail
SetSplitting → ILP PASS
MinimumMaximalMatching → ILP PASS
DirectedHamiltonianPath → ILP FAIL Assignment generates 3n constraints, not 2n. Should be 3 * num_vertices + ...
PreemptiveScheduling → ILP FAIL Uses num_tasks where d_max should appear in both num_vars and num_constraints
SequencingWithDeadlinesAndSetUpTimes → ILP FAIL Switch detection constraint count is data-dependent (O(n²·(n-1)) worst case), not 3*(num_tasks-1)
OpenShopScheduling → ILP PASS
SequencingToMinimizeTardyTaskWeight → ILP PASS
MinimumInternalMacroDataCompression → ILP ISSUE Overcounts constraints by n (2n+1 vs actual n+1). Upper bound, not exact.
MinimumTardinessSequencing → ILP PASS

Structural Issues

# Severity Issue
S1 must-fix 4 models missing from src/models/mod.rs re-exports: QuadraticCongruences, OpenShopScheduling, PreemptiveScheduling, SequencingWithDeadlinesAndSetUpTimes
S2 must-fix OpenShopScheduling missing from CLI create.rs
S3 must-fix DirectedHamiltonianPath → ILP overhead undercounts constraints (2n should be 3n)
S4 must-fix PreemptiveScheduling → ILP overhead uses num_tasks where d_max is correct
S5 must-fix SequencingWithDeadlinesAndSetUpTimes → ILP overhead undercounts switch detection constraints
S6 should-fix 0/37 models have CLI alias entries in problem_name.rs
S7 should-fix MinimumInternalMacroDataCompression → ILP overhead overcounts constraints by n
S8 should-fix Betweenness dims() uses vec![n; n] (n^n configs) vs Lehmer encoding (n!) used by other permutation models

Quality Check

Design Principles

Principle Status Detail
DRY ISSUE decode_permutation() copy-pasted verbatim between sequencing_to_minimize_tardy_task_weight.rs:110 and sequencing_with_deadlines_and_set_up_times.rs:142. Extract to shared utility.
DRY (acceptable) OK ILP rule boilerplate follows established codebase convention — acceptable repetition.
KISS OK Model implementations are straightforward. Complex ILP formulations (OpenShopScheduling, SequencingWithDeadlinesAndSetUpTimes) are well-documented.
KISS (minor) ISSUE Awkward Or({...}) pattern in evaluate methods (subset_product.rs:121-139, three_dimensional_matching.rs:131-163). Works but reads oddly.
HC/LC OK Each model file is self-contained. biguint_serde helper appropriately factored out.

HCI (CLI Changes)

Check Status
Error messages OK
Discoverability OK
Consistency OK
Least surprise OK

Test Quality

Good examples:

  • src/unit_tests/models/misc/open_shop_scheduling.rs — 14 tests, excellent coverage
  • src/unit_tests/models/algebraic/equilibrium_point.rs — 12 tests, strong edge case coverage
  • src/unit_tests/rules/setsplitting_ilp.rs — Structure, closed-loop, infeasible, BF comparison, overhead

Issues:

  • preemptivescheduling_ilp.rs:80-91test_..._infeasible is misnamed: tests a feasible instance. No actual infeasibility test.
  • preemptivescheduling_ilp.rs:44 — Closed-loop doesn't verify optimal makespan (should assert = 2)
  • openshopscheduling_ilp.rs:74 — Only checks makespan >= 6 without verifying optimality

Quality Issues

# Severity Issue
Q1 critical PreemptiveScheduling → ILP overhead formula bug: uses num_tasks where d_max is correct (src/rules/preemptivescheduling_ilp.rs:61-64)
Q2 important Setup time field description says "switching away from" but code charges "switching to" new compiler (src/models/misc/sequencing_with_deadlines_and_set_up_times.rs:25)
Q3 important Duplicated decode_permutation helper across 2 files (DRY violation)
Q4 important Several ILP reduction tests lack optimality verification or have misleading names
Q5 minor Awkward Or({...}) evaluate pattern in several models (readability)
Q6 minor Inconsistent ProblemSizeFieldEntry registration across new models

Agentic Feature Tests

Verdict: PASS — 0 critical issues

Test Coverage

Feature Models Tested Result
pred list all 38 PASS — 163 total types, 179 reductions
pred show 13 sampled PASS — correct descriptions, fields, complexity
pred create --example 19 models PASS — valid JSON instances
pred solve --solver brute-force 18 models PASS — correct results
pred path X ILP all 8 rules PASS — paths exist with overhead formulas
pred solve (ILP) all 8 rules PASS — correct solutions
pred reduce + pred solve pipeline 2 models PASS — end-to-end works
ILP vs brute-force consistency 3 models PASS — all agree

All 4251 library tests pass.

Issues Found

# Severity Issue Status
A1 low Unused import EquilibriumPoint in create.rs:12 (clippy warning) confirmed
A2 low Redundant closure in create.rs:2973 (clippy warning) confirmed
A3 low pred path X ILP fails for i32-variant rules (must specify ILP/i32) confirmed
A4 informational PreemptiveScheduling brute-force infeasible on canonical example by design

Generated by review-pipeline

Must-fix:
- S1: Add 4 missing re-exports in models/mod.rs and lib.rs prelude
  (QuadraticCongruences, OpenShopScheduling, PreemptiveScheduling,
  SequencingWithDeadlinesAndSetUpTimes)
- S2: Add OpenShopScheduling CLI create handler
- S3: Fix DirectedHamiltonianPath→ILP overhead (2n→3n constraints)
- S4/Q1: Fix PreemptiveScheduling→ILP overhead (num_tasks→d_max)
- S5: Fix SequencingWithDeadlinesAndSetUpTimes→ILP overhead
  (3*(n-1) → n^2*(n-1) switch detection constraints)

Should-fix:
- S7: Fix MinimumInternalMacroDataCompression→ILP overhead
  (2n+1 → n+1 constraints)
- Q2: Fix setup_times field description ("away from" → "to")
- Q3: Extract duplicated decode_permutation to shared misc/mod.rs

Low:
- A1: Remove unused EquilibriumPoint import in create.rs
- A2: Fix redundant closure in create.rs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@zazabap zazabap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All review findings addressed in fix commit. CI green. LGTM.

@zazabap zazabap merged commit 183b19a into main Mar 31, 2026
5 checks passed
@zazabap zazabap deleted the batch-models branch March 31, 2026 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment