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

Constraint macro modifies expression #3638

Closed
odow opened this issue Dec 20, 2023 · 2 comments · Fixed by #3639
Closed

Constraint macro modifies expression #3638

odow opened this issue Dec 20, 2023 · 2 comments · Fixed by #3639

Comments

@odow
Copy link
Member

odow commented Dec 20, 2023

julia> using JuMP

julia> model = Model();

julia> @variable(model, 0 <= x <= 5);

julia> @expression(model, e, x + 5)
x + 5

julia> @constraint(model, -10 <= e <= 10)
x  [-15, 5]

julia> e
x
@mlubin
Copy link
Member

mlubin commented Dec 20, 2023

Oops, that's a bad one

@odow
Copy link
Member Author

odow commented Dec 20, 2023

So this slipped by our tests because it's only a problem where the body of a function is a single identifier, like :e, and the constraint is:

  • a double-sided interval constraint
  • an explicit f in Set() constraint

Something like e <= 1 doesn't trigger it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants