Skip to content

Replace accidental O(N^2) BFRT with O(N log N). 13% better on NETLIB #96

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: branch-25.05
Choose a base branch
from

Conversation

chris-maes
Copy link
Contributor

@chris-maes chris-maes commented Jun 11, 2025

The current bound-flipping ratio test (BFRT) makes an O(N) pass through the remaining breakpoints for each breakpoint resulting in O(N^2) run time, where N is the number of breakpoints.

This PR places the breakpoints in a heap in O(N) time. And then removes the minimum breakpoint O(1) and reorders the heap O(log N) for each of the N breakpoints. Thus, the run time should be O(N log N).

On the NETLIB LP test set this results in a 67% reduction of time spent in the BFRT and a 13% reduction in overall solve time.

The entering variable chosen by the new code should be the same as the previous code (except when ties are broken differently when constructing the heap).

@chris-maes chris-maes requested review from a team as code owners June 11, 2025 20:52
Copy link

copy-pr-bot bot commented Jun 11, 2025

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@chris-maes chris-maes self-assigned this Jun 11, 2025
@chris-maes chris-maes added non-breaking Introduces a non-breaking change improvement Improves an existing functionality labels Jun 11, 2025
@chris-maes
Copy link
Contributor Author

This is still a work in progress. As I have not yet removed the old code, since I am still using it to run benchmarks on the MIPLIB test set.

@chris-maes chris-maes marked this pull request as draft June 11, 2025 21:07
@chris-maes chris-maes changed the title Fix accidental O(N^2) BFRT with O(N log N). 13% better on NETLIB Replace accidental O(N^2) BFRT with O(N log N). 13% better on NETLIB Jun 11, 2025
@anandhkb anandhkb added this to the 25.08 milestone Jul 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improves an existing functionality non-breaking Introduces a non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants