-
Notifications
You must be signed in to change notification settings - Fork 83
Propagate the bounds from the parent to the child nodes #473
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
base: branch-25.10
Are you sure you want to change the base?
Conversation
…s when detaching the node from the tree. add backtracking argument to diving.
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
/ok to test f44b134 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Greptile Summary
This PR implements bounds propagation optimization in the branch-and-bound solver for mixed-integer programming (MIP). The key change is that bounds (variable upper/lower limits) are now efficiently propagated from parent nodes to child nodes during tree traversal, rather than being recomputed from scratch at every node. The implementation tracks which bounds have changed using a bounds_changed
vector and selectively triggers full recomputation only when necessary (when nodes become infeasible or integer feasible solutions are found). The changes span three core files: branch_and_bound.hpp
updates the method signature, mip_node.hpp
refactors bounds update logic into separate methods, and branch_and_bound.cpp
implements the conditional bounds update mechanism with performance optimizations for the dual simplex solver.
Important Files Changed
Changed Files
Filename | Score | Overview |
---|---|---|
cpp/src/dual_simplex/branch_and_bound.hpp | 5/5 | Updated solve_node method signature to support bounds propagation tracking |
cpp/src/dual_simplex/mip_node.hpp | 4/5 | Refactored bounds update logic with new update_variable_bound method and optimized traversal |
cpp/src/dual_simplex/branch_and_bound.cpp | 4/5 | Implemented conditional bounds recomputation logic with performance optimizations |
Confidence score: 4/5
- This PR implements a well-understood optimization for branch-and-bound algorithms with clear performance benefits
- Score reflects solid implementation but complexity in bounds management logic could introduce subtle bugs if bounds tracking becomes inconsistent
- Pay close attention to the bounds update logic in
mip_node.hpp
to ensure tighter bounds are never overwritten by looser ones
Sequence Diagram
sequenceDiagram
participant User
participant BranchAndBound as "Branch & Bound Solver"
participant Node as "MIP Node"
participant LP as "LP Solver"
User->>BranchAndBound: "solve(solution)"
BranchAndBound->>BranchAndBound: "solve_node()"
Note over BranchAndBound: Bounds propagation logic
BranchAndBound->>Node: "get_variable_bounds(lower, upper, bounds_changed)"
Node->>Node: "update_variable_bound() for current node"
loop For each parent node up to root
Node->>Node: "update_variable_bound() from parent"
Note over Node: Propagates bounds from parent to child
end
Node-->>BranchAndBound: "Updated bounds with bounds_changed flags"
BranchAndBound->>LP: "bound_strengthening()"
LP-->>BranchAndBound: "feasible status"
alt Node is feasible
BranchAndBound->>LP: "dual_phase2() with updated bounds"
LP-->>BranchAndBound: "LP solution"
alt Solution is integer feasible
BranchAndBound->>BranchAndBound: "add_feasible_solution()"
else Solution is fractional
BranchAndBound->>Node: "branch() - create child nodes"
Note over Node: Children inherit parent bounds
Node->>Node: "add_children(down_child, up_child)"
end
else Node is infeasible
BranchAndBound->>Node: "set_status(INFEASIBLE)"
end
BranchAndBound-->>User: "Final solution with bounds propagation"
3 files reviewed, no comments
…d_strenghtening to persist some variables between calls.
With this PR, the solver propagates the bounds from the parent to the child nodes. If the solver reaches the end of a branch (i.e., when the node becomes infeasible or an integer feasible solution is found), the bounds are recomputed from scratch.
Average (Primal) Gap over the MIPLIB2017 dataset:
main
(91a19f8):15.917959
with224
feasible solutionsThis PR:
15.519858
with224
feasible solutionsChecklist