I’m trying to use the Bonmin solver with IPOPT+HSL. Can you take a look at the following example and let me know if there is anything that should be fixed? It works fine if I delete the linear_solver option and Ipopt+HSL works just fine as well.

using JuMP, Ipopt
using AmplNLWriter, Bonmin_jll
m = Model(() -> AmplNLWriter.Optimizer(Bonmin_jll.amplexe))
set_optimizer_attribute(m, "bonmin.nlp_solver", "Ipopt")
set_optimizer_attribute(m, "linear_solver", "ma86")
@variable(m, x <= 5)
@variable(m, y <= 45)
@objective(m, Max, x + y)
JuMP.optimize!(m)
termination_status(m)

Hi, I tested with bonmin.opt and it gives me the same error:

Bonmin 1.8.8 using Cbc 2.10.5 and Ipopt 3.13.4
bonmin:
Cbc3007W No integer variables - nothing to do
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): Symbol not found: __gfortran_os_error_at
Referenced from: /usr/local/lib//libhsl.dylib
Expected in: flat namespace
in /usr/local/lib//libhsl.dylib
"Aborted"
A failure has occured but no starting point exists
Ipopt exited with error code -12 Invalid option
OTHER_ERROR::TerminationStatusCode = 24

while the following Ipopt + HSL example works fine

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)

then I get

******************************************************************************
This program contains Ipopt, a library for large-scale nonlinear optimization.
Ipopt is released as open source code under the Eclipse Public License (EPL).
For more information visit https://github.com/coin-or/Ipopt
******************************************************************************
This is Ipopt version 3.13.4, running with linear solver ma86.
Number of nonzeros in equality constraint Jacobian...: 0
Number of nonzeros in inequality constraint Jacobian.: 0
Number of nonzeros in Lagrangian Hessian.............: 0
[...]
Total CPU secs in IPOPT (w/o function evaluations) = 0.297
Total CPU secs in NLP function evaluations = 0.039
EXIT: Optimal Solution Found.

This works for me on Mac (I tweaked the example to check that the integers were being handled correctly, and to ensure that Ipopt was needed to solve it, not just Cbc):

julia> using JuMP, AmplNLWriter, Bonmin_jll
julia> model = Model() do
AmplNLWriter.Optimizer(Bonmin_jll.amplexe)
end
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: EMPTY_OPTIMIZER
Solver name: AmplNLWriter
julia> set_optimizer_attribute(model, "bonmin.nlp_solver", "Ipopt")
"Ipopt"
julia> set_optimizer_attribute(model, "linear_solver", "ma86")
"ma86"
julia> @variable(model, x <= 5.4, Int)
x
julia> @variable(model, y <= 45)
y
julia> @NLobjective(model, Max, x - (x + y)^2)
julia> optimize!(model)
Bonmin 1.8.8 using Cbc 2.10.5 and Ipopt 3.13.4
bonmin: linear_solver=ma86
bonmin.nlp_solver=Ipopt
******************************************************************************
This program contains Ipopt, a library for large-scale nonlinear optimization.
Ipopt is released as open source code under the Eclipse Public License (EPL).
For more information visit https://github.com/coin-or/Ipopt
******************************************************************************
NLP0012I
Num Status Obj It time Location
NLP0014I 1 OPT -5.4000001 5 0.007621
NLP0014I 2 OPT -5 4 0.005226
NLP0014I 3 INFEAS -5 0 0
NLP0014I * 1 INFEAS -5 0 0 resolve robustness
NLP0014I 5 OPT -5 3 0.004068
NLP0012I
Num Status Obj It time Location
NLP0014I 1 OPT -5 8 0.00947
Cbc0004I Integer solution of -5 found after 3 iterations and 0 nodes (0.02 seconds)
Cbc0001I Search completed - best objective -5, took 3 iterations and 0 nodes (0.02 seconds)
Cbc0032I Strong branching done 1 times (4 iterations), fathomed 0 nodes and fixed 1 variables
Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost
"Finished"

I found two leads that might have something to do with this:

This happens on VS code - Julia REPL & VS code - terminal, but not on iTerm (terminal).
When I ran the toy code on iTerm, it worked.

In my error message, the directory has two slashes after /usr/local/lib

dlopen(libhsl.dylib, 2): Symbol not found: __gfortran_os_error_at
Referenced from: /usr/local/lib//libhsl.dylib
Expected in: flat namespace
in /usr/local/lib//libhsl.dylib

Yes, I should do that. It’s amazing to be able to switch among different solvers while using extremely intuitive JuMP syntax. Thank you for the great work!