Skip to content

Added Support for Benders Decomposition#914

Open
dlcole3 wants to merge 28 commits into
GenXProject:developfrom
dlcole3:dc/support_benders
Open

Added Support for Benders Decomposition#914
dlcole3 wants to merge 28 commits into
GenXProject:developfrom
dlcole3:dc/support_benders

Conversation

@dlcole3

@dlcole3 dlcole3 commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Description

  • This PR adds support for Benders decomposition (single stage only). This was based on work originally done by @filippopecci who implemented this in other branches, and which this PR uses and extends.
  • Significant refactoring was done to support Benders. a Benders flag was added to the settings (and set as 0 as the default). The generate_model function was split into a planning level and an operations level. Within the operations level, if the Benders flag in settings is set to 1, it will also call a capacity_decisions function which adds copies of the planning level decisions to the subproblems.
  • Several modules were refactored to support Benders. For long duration energy storage, hydrogen demand requirements, hourly matching, and CO2 policies (and LDES for VRE + storage modules), there are subperiod and planning level functions that are called when Benders is turned on which place decicision variables on their respective models (e.g., budget variables on the planning level).
  • Gurobi was added as a weak dependency, following a similar pattern as what is used in MacroEnergy.jl.
  • MacroEnergySolvers.jl was added as a dependency, and its benders function is used to solve with Benders decomposition.
  • Files were added for writing solutions from Benders decomposition
  • Documentation was updated with two new pages of documentation explaining how Benders is set up for GenX, and notes are added to the developer docs on working with Benders.
  • A set of tests were added. These tests just solve example cases with and without Benders and test that the solutions are within the Benders gap tolerance (1e-3).

What type of PR is this? (check all applicable)

  • Feature
  • Bug Fix
  • Documentation Update
  • Code Refactor
  • Performance Improvements

Related Tickets & Documents

Checklist

  • Code changes are sufficiently documented; i.e. new functions contain docstrings and .md files under /docs/src have been updated if necessary.
  • The latest changes on the target branch have been incorporated, so that any conflicts are taken care of before merging. This can be accomplished either by merging in the target branch (e.g. 'git merge develop') or by rebasing on top of the target branch (e.g. 'git rebase develop'). Please do not hesitate to reach out to the GenX development team if you need help with this.
  • Code has been tested to ensure all functionality works as intended.
  • CHANGELOG.md has been updated (if this is a 'notable' change).
  • I consent to the release of this PR's code under the GNU General Public license.

How this can be tested

This PR was primarily tested by running against the example cases in the example_systems directory. I ran examples 1-5, 7, 10, and 11 with and without Benders decomposition (with Gurobi as the solver)

Post-approval checklist for GenX core developers

After the PR is approved

  • Check that the latest changes on the target branch are incorporated, either via merge or rebase
  • Remember to squash and merge if incorporating into develop

@dlcole3 dlcole3 requested a review from lbonaldo June 16, 2026 20:49
@dlcole3

dlcole3 commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator Author

@lbonaldo a couple things to note on the tests in this PR:

  • The multistage tests failed on some specific Julia versions. I couldn't replicate the problem on my local machine even with the same major Julia version. I believe it is due to numerical differences in the DDP algorithm that is used in that test, such that it was converging to degenerate solutions (plus the subproblem has a pretty high tolerance). Let me know if this is an issue
  • One of the writing outputs tests also failed. Claude suggested this was due to numerical issues in HiGHS and switched to the simplex method over IPM for those tests.
  • I set up tests for Benders where Benders compares to the monolithic solutions of example cases 1-5, 7, 10, and 11. All of these solve fine on my local machine with Gurobi, but they have numerical issues when using HiGHS. Consequently, I ended up saving the monolithic solutions ahead of time for comparison (some of the monolithic solutions were erroring with no solution), and I had to play with HiGHS parameters to get some of the tests to converge at all. I ended up just using exmaples 1, 4, 5, and 10 for the test script, but it is easy to run the other examples locally using Gurobi.

run_genx_case_testing(test_path, genx_setup)
end

if result_count(EP) == 0

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@lbonaldo The test of Julia 1 with Windows errors on this no resources case used for writing outputs. From what I have looked into, it seems like it's a numerical error in HiGHS, likely due to significant NSE at a high penalty. I opted to use a @test_broken line here as I tried many different solver parameters and discussing with Claude and nothing worked in the GitHub workflow test. Open to any thoughts or suggestions you have here

@dlcole3 dlcole3 marked this pull request as ready for review June 22, 2026 21:46
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