[DNM] Adds Plasmo.jl interface in contrib folder for benders algorithms on linopy models#821
Draft
coroa wants to merge 3 commits into
Draft
[DNM] Adds Plasmo.jl interface in contrib folder for benders algorithms on linopy models#821coroa wants to merge 3 commits into
coroa wants to merge 3 commits into
Conversation
Member
Author
|
@odow Promised ping, please have a look. |
Merging this PR will not alter performance
Comparing Footnotes
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes proposed in this Pull Request
Adds a new sub-packge
linopy.contrib.plasmoto run Benders or nested benders decompositions on linopy models.A partitioning algebra that is available through
linopy.contrib.plasmo.Partitionand a few small helpers allows splitting up a linopy model into named nodes based on its dimensions. Each nodes is subset of variables and constraints. Variable sets are typically overlapping, while constraint sets are disjunct. Within Python CSR matrices and variable bounds for each node are constructed, passed to helpers in a small julia module and constructed as individual subgraphs in a Plasmo.jl OptiGraph. A Benders or NestedBendersAlgorithm can then be used to solve the OptiGraph in Julia/JuMP.The result is retrieved as a Result object that can be assigned to the original Linopy model.
The contrib.plasmo code probably will eventually not live in linopy, but instead a small adjacent package. The experiment folder is a small example which should move to the docs (but without the dependencies).
Look at the
experiment/run_benders.pyfile or the commentedexperiment/plasmo-benders-decomposition.nbnotebook, both run benders decomposition on the small testProblem that was provided by @leonardgoeke through https://github.com/leonardgoeke/Linopy2Plasmo.jl , see also discussion in PyPSA/PyPSA#1712 .Dependencies
The interface depends on
juliacallandjuliapkgto set up a julia installation and an environment with the required Julia packages. They are set up automatically within the pixi environment in theexperimentfolder.Open issues
Checklist
AGENTS.md).doc.doc/release_notes.rstof the upcoming release is included.