-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor LinearExpression and Constraint using composition #55
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
e882781
Refactor LinearExpression and Constraint using composition
coroa 5fda490
Make linter happy
coroa ef9d2ee
Small fixes introduced during clean-up
coroa f903d46
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 21ed04e
Fix imports
coroa d94214d
Use deprecation instead of deprecated package
coroa f4504bd
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] e10c096
variables: Convert into composition pattern (WIP)
coroa e87e353
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 95fc5c4
Add monkey_patch work-around for left multiplication
coroa 060fe25
Fix tests
coroa c03acd3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] cc58dd1
test_model_creation: Fix final test
coroa d164454
Move monkey patching into dedicated module
coroa 44fafc8
support python3.11
FabianHofmann f7e134b
variables: add locindexer
FabianHofmann 7f6ffa0
add LinearExpressionGroupby class
FabianHofmann fd27342
add LinearExpressionRolling class
FabianHofmann 705c970
style: make flake8 a bit more happy
FabianHofmann c97942a
Merge branch 'composition-design' of github.com:PyPSA/linopy into com…
coroa b63cf02
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 8529999
Merge branch 'master' into composition-design
FabianHofmann 0330959
fix circular imports
FabianHofmann d12a5bb
fix imports for xarray v2022.12.
FabianHofmann de43928
update release notes
FabianHofmann 749b673
test: increase coverage
FabianHofmann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to suggest that the class supports initialization from a
DataArray
object passed as first positional parameterargs[0]
. The new interface is not backwards compatible in this way. But I found only one place where the constructorConstraint()
is used directly, so I guess this should be fine. I don't really understand the comment and how it is related to the linked pull request.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR 5984 was merged for xarray 0.20.2 , ie below what we currently support as oldest possible version so not relevant anymore.
Indeed, I changed the
Constraint
semantics to only ever possibly refer to a full namedConstraint
that is already represented within aConstraints
container (i considered renaming it toBoundConstraint
to make this more obvious).The
AnonymousConstraint
seemed to fulfill the need for anything that is not attached to a model yet.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note also that this means that you cannot use
Constraint
to represent a slice of a constraint, ie. there is no way tosel
into a constraint and still use aConstraint
object to hold it. (i only understood that feature through convertingVariable
where this is needed).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm the workaround for PR 5984 is obsolete, but I assume there was a reason why
linopy.Constraint
had to support initialization from aDataArray
object, right? I can't see such a place changed in this PR here nor could I find such a place in thelinopy
repository, so I'd guess: this is either outdated or used in some downstream repository (PyPSA?).