Dan.phi
September 9, 2021, 2:50pm
1
I am learning the basics of JuMP and tried running the code below, which computes the MLE of the parameters of a Gaussian distribution (mean and variance, source ):
using JuMP, Ipopt, Random, Statistics
Random.seed!(1234)
n = 1_000
data = randn(n)
mle = Model(optimizer_with_attributes(Ipopt.Optimizer, "print_level" => 0))
@NLparameter(mle, problem_data[i = 1:n] == data[i])
μ0 = randn()
σ0 = rand() + 1
@info "Starting guess, mean: $μ0, std: $σ0"
@variable(mle, μ, start = μ0)
@variable(mle, σ >= 0.0, start = σ0)
@NLexpression(mle, loglikelihood,
-(n / 2) * (log(2π) + 2 * log(σ)) - inv(2 * σ^2) * sum((xi - μ)^2 for xi in problem_data)
)
@NLobjective(mle, Max, loglikelihood)
optimize!(mle)
It gives me the following error, however:
The terminal process "C:\Users\dan\AppData\Local\Programs\Julia-1.6.2\bin\julia.exe '-i', '--banner=no', '--project=C:\Users\dan\.julia\environments\v1.6', 'c:\Users\dan\.vscode\extensions\julialang.language-julia-1.4.0\scripts\terminalserver\terminalserver.jl', '\\.\pipe\vsc-jl-repl-96af58fe-00fa-44a6-a1c9-b3f2a023a715', '\\.\pipe\vsc-jl-cr-a2d7320e-3e0e-4bb4-8651-8e0b2284c0d8', 'USE_REVISE=true', 'USE_PLOTPANE=true', 'USE_PROGRESS=true', 'DEBUG_MODE=false'" terminated with exit code: 3221226356.
Any ideas how to fix this? Thanks!
odow
September 9, 2021, 10:51pm
2
Hi @Dan.phi ,
How were you running this? This looks like an error with vs-code.
1 Like
odow
September 9, 2021, 11:47pm
4
I guess to clarify: how in VS-Code? Is your language-julia extension up-to-date?
Dan.phi
September 10, 2021, 7:52am
5
Yes, I have Julia 1.6.2 and the Julia extension is 1.4.0.
Dan.phi
September 10, 2021, 3:30pm
6
I run it in Julia directly and it essentially closed when I hit optimize!(mle)
, so most likely it is not a VS Code-related issue
blob
September 10, 2021, 4:46pm
7
The example runs in Juno with Julia 1.6.2 no problem:
Extrapolating from here: c++ - The terminal process terminated with exit code: 3221226356 - Stack Overflow it seems that your vs code is looking for things in the wrong places.
No idea how to fix it, though.
odow
September 12, 2021, 3:27am
8
I run it in Julia directly
From the command line REPL?
What is import Pkg; Pkg.status()
and versioninfo()
?
Dan.phi
September 14, 2021, 4:37pm
9
odow:
versioninfo()
Yes, from the REPL. Also:
odow
September 14, 2021, 11:05pm
10
Please update to Ipopt.jl 0.7.0. The 0.6.3 release is more than a year old, and I’ve fixed a number of problems like this in it.
1 Like
Dan.phi
September 15, 2021, 1:05pm
11
It worked!! Thank you very much!!!
1 Like
I’m getting this exit code with Gurobi v9.0.1 after running thousands of optimizations on the same environment. I will try with v9.5
odow
July 7, 2022, 9:27pm
13
Please prefer to start a new thread, rather than posting on an old one (but you can link to the old one if helpful). The exit code is related to heap corruption, so it could be a bug in Gurobi. But it’s probably quite hard to debug if it happens only rarely in thousands of runs.