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

Bug mutating expression in interval constraint #3882

Closed
odow opened this issue Nov 14, 2024 · 0 comments · Fixed by #3883
Closed

Bug mutating expression in interval constraint #3882

odow opened this issue Nov 14, 2024 · 0 comments · Fixed by #3883

Comments

@odow
Copy link
Member

odow commented Nov 14, 2024

Found by https://discourse.julialang.org/t/unexpected-behavior-containerized-expression-automatically-redefined-when-included-in-interval-constraint/122648

julia> using JuMP

julia> model = Model()
A JuMP Model
├ solver: none
├ objective_sense: FEASIBILITY_SENSE
├ num_variables: 0
├ num_constraints: 0
└ Names registered in the model: none

julia> @variable(model, x)
x

julia> @expression(model, a[1:1], x+1)
1-element Vector{AffExpr}:
 x + 1

julia> a
1-element Vector{AffExpr}:
 x + 1

julia> @constraint(model, -1 <= a[1] <= 1)
x  [-2, 0]

julia> a
1-element Vector{AffExpr}:
 x
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.

1 participant