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

An issue on multiplication by (-1) for Expressions #314

Open
RuikunZhou opened this issue Jun 17, 2024 · 2 comments
Open

An issue on multiplication by (-1) for Expressions #314

RuikunZhou opened this issue Jun 17, 2024 · 2 comments

Comments

@RuikunZhou
Copy link

Hi,

I encountered a severe problem when (right) multiplying the dreal expressions with (-1). When I right multiply an expression by dreal.Expression(-1) or simply (-1), it modifies the original expression incorrectly. Specifically, the original expression retains only the first term after the operation. Below is a minimal code example and its output:

import dreal

x1 = dreal.Variable("x1")
a = -0.5 + x1 - x1**2
b = a * dreal.Expression(-1)
print(a)

Output:

-0.5

The multiplication operation modifies the original expression a. When the expression multiplies (-1) with (-1) on the left, i.e., dreal.Expression(-1)*a, there was no such an issue.

Thanks.

@soonhokong
Copy link
Member

Thanks for the report. I think there is an issue in its Python binding. I'll take a look.

@RuikunZhou
Copy link
Author

Thanks a lot!

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

No branches or pull requests

2 participants