Skip to content

Commit 2b5f0fd

Browse files
GiggleLiuclaude
andauthored
Add parity tests against Julia ProblemReductions.jl (#65)
* Add design doc for testing against ProblemReductions.jl (#64) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add implementation plan for testing against ProblemReductions.jl (#64) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add Julia local environment for ProblemReductions.jl testing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add Julia test data generation script and fixtures Generates JSON fixtures from ProblemReductions.jl for parity testing: - 10 model fixtures (IndependentSet, SpinGlass, MaxCut, QUBO, SAT, KSat, VertexCovering, SetPacking, Matching, Factoring) - 17 reduction fixtures covering all Julia test/rules/rules.jl pairs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add Rust parity tests for Julia ProblemReductions.jl 22 active tests covering: - 10 model evaluations (IS, SpinGlass, MaxCut, QUBO, SAT, KSat, VertexCover, SetPacking, Matching, Factoring) - 12 reduction closed-loop tests (IS↔SetPacking, IS→VC, VC→SetCovering, SpinGlass↔MaxCut, SpinGlass↔QUBO, SAT↔KSat, CircuitSAT→SpinGlass, Factoring→CircuitSAT) - 4 ignored stubs for unimplemented reductions (SAT→Coloring, SAT→IS, SAT→DominatingSet, Matching→SetPacking) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add jl-testdata Makefile target and fix clippy warnings Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add Julia doc examples and rule test instances as parity tests - Reorganize fixtures: tests/data/jl_*.json → tests/data/jl/*.json with compact JSON - Add doc example instances for 5 new problem types (DominatingSet, MaximalIS, PaintShop, KColoring, SetCovering) and doc instances for existing problems - Add 22 individual rule test instances from Julia test/rules/*.jl covering spinglass↔maxcut, qubo→spinglass, vc→setcovering, is→setpacking, matching→setpacking, sat→ksat/coloring/independentset/dominatingset - Implement 11 new reduction parity tests (replaced 4 #[ignore] stubs) - Use ILP solver for SAT→Coloring test (brute force was 185s, now 0.02s) - Handle unsatisfiable SAT instances in evaluation test 39 passing, 1 ignored (SAT→CircuitSAT not in Rust) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Resolve PR review comments - Fix boolean values in extracted solutions (true/false → 0/1 integers) - Replace .unwrap() with descriptive .expect() messages in JSON parsers - Compact JSON already addressed in previous commit Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Remove Manifest.toml from tracking and add to .gitignore Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Move JL parity tests from integration tests to unit tests All 40 Julia ProblemReductions.jl parity tests (model evaluations and reduction round-trips) are now in src/unit_tests/jl_parity.rs, removing duplication with the existing unit test suite. The integration test file tests/suites/jl_parity.rs is reduced to a stub comment. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Revert "Move JL parity tests from integration tests to unit tests" This reverts commit f3fc90b. * Move JL parity tests into existing unit test files Distribute Julia parity tests from tests/suites/jl_parity.rs into the corresponding unit test files (15 model + 12 rule files). Tests use shared JSON parsing helpers via include!("../jl_helpers.rs"). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * rm plan files * Remove redundant tests now covered by JL parity tests Remove ~95 hand-written evaluate/brute_force tests from model and rule unit test files that are fully covered by the JL fixture-based parity tests. Keep construction, utility, trait compliance, edge case, and relationship tests that verify distinct concerns. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Replace .unwrap() with .expect() in jl_helpers.rs for consistency Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2eb68fb commit 2b5f0fd

90 files changed

Lines changed: 1758 additions & 2534 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.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ quickcheck-tests.json
3838
/dist/
3939
/build/
4040

41+
# Julia
42+
**/Manifest.toml
43+
4144
# Python
4245
__pycache__/
4346
*.py[cod]

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Makefile for problemreductions
22

3-
.PHONY: help build test fmt clippy doc mdbook paper examples clean coverage rust-export compare qubo-testdata export-schemas release run-plan diagrams
3+
.PHONY: help build test fmt clippy doc mdbook paper examples clean coverage rust-export compare qubo-testdata export-schemas release run-plan diagrams jl-testdata
44

55
# Default target
66
help:
@@ -22,6 +22,7 @@ help:
2222
@echo " examples - Generate example JSON for paper"
2323
@echo " export-schemas - Export problem schemas to JSON"
2424
@echo " qubo-testdata - Regenerate QUBO test data (requires uv)"
25+
@echo " jl-testdata - Regenerate Julia parity test data (requires julia)"
2526
@echo " release V=x.y.z - Tag and push a new release (triggers CI publish)"
2627
@echo " run-plan - Execute a plan with Claude autorun (latest plan in docs/plans/)"
2728

@@ -114,6 +115,9 @@ check: fmt-check clippy test
114115
qubo-testdata:
115116
cd scripts && uv run python generate_qubo_tests.py
116117

118+
jl-testdata: ## Regenerate Julia parity test data
119+
cd scripts/jl && julia --project=. generate_testdata.jl
120+
117121
# Release a new version: make release V=0.2.0
118122
release:
119123
ifndef V

scripts/jl/Project.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[deps]
2+
ProblemReductions = "899c297d-f7d2-4ebf-8815-a35996def416"
3+
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
4+
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"

0 commit comments

Comments
 (0)