Needs help on [IPOPT + coinhsl] installation

Hi, I would like to know a way to connect a linear solver other than MUMPS on Ipopt.

m = Model(Ipopt.Optimizer)
set_optimizer_attribute(m, "linear_solver", "ma86")
@variable(m, x <= 5)
@objective(m, Max, x)
JuMP.optimize!(m)

Error:

Exception of type: OPTION_INVALID in file "IpAlgBuilder.cpp" at line 349:
 Exception message: Selected linear solver HSL_MA86 not available.
Tried to obtain HSL_MA86 from shared library "libhsl.dylib", but the following error occured:
dlopen(libhsl.dylib, 2): image not found

EXIT: Invalid option encountered.

I downloaded “coinhsl” library but I don’t know how to connect this to the installed IPOPT.
Any guidance would be highly appreciated. Thank you!

See the discussion and instructions here: https://github.com/JuliaOpt/Ipopt.jl/issues/197.

1 Like

@odow Thank you so much! Your renaming solution worked for me:

Rename /usr/local/lib/libcoinhsl.dylib to /usr/local/lib/libhsl.dylib

1 Like

@odow I’ve been using IPOPT + HSL just fine thanks to your help.
As I’m switching to Julia 1.5 from 1.3, I’m having a very strange issue with IPOPT + HSL.

using JuMP, Ipopt
m = Model(Ipopt.Optimizer)
set_optimizer_attribute(m, "linear_solver", "ma86") 
@variable(m, x <= 5)
@variable(m, y <= 45)
@objective(m, Max, x + y)
JuMP.optimize!(m)

This works just fine on Julia v1.3, but Julia v1.5 gives me the following error:

Exception of type: OPTION_INVALID in file "IpAlgBuilder.cpp" at line 349:
 Exception message: Selected linear solver HSL_MA86 not available.
Tried to obtain HSL_MA86 from shared library "libhsl.dylib", but the following error occured:
dlopen(libhsl.dylib, 2): image not found

EXIT: Invalid option encountered.

This is very strange as Julia 1.3 does not have this issue on the same computer. And I do have libhsl.dylib in /usr/local/lib directory.

singingkim@Mac-mini:~$ find /usr/local/lib -name "*hsl.dylib"
/usr/local/lib/libcoinhsl.dylib
/usr/local/lib/libhsl.dylib

Do you have any idea where to look to fix this issue?

(@v1.5) pkg> status
Status `~/.julia/environments/v1.5/Project.toml`
  [a076750e] CPLEX v0.7.3
  [aaaa29a8] Clustering v0.14.2
  [a93c6f00] DataFrames v0.22.1
  [31c24e10] Distributions v0.24.4
  [1ca51c6a] GAMS v0.1.4
  [2e9cd046] Gurobi v0.9.3
  [7073ff75] IJulia v1.23.0
  [b6b21f68] Ipopt v0.6.3
  [4076af6c] JuMP v0.21.5
  [23992714] MAT v0.8.1
  [6405355b] Mosek v1.1.3
  [1ec41992] MosekTools v0.9.4
  [8bb1440f] DelimitedFiles
julia> versioninfo()
Julia Version 1.5.3
Commit 788b2c77c1 (2020-11-09 13:37 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.7.0)
  CPU: Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, skylake)

Do you have any idea where to look to fix this issue?

libhls.dylib needs to be on your load path. I guess Julia 1.5 changes in this regard.
You need to be able to run

using Libdl
dlopen("libhsl.dylib")

and have it return a non-null pointer.

See here for some instructions, although they don’t include MA86 yet (I don’t have, so I can’t test): https://github.com/jump-dev/Ipopt.jl#linear-solvers

I’ve opened this issue to track all the issues: https://github.com/jump-dev/Ipopt.jl/issues/247

Update: The problem on my mac is solved after adding the following line in “.bash_profile”
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib/"

I still don’t understand how this resolves the issue, but it works for Julia 1.4-1.6 (Julia 1.3 did not have the issue).
However, the issue remains when I run my codes on Atom REPL while VScode does not have the issue.