-
-
Notifications
You must be signed in to change notification settings - Fork 401
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 being violated in a nonlinear model #2037
Comments
Thanks for the report. This uncovered a serious bug. (We would have caught this before release with #2033.) |
The above model is slightly different from the one in the examples. If we write it as it is written there, the constraint is satisfied. using JuMP, Ipopt, Random
n = 1_000
rng = MersenneTwister(1234);
data = randn(rng, n)
model = Model(with_optimizer(Ipopt.Optimizer, print_level = 0))
@variable(model, μ, start = 0.0)
@variable(model, σ >= 0.0, start = 1.0)
@NLconstraint(model, μ == σ^2)
@NLobjective(model, Max, n / 2 * log(1 / (2 * π * σ^2)) -
sum((data[i] - μ)^2 for i in 1:n) / (2 * σ^2)
)
optimize!(model) julia> @show value(μ);
value(μ) = 0.6228839414610626
julia> @show value(σ)^2;
value(σ) ^ 2 = 0.6228839414610626 |
Should be fixed in JuMP master (which requires MOI v0.9.1) |
This is still not fixed. (tmp) pkg> st
Status `/private/tmp/Project.toml`
[b6b21f68] Ipopt v0.6.0
[4076af6c] JuMP v0.20.0
[b8f27783] MathOptInterface v0.9.2
julia> value(μ), value(σ)
(0.0, 1.0)
julia> value(μ) == value(σ)^2
false |
There was a test added in jump-dev/MathOptInterface.jl#850. What happened? |
Which value of |
Oh. The original bug is actually fixed. I had just copy-pasted from the first example with |
Solutions for the above model violate the constraint μ = σ^2:
One looking for statuses, we get:
The text was updated successfully, but these errors were encountered: