Skip to content

feat: Add indicator constraints#594

Open
mcoughlin wants to merge 18 commits into
PyPSA:masterfrom
mcoughlin:feat/indicator-constraints
Open

feat: Add indicator constraints#594
mcoughlin wants to merge 18 commits into
PyPSA:masterfrom
mcoughlin:feat/indicator-constraints

Conversation

@mcoughlin
Copy link
Copy Markdown
Contributor

Closes # (if applicable).

Changes proposed in this Pull Request

Adding indicator constraints

Checklist

  • 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.

@mcoughlin mcoughlin changed the title Add indicator constraints feat: Add indicator constraints Feb 22, 2026
@FBumann FBumann added the enhancement New feature or request label Mar 18, 2026
@FabianHofmann
Copy link
Copy Markdown
Collaborator

@mcoughlin I am sorry this takes so long. there is a big refactoring going on in #630 which interferes a little with this. I hope you don't mind us taking a little longer

@FBumann FBumann added this to the v0.7.0 milestone Mar 26, 2026
@mcoughlin
Copy link
Copy Markdown
Contributor Author

@FabianHofmann No rush take your time!

…traints

# Conflicts:
#	doc/release_notes.rst
#	linopy/io.py
#	linopy/model.py
#	linopy/solver_capabilities.py
Add is_indicator/binary_var/binary_val to ConstraintBase, Constraint,
and CSRConstraint (slots, init, from_mutable, data, netcdf round-trip).
Add Constraints.indicator/.regular container accessors.
MatrixAccessor.indicator_sense holds single-char senses (<, >, =) from
to_matrix_with_rhs; the direct-API sense_map was keyed on two-char
strings, raising KeyError on the direct path (LP-file path was fine).
Add freeze round-trip, netCDF round-trip (mutable + frozen), matrix
split, copy preservation, and direct-API Gurobi solve coverage.
ncons feeds model.ncons which the Mosek backend uses to size the
(regular-only) matrix M.A; keep them aligned. Also exclude indicators
from the consolidated to_matrix. Add ncons assertion and release note.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants