Skip to content

Complete numeric variant conversions and audit missing edges - #1209

Merged
GiggleLiu merged 17 commits into
mainfrom
fix/minimum-vertex-cover-unit-weight-cast
Oct 29, 2026
Merged

GiggleLiu merged 17 commits into
mainfrom
fix/minimum-vertex-cover-unit-weight-cast

Conversation

@isPANN

@isPANN isPANN commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator

Registered numeric variants were missing direct conversions, forcing path search through unrelated models or leaving variants disconnected. Add 20 missing edges: 15 One → i64 conversions (including three decision wrappers) and five i64 → f64 conversions. All 29 matching numeric variant pairs now have direct executable edges.

Reuse the existing variant-reduction macro and declare exact identity parameter transforms. Unit-weight conversions preserve witnesses, objective values, and decision thresholds. The five new float conversions reject coefficients or accumulated objective bounds outside the exact-integer float range; Steiner forest also checks its scaled costs. No new variants or dependencies are introduced. Existing ILP rules qualify their shared trait helpers where the additional implementations would otherwise make type inference ambiguous.

Add a registry-wide test that discovers matching weight/coefficient variants automatically and requires direct witness-executable conversions. Behavior tests compare complete converted instances against independently deserialized target instances, solve both sides with the real brute-force solver, recover source optima and aggregate values, and exercise precision and overflow boundaries. Two unit-weight model examples supply inputs for the existing executable parameter-formula checks.

Remove Typst explanations of pure numeric casts, including the existing Spin Glass, Set Packing, and QUBO entries and numeric-cast paragraphs in MIS and ILP. Keep graph transformations, fixed-to-generic variants, and bounded-integer encodings. The paper completeness filter excludes only numeric promotions that leave every other variant dimension unchanged; a build-time assertion checks that a graph-changing MIS rule remains nontrivial. Repository guidance records this distinction.

Validation:

  • The new tests failed before the missing conversions were implemented.
  • Formatting and final workspace Clippy passed.
  • Workspace unit/integration tests passed, including 6,247 library tests and the executable parameter-formula checks. Final focused numeric tests: 7 passed.
  • Full library LLVM coverage passed: 95.67% line coverage. Final focused coverage gives 100% line coverage for the new exact-float helper and scaled forest cost checks.
  • make paper passed, including the numeric/nontrivial classification assertions.
  • make check still ends at the existing problemreductions-macros/src/lib.rs:211 doctest failure: its standalone reduction attribute has no attached item. That file is unchanged from main.

isPANN and others added 12 commits October 11, 2026 23:18
Reject self-loops and repeated undirected edges in SimpleGraph::try_new,
shared by new and serde. Reuse validation for bipartite pairs and propagate
fallible graph construction through model create specs.

Keep complement-edge formulas exact. Make SAT graph builders emit unique
pairs, combine MaxCut contributions, fold constant SpinGlass diagonals into
the decision bound, and use simple NO gadgets for empty clauses.

Update definitions and graph-type documentation, restrict tests to the
accepted simple domain, and verify topology, CLI, MCP, and catalogue create
paths. Keep the standalone macro attribute documentation as text for doctests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Describe TSP and bottleneck TSP as simple-graph problems and remove
obsolete degenerate-tour explanations from their reduction proofs.

Review the other loop and parallel-arc definition additions. Retain
explicit semantics for flow, feedback-set, and mixed postman inputs;
restore simple input definitions for the six catalog formulations whose
broader constructor acceptance still needs a maintainer decision.

Leave model validation and reduction behavior unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rename the loop- and parallel-record topologies to MultiDirectedGraph and
MultiMixedGraph. Add SimpleDirectedGraph as a validated, JSON-compatible
wrapper and migrate the six simple-digraph models and their constructors.

Expose arc multiplicity through MultiDirectedGraph::arc_count, keep per-arc
vector order, and share the existing loop/duplicate checker across simple
topologies. Validate augmentation candidates with that checker and allow
undirected loops through MixedChinesePostman CLI/MCP creation.

Adapt four obsolete simple-model fixtures, retain exhaustive Kernel/ILP
verification over every three-vertex simple digraph, and update graph docs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nches

Test multiplicity, incidence, equality, serde validation, and weighted loop
creation through the CLI and real MCP protocol. Remove unreachable TSP
multigraph recovery and undirected-flow self-loop handling. Drop the
redundant NAE edge-sum overflow branch after its checked total bound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Share equivalent create-path graph validation across eleven models and
remove checks that simple graph invariants make redundant. Reuse borrowed
arc iteration, avoid neighbor-vector allocations, and build incoming
branching constraints in one pass. Remove obsolete loop-support text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Emit an infeasible ILP for graphs with fewer than three vertices and require target feasibility before extracting a tour. Preserve the exact variable count and adjust the constraint bound for the contradictory row.

Add exhaustive graph-isomorphism differential tests through five vertices, signed and zero weights, invalid-witness rejection, and exact boundary-cost checks. Document the correctness and overhead arguments in the paper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep every TSP graph and weight case while checking exact assignments directly, reusing source tours and precomputing vertex relabelings. Reuse the parameter fixture database and target measurements, and prefer smaller authored rule sources over display-model examples.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Retain every test and named graph case. Use exact ILP infeasibility checks for the adversarial reductions, mathematical lower bounds for expensive canonical examples, and verified QUBO slack/energy certificates from optimized ILP prefixes.

