Skip to content

Fixed Bug with Upper Bound in PlasmoBenders#40

Merged
dlcole3 merged 5 commits into
plasmo-dev:mainfrom
dlcole3:dc/UB_bug_in_Benders_multithread
May 7, 2026
Merged

Fixed Bug with Upper Bound in PlasmoBenders#40
dlcole3 merged 5 commits into
plasmo-dev:mainfrom
dlcole3:dc/UB_bug_in_Benders_multithread

Conversation

@dlcole3
Copy link
Copy Markdown
Collaborator

@dlcole3 dlcole3 commented May 7, 2026

This PR addresses #39 where, when solving in parallel, the upper bound may not be updated correctly because multiple processors can try to access the memory at the same time. To addresss this, this PR adds an attribute to the BendersAlgorithm object called subgraph_objectives which stores the last iteration's objective value (minus theta, if applicable). It then uses these to construct the upper bound after all the forward pass is complete. This avoids trying to access the same memory across parallel solves in the forward pass.

@dlcole3 dlcole3 linked an issue May 7, 2026 that may be closed by this pull request
@dlcole3 dlcole3 requested a review from Copilot May 7, 2026 13:32
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR targets issue #39 by changing how PlasmoBenders constructs the forward-pass upper bound under parallel solves: instead of incrementally mutating a shared ub during per-subproblem solves, it records per-subproblem objective contributions and aggregates them after the forward pass completes.

Changes:

  • Added subgraph_objectives storage to BendersAlgorithm to record each subproblem’s objective contribution.
  • Refactored forward-pass code paths (threaded, async remote, and sequential) to populate subgraph_objectives and compute the UB via a final summation step.
  • Updated the regularization path to record objective contributions via subgraph_objectives, and bumped PlasmoBenders version to 0.3.2.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
lib/PlasmoBenders/src/solution.jl Refactors forward-pass iterations to avoid shared UB mutation; aggregates UB at end using stored per-subproblem objectives.
lib/PlasmoBenders/src/regularize.jl Updates regularization pass to store per-object objective contributions instead of directly mutating UB.
lib/PlasmoBenders/src/Benders.jl Adds and initializes subgraph_objectives; updates forward pass to seed UB from stored root contribution.
lib/PlasmoBenders/Project.toml Version bump to 0.3.2.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/PlasmoBenders/src/solution.jl
Comment thread lib/PlasmoBenders/src/solution.jl
Comment thread lib/PlasmoBenders/src/solution.jl
Comment thread lib/PlasmoBenders/src/solution.jl
Comment thread lib/PlasmoBenders/src/Benders.jl
@dlcole3 dlcole3 merged commit a363130 into plasmo-dev:main May 7, 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.

UB may not capture all subproblems in parallel

2 participants