Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cpmpy/expressions/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,8 @@ def __pow__(self, other: Any, modulo: Optional[int] = None):
raise TypeError("Power operator: modulo not supported")
if not isinstance(other, (int, np.integer)):
raise TypeError(f"Power operator requires a constant integer exponent, not: {other}")
if other == 0:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We will remove user vars with this enabled

return 1
if other == 1:
return self
return cp.Power(self, other)
Expand Down
Loading
Loading