Skip to content
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

Implement trivial inverses for some more atoms #1484

Merged
merged 3 commits into from Sep 28, 2021
Merged

Conversation

akshayka
Copy link
Collaborator

Edge case in which a user takes a sum/cumsum of a scalar atom.

Edge case in which a user takes a sum/cumsum of a scalar atom.
@akshayka
Copy link
Collaborator Author

Some context: The basic issue is that DQCP allows the root of an expression tree to be transformed by monotone increasing (or decreasing) real functions. The reduction just inverts these functions. Looks like we missed a few inverses in the original implementation.

This part of the grammar is silly, though, because all such a transformation does is yield an equivalent problem. We included it for completeness, but if I were to do it again I'd not allow monotone transformations. Allowing them adds little value, but adds significant maintenance burden ... Perhaps something for CVXPY 2.0 ...

import numpy as np

INVERTIBLE = set(
[atoms.ceil, atoms.floor, NegExpression, atoms.exp, atoms.log, atoms.log1p,
atoms.logistic, atoms.power, atoms.abs])
atoms.logistic, atoms.power, atoms.abs, atoms.cumsum])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why no sum here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some comments.

Copy link
Collaborator

@SteveDiamond SteveDiamond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@akshayka akshayka merged commit 6da785f into master Sep 28, 2021
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.

None yet

2 participants