Bonmin + HSL?

Hi everyone,

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)

Any advice would be appreciated. Thank you.

1 Like

I haven’t tried using HSL through Bonmin_jll.

What’s the error? What happens if you use a .opt file?

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"

Questions

@odow Thank you for your comments and help.

Yes, I followed the instructions there and here’s my version info:

julia> versioninfo()
Julia Version 1.6.1
Commit 6aaedecc44 (2021-04-23 05:59 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.7.0)
  CPU: Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, skylake)
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS = 

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

  1. 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.
  2. 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

Try updating Ipopt (] up Ipopt) then restart Julia. (Or, just don’t go using Ipopt in your code.)

I released a new version a few days ago because it was doing some funky stuff with the LD_LIBRARY_PATH: GitHub - jump-dev/Ipopt.jl: Julia interface to the Ipopt nonlinear solver.

Oh, my bad. I should’ve checked the updates first. It works well with the updated version. Thank you so much!

1 Like

Great! Modulo the update, I’m very pleased Bonmin is easy to use from JuMP and getting some use!

1 Like

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!

1 Like