HSL tutorial

This tutorial shows how to use the HSL routine MA57 as the linear solver of Penelopt.jl.

Code not executed

The HSL libraries require a license, so the code on this page is not run when the documentation is built.

Extensions

Penelopt.jl uses an extension to load MA57 through HSL.jl. Therefore, you need to load HSL.jl, together with a functional HSL_jll. Our algorithm will throw a warning and switch to the default MUMPS solver if you try to use MA57 without them.

1. Install HSL_jll and HSL.jl

HSL_jll.jl is not available from the General registry. Obtain it from https://licences.stfc.ac.uk/product/libhsl (free for academic use), unpack it, and add it to your environment together with HSL.jl:

using Pkg
Pkg.develop(path = "/full/path/to/HSL_jll.jl")
Pkg.add("HSL")

See the HSL.jl documentation for details.

2. Load HSL

using HSL_jll
using HSL

HSL.LIBHSL_isfunctional()  # should return true

3. Solve with Penelopt

Any AbstractNLPModel works; here we use a CUTEst problem.

using CUTEst, Penelopt

nlp = CUTEstModel("MSS1")
stats = L2Penalty(nlp; linear_solver = "ma57", print_level = 1)

println("status    : ", stats.status)
println("objective : ", stats.objective)

finalize(nlp)
How To Check?

You can verify that MA57 is correctly being used by inspecting the output of the solver with the option print_level > 1.