Skip to content

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

@RuikunZhou

Description

@RuikunZhou

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions