Skip to content

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

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

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

Conversation

@isPANN

@isPANN isPANN commented Sep 28, 2026

Copy link
Copy Markdown
Collaborator

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.

@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.77%. Comparing base (6029c33) to head (3e8c3db).

Additional details and impacted files
@@                    Coverage Diff                     @@
##           fix/bounded-ilp-variants    #1182    +/-   ##
==========================================================
  Coverage                     96.76%   96.77%            
==========================================================
  Files                          1072     1072            
  Lines                        140453   140628   +175     
==========================================================
+ Hits                         135911   136086   +175     
  Misses                         4542     4542            

☔ 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.

This branch has not been deployed

No deployments
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