Skip to content

[DNM] Adds Plasmo.jl interface in contrib folder for benders algorithms on linopy models#821

Draft
coroa wants to merge 3 commits into
masterfrom
feat/plasmo-jl-benders
Draft

[DNM] Adds Plasmo.jl interface in contrib folder for benders algorithms on linopy models#821
coroa wants to merge 3 commits into
masterfrom
feat/plasmo-jl-benders

Conversation

@coroa

@coroa coroa commented Jul 8, 2026

Copy link
Copy Markdown
Member

Changes proposed in this Pull Request

Adds a new sub-packge linopy.contrib.plasmo to run Benders or nested benders decompositions on linopy models.

A partitioning algebra that is available through linopy.contrib.plasmo.Partition and 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.py file or the commented experiment/plasmo-benders-decomposition.nb notebook, 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 juliacall and juliapkg to set up a julia installation and an environment with the required Julia packages. They are set up automatically within the pixi environment in the experiment folder.

Open issues

  • Lacks implementation for non-continuous variables and special constraint types.
  • Experiment should not be part of the repository
  • Unit tests

Checklist

  • AI-generated content is marked (see AGENTS.md).
  • Code changes are sufficiently documented; i.e. new functions contain docstrings and further explanations may be given in doc.
  • Unit tests for new features were added (if applicable).
  • A note for the release notes doc/release_notes.rst of the upcoming release is included.
  • I consent to the release of this PR's code under the MIT license.

@coroa coroa changed the title [DNM] Adds Plasmo.jl interface in contrib folder for running on linopy models [DNM] Adds Plasmo.jl interface in contrib folder for benders algorithms on linopy models Jul 8, 2026
@coroa

coroa commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

@odow Promised ping, please have a look.

@codspeed-hq

codspeed-hq Bot commented Jul 8, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 173 untouched benchmarks
⏩ 173 skipped benchmarks1


Comparing feat/plasmo-jl-benders (8ccbdbd) with master (125a7c3)

Open in CodSpeed

Footnotes

  1. 173 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

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