-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Allow multiple attributes #2667
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
Allow multiple attributes #2667
Conversation
|
William Zijie Zhang seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
|
What's the plan for projecting onto multiple attributes? |
To start, projection will be disabled when there are multiple attributes. In the long run there may be a few combinations of attributes that are still worth projecting onto. |
PTNobel
left a comment
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.
Looks really good
|
ok I had another look at this and was a bit more thoughtful with tests, cases like sparse integer, sparse bounded, and integer bounded variables all seem to work. One thing that concerns me is people might want to pass sparse values as bounds (or only the nonzeros), so we will need to add a bit of code to cover that. But maybe we can do that in another PR if this seems fine for now? |
Yeah, we can worry about sparse bounds later. |
SteveDiamond
left a comment
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.
We also need tests for Parameters with multiple attributes.
|
I added tests for parameters with multiple attributes. These tests exposed an issue where parameter input validation doesn't work for multiple attributes. The issue is too complex to fix in this MR. |
ok sounds good, should we add some expected to fail decorators to those tests? And add TODOs for later? |
|
@Transurgeon I fixed the tests but one of the benchmarks is failing |
Transurgeon
left a comment
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.
LGTM, should we approve and merge this? We can iterate on this for the other things we had in mind.
@PTNobel it would be nice to have your review on this as well, if you have time.
PTNobel
left a comment
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.
Overall looks good. I'm curious for the story around the commented out tests.
Co-authored-by: Parth Nobel <[email protected]>
Co-authored-by: Parth Nobel <[email protected]>
I added complex + sparse tests. They actually caught a bug. |
| if self._value is None: | ||
| return None | ||
| val = np.zeros(self.shape) | ||
| val = np.zeros(self.shape, dtype=self._value.dtype) |
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.
oh really nice catch!
Description
Please include a short summary of the change.
This PR aims to remove the error being raised when declaring more than one attribute for cvxpy expressions.
The tradeoff for being able to declare such expressions is that we disable projections onto the sets defined by the multiple attributes.
Issue link (if applicable):
#566
Type of change
Contribution checklist