Keep exhaustive rooted-tree graph and threshold coverage while pruning invalid reference permutations. Bound the large mapping, determinism and compression fixtures, and verify the full Tutte ordering alongside an independent small exact-search oracle. Remove the two obsolete Tutte ignore attributes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Use fallible topology constructors at schema and typed create boundaries,
including bipartite models, and check vertex-count inference for overflow.
Exercise ordinary schema models and typed MCP inputs without process panics.

Restore positive minimization boundary and singleton-interval checks using
the fixed-objective fixture, and retain the cheap spanning-tree budget case
that was lost when its parallel edge fixture became a simple path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reuse the existing permutation decoder and Cartesian iterator, consolidate
fixture and MCP assertion loops, and stream the rooted-tree oracle costs.
Avoid temporary TSP edge triples and simplify equivalent solver budgets.
Keep every test and case, typed create errors, and independent certificate
checks intact.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.24051% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.02%. Comparing base (35f40b4) to head (fbce255).
⚠️ Report is 26 commits behind head on main.

Files with missing lines Patch % Lines
src/unit_tests/rules/weight_casts.rs 98.00% 5 Missing ⚠️
src/unit_tests/parameter_formula_validation.rs 97.93% 3 Missing ⚠️
src/rules/travelingsalesman_ilp.rs 94.59% 2 Missing ⚠️
src/unit_tests/rules/travelingsalesman_ilp.rs 99.00% 2 Missing ⚠️
...ules/ksatisfiability_decisionminimumvertexcover.rs 87.50% 1 Missing ⚠️
src/rules/minimumtardinesssequencing_ilp.rs 87.50% 1 Missing ⚠️
src/unit_tests/example_db.rs 97.72% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1209      +/-   ##
==========================================
+ Coverage   96.90%   97.02%   +0.11%     
==========================================
  Files        1095     1101       +6     
  Lines      144972   145516     +544     
==========================================
+ Hits       140484   141183     +699     
+ Misses       4488     4333     -155     

☔ View full report in Codecov by Harness.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@isPANN
isPANN marked this pull request as draft October 17, 2026 11:15
@isPANN isPANN changed the title Add direct unit-weight to integer-weight vertex cover reduction Complete numeric variant conversions and audit missing edges Oct 17, 2026
@isPANN
isPANN marked this pull request as ready for review October 17, 2026 16:09

@GiggleLiu GiggleLiu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Agentic Review Report

Reviewed PR #1209 at 85175e3bdaff7454750a5ffc84ea700ba466a036 against merge base 875b6e86d5a87e5f66c2f6743be9d22abe917a09.

Structural and semantic

No blocking findings against this PR's base. Inspected all 20 added variant conversions and registrations. Unit-weight conversions preserve all instance fields and decision bounds. The shared float helper checks each value before taking its absolute value, so i64::MIN cannot overflow that operation. Its running absolute sum bounds every possible subset sum within the exactly represented integer range. The forest conversion additionally checks scaled prizes, edge costs, and vertex penalties with checked integer arithmetic. Separate comparative-containment sums remain exact on each side of the comparison.

The five floating conversions register aggregate mappings only where source and target evaluation types agree. Numeric metadata is copied exactly. The new registry audit requires all corresponding concrete numeric variants to have direct executable edges. Paper filtering excludes only a numeric dimension change with identical remaining dimensions.

Quality

git diff --check passed. Reviewed tests compare serialized target instances, solve source and target by brute force, check all optimal target witnesses, preserve decision bounds, and reject inexact sums and scaled products. Nine checks on the exact PR head are green, including tests, Clippy, formatting, coverage, and platform builds. No local Rust compilation or paper rendering was rerun by this reviewer.

Feature test

No CLI installation was performed. These registry-driven conversions are exercised by direct path construction and runtime reduction in the committed tests, covered by existing green CI.

Findings

No blocker in isolation. There is a definite integration dependency if #1194 lands first: src/unit_tests/rules/weight_casts.rs:8 imports the removed DirectedGraph and MixedGraph, with constructors later in that file. Rename them to MultiDigraph and MultiMixedGraph when updating this PR onto the graph-type change, then run a combined build. A textually clean merge alone will not catch this incompatibility.

Safe to merge after this integration adjustment if needed and a current-head recheck.

GitHub PR audit

GATE: PASS

  • harm.secrets: OK. No credentials introduced.
  • harm.dangerous-files: OK. New files are purposeful Rust conversion modules and tests.
  • harm.generated-artifacts: OK. No generated exports or build products.
  • harm.cache: OK. No cache directories.
  • harm.debug-leftovers: OK. No production probes.
  • pr.description-quality: OK. The body describes conversion limits and verification.
  • pr.traceable: OK. The missing graph edges and the added audit are explained.

Integration update

Head fbce2550d88a47b78de5e67259b896728a8139f4 merges the reviewed graph API change and accepted main comment cleanup. The only additional adaptation changes three references in src/unit_tests/rules/weight_casts.rs: DirectedGraph becomes MultiDigraph, and MixedGraph becomes MultiMixedGraph. These match the constructors required by MinimumFeedbackVertexSet and MixedChinesePostman. No fixture data or production cast behavior was changed. Formatting and diff-whitespace checks pass. Fresh CI must pass before merge.

@GiggleLiu
GiggleLiu merged commit fbf7a76 into main Oct 29, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants