Skip to content

Restore flow ILP overhead predictions with capacity bit lengths - #1182

Closed
isPANN wants to merge 3 commits into
fix/bounded-ilp-variantsfrom
fix/flow-ilp-overhead
Closed

isPANN wants to merge 3 commits into
fix/bounded-ilp-variantsfrom
fix/flow-ilp-overhead

Conversation

@isPANN

@isPANN isPANN commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Superseded by #1174. This PR’s changes were included in the combined squash commit 8bdddd45 on fix/exact-reduction-parameters. Continue review and fixes in #1174. The original description below is retained for reference.


Motivation

Stacked on #1180 (base branch: fix/bounded-ilp-variants). That PR makes bounded integer ILP encoding explicit, but four flow reductions still cannot predict ILP numeric magnitude and therefore cannot predict the size of their binary ILP and QUBO targets.

This PR restores those predictions using one intrinsic statistic per flow model and fixes two domain/schema defects found during the audit.

Changes

  • Add computed max_capacity_bits to IntegralFlowBundles, IntegralFlowWithMultipliers, UndirectedFlowLowerBounds, and UndirectedTwoCommodityIntegralFlow. It measures existing capacities (bundle capacities for IntegralFlowBundles), with a minimum of one; constructors take no additional input.
  • Reuse capacity-based requirement normalization. Requirements beyond attainable flow remain infeasible; oversized demands no longer inflate target coefficients.
  • Normalize nonterminal multipliers to min(multiplier, total_capacity + 1), with saturating arithmetic. Above total capacity, positive integral inflow would require impossible outflow, so the replacement preserves feasibility.
  • Declare the local bound max_constraint_magnitude_bits <= max_capacity_bits + num_arcs + 1 (or num_edges + 1) in each flow-to-bounded-ILP rule. Every RHS uses only source parameters.
  • Propagate capacity bits from DecisionMaximumIndependentSet exactly as 2, and from Partition with the upper bound max_numeric_magnitude_bits + num_elements.

Three flow models previously had no capacity-scale parameter. Multiplier flow already has raw max_capacity, but capacity bits allow the incoming Partition chain to compose without variable-exponent support. The raw capacity field remains available on concrete instances and in the model's complexity expression; its symbolic prediction from Partition remains explicitly unavailable. Downstream ILP size predictions do not depend on it.

API and validation changes

Contract Before After
UndirectedFlowLowerBounds construction Accepted negative lower bounds Enforces 0 <= lower <= capacity consistently through the shared constructor
Multiplier flow prediction parameters Included signed requirement, causing a panic when negative Removes requirement from the canonical parameter schema; preserves the signed construction field, serialization, and getter
Four flow parameter schemas No capacity bit-length statistic Add max_capacity_bits

No new variants or model-level inference mechanisms are introduced.

Verified behavior

  • For edges (0,1) and (2,3), capacities [1,10], lower bounds [-5,0], and demand 5 from 0 to 1, the base branch reports feasible through source brute force but infeasible through ILP. The new constructor rejects this invalid input.
  • Inspecting multiplier flow with requirement -1 previously panicked on conversion to an unsigned parameter. It now succeeds and reports capacity bits; the signed requirement remains instance data.
  • CLI reductions through bounded ILP, binary ILP, and QUBO recover a valid lower-bound-flow witness (8 QUBO variables) and a valid two-commodity witness with a negative demand (15 QUBO variables). Corresponding demands of i64::MAX remain infeasible after solving and recovery.
  • Tests cover both incoming chains through QUBO: feasible witnesses recover successfully, and odd/even infeasible Partition instances cannot decode a witness.
  • Direct ILP rules with incomplete parameter contracts decrease from 26 to 22. This count concerns direct ILP entries, not every possible graph path.

Validation

Regression tests were run failing before implementation, including the validation defect, negative-parameter panic, coefficient normalization, and missing composed predictions.

  • cargo test --features example-db --workspace -- --include-ignored: 6,893 passed.
  • cargo fmt --all --check: passed.
  • cargo clippy --workspace --all-targets --all-features -- -D warnings: passed.
  • make paper: passed.
  • Focused LLVM coverage: 37/37 changed executable production lines covered.
  • CLI checks exercise construction/inspection, explicit reduction routes, solving, and recovered source evaluation. Extreme coefficient tests establish construction and parameter bounds; they do not claim every extreme instance can be solved numerically by the ILP backend.

Stack refresh

Merged the updated parent #1180, carrying the construction-derived bounds and validation fixes from #1174 through the stack. Preserved this PR's bounded ILP types, numeric-magnitude fields, and algorithms; no instance fixtures were added. The PR remains based on its immediate parent.

Validation of the updated head: make check passed (formatting, all-target/all-feature Clippy, and workspace tests including ignored tests). GitHub CI is restricted to PRs targeting main or develop, so these stack branches were checked locally.

@isPANN
isPANN added this pull request to stack #1181 September 28, 2026 06:05
@codecov

codecov Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.76%. Comparing base (05fed6f) to head (2841e0c).

Additional details and impacted files
@@                    Coverage Diff                     @@
##           fix/bounded-ilp-variants    #1182    +/-   ##
==========================================================
  Coverage                     96.75%   96.76%            
==========================================================
  Files                          1072     1072            
  Lines                        140481   140656   +175     
==========================================================
+ Hits                         135928   136103   +175     
  Misses                         4553     4553            

☔ 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 added a commit that referenced this pull request Sep 29, 2026
Squash the combined changes from PRs #1180, #1182, #1183, #1184, and #1185 into #1174. Preserve the complete stack-tip tree so subsequent corrections can be maintained on one branch.
@isPANN isPANN closed this Sep 29, 2026
@isPANN
isPANN removed this pull request from stack #1181 September 29, 2026 12:24
@isPANN
isPANN deleted the fix/flow-ilp-overhead branch September 29, 2026 12:31
@isPANN

isPANN commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator Author

Merged to #1174.

GiggleLiu added a commit that referenced this pull request Oct 3, 2026
* Make derivable reduction parameters exact

* Check every field in exact reduction transforms

* Verify exact reduction parameters on randomized instances

* Check exact and upper-bound reduction parameters

* Document and simplify parameter formula validation

* Improve parameter prediction contracts and bound integer ILP reductions

* Derive reduction parameter bounds from constructed targets

Correct exactness claims, count sparse coefficients by construction block, reject negative flow capacities, and verify metadata using existing behavior inputs and real executors.

* Consolidate bounded ILP and parameter prediction stack

Squash the combined changes from PRs #1180, #1182, #1183, #1184, and #1185 into #1174. Preserve the complete stack-tip tree so subsequent corrections can be maintained on one branch.

* Correct ILP parameter bounds and simplify reduction code

* Calibrate parity and universe-size reduction bounds

Derive upper bounds from conditional even padding and the set-packing endpoint universe. Preserve the exact edge-to-set count and verify the registered promises in existing parity and isolated-vertex tests.

* Remove invalid reduction catalog edges

* Add direct binary ILP pipelines for exact-one SAT and graph kernels

* Preserve scheduling semantics with compact ILP constructions

* Simplify scheduling solution extraction

* Tighten ILP nonzero bounds using construction counts

* Compact exact reductions and register missing solver pipelines

Replace oversized formulations with compact constructions for partition,
register, matrix, graph, and ordering problems. Add direct bounded ILP
pipelines and reuse exact customized subset-sum and clique-cover solvers.

Preserve signed weights and costs, avoid artificial partition-bound
overflow, and align overhead contracts, rule targets, tests, and proofs
with the resulting constructions.

Validated with make check, make paper, independent reduction audits, and
CLI solver and extraction round trips.

* Remove redundant reduction parameters and derive bounds from model inputs

* Fix exact verification bottlenecks in reduction targets

* Simplify reduction results and exact solver bookkeeping

* fix: bound solver precomputation by small witness budgets

* fix: remove needless borrow flagged by current CI clippy

* fix: cap solver preprocessing and handle large union chains

---------

Co-authored-by: GiggleLiu <cacate0129@gmail.com>
GiggleLiu added a commit that referenced this pull request Oct 3, 2026
…1190)

* Make derivable reduction parameters exact

* Check every field in exact reduction transforms

* Verify exact reduction parameters on randomized instances

* Check exact and upper-bound reduction parameters

* Document and simplify parameter formula validation

* Improve parameter prediction contracts and bound integer ILP reductions

* Derive reduction parameter bounds from constructed targets

Correct exactness claims, count sparse coefficients by construction block, reject negative flow capacities, and verify metadata using existing behavior inputs and real executors.

* Consolidate bounded ILP and parameter prediction stack

Squash the combined changes from PRs #1180, #1182, #1183, #1184, and #1185 into #1174. Preserve the complete stack-tip tree so subsequent corrections can be maintained on one branch.

* Correct ILP parameter bounds and simplify reduction code

* Calibrate parity and universe-size reduction bounds

Derive upper bounds from conditional even padding and the set-packing endpoint universe. Preserve the exact edge-to-set count and verify the registered promises in existing parity and isolated-vertex tests.

* Remove invalid reduction catalog edges

* Add direct binary ILP pipelines for exact-one SAT and graph kernels

* Preserve scheduling semantics with compact ILP constructions

* Simplify scheduling solution extraction

* Tighten ILP nonzero bounds using construction counts

* Compact exact reductions and register missing solver pipelines

Replace oversized formulations with compact constructions for partition,
register, matrix, graph, and ordering problems. Add direct bounded ILP
pipelines and reuse exact customized subset-sum and clique-cover solvers.

Preserve signed weights and costs, avoid artificial partition-bound
overflow, and align overhead contracts, rule targets, tests, and proofs
with the resulting constructions.

Validated with make check, make paper, independent reduction audits, and
CLI solver and extraction round trips.

* Remove redundant reduction parameters and derive bounds from model inputs

* Fix exact verification bottlenecks in reduction targets

* Simplify reduction results and exact solver bookkeeping

* Tighten construction overhead bounds and expose required source statistics

* Use lattice geometry and cached rectangle incidence to tighten remaining bounds

* Sum individual coefficient width bounds for lattice encodings

* Reuse constructed parameters in overhead count tests

* fix: bound solver precomputation by small witness budgets

* fix: remove needless borrow flagged by current CI clippy

* fix: cap solver preprocessing and handle large union chains

---------

Co-authored-by: GiggleLiu <cacate0129@gmail.com>
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.

1 participant