-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linking full hsl library to Ipopt.jl on ubuntu #342
Comments
You could try the following: using Libdl
Libdl.dlopen("ENTER_PATH_TO_liblapack.so.3", RTLD_GLOBAL) prior to your code snippet and do the same for following errors (i.e. if symbols related to other libraries are undefined). Not sure if that's the best/recommended way, but I think it might do the trick. |
Compiling the HSL libraries and getting everything linked can be finicky. If you have improvements to the instructions, please open a PR. |
I will make a PR, but let's see first if this works out :D |
@bennerh |
Thanks a lot, this solved the issue!
|
Do any of you see problems with this approach? |
At least on an hpc cluster, I encountered the same problem despite metis and lapack being on the load path. dlopen("liblapack.so.3", RTLD_GLOBAL) did the trick for me. |
Here's a sneak peek of some improvements that @amontoison has coming up (not released yet): julia> using JuMP
julia> import Ipopt
julia> import HSL_jll
julia> model = Model(Ipopt.Optimizer)
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: EMPTY_OPTIMIZER
Solver name: Ipopt
julia> set_attribute(model, "hsllib", HSL_jll.libhsl_path)
julia> set_attribute(model, "linear_solver", "ma97")
julia> @variable(model, x)
x
julia> @objective(model, Min, (x - 2)^2)
x² - 4 x + 4
julia> optimize!(model)
This is Ipopt version 3.14.4, running with linear solver ma97.
Number of nonzeros in equality constraint Jacobian...: 0
Number of nonzeros in inequality constraint Jacobian.: 0
Number of nonzeros in Lagrangian Hessian.............: 1
Total number of variables............................: 1
variables with only lower bounds: 0
variables with lower and upper bounds: 0
variables with only upper bounds: 0
Total number of equality constraints.................: 0
Total number of inequality constraints...............: 0
inequality constraints with only lower bounds: 0
inequality constraints with lower and upper bounds: 0
inequality constraints with only upper bounds: 0
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
0 4.0000000e+00 0.00e+00 4.00e+00 -1.0 0.00e+00 - 0.00e+00 0.00e+00 0
1 0.0000000e+00 0.00e+00 0.00e+00 -1.0 2.00e+00 - 1.00e+00 1.00e+00f 1
Number of Iterations....: 1
(scaled) (unscaled)
Objective...............: 0.0000000000000000e+00 0.0000000000000000e+00
Dual infeasibility......: 0.0000000000000000e+00 0.0000000000000000e+00
Constraint violation....: 0.0000000000000000e+00 0.0000000000000000e+00
Variable bound violation: 0.0000000000000000e+00 0.0000000000000000e+00
Complementarity.........: 0.0000000000000000e+00 0.0000000000000000e+00
Overall NLP error.......: 0.0000000000000000e+00 0.0000000000000000e+00
Number of objective function evaluations = 2
Number of objective gradient evaluations = 2
Number of equality constraint evaluations = 0
Number of inequality constraint evaluations = 0
Number of equality constraint Jacobian evaluations = 0
Number of inequality constraint Jacobian evaluations = 0
Number of Lagrangian Hessian evaluations = 1
Total seconds in IPOPT = 0.000
EXIT: Optimal Solution Found.
julia> set_attribute(model, "linear_solver", "ma57")
julia> optimize!(model)
This is Ipopt version 3.14.4, running with linear solver ma57.
Number of nonzeros in equality constraint Jacobian...: 0
Number of nonzeros in inequality constraint Jacobian.: 0
Number of nonzeros in Lagrangian Hessian.............: 1
Total number of variables............................: 1
variables with only lower bounds: 0
variables with lower and upper bounds: 0
variables with only upper bounds: 0
Total number of equality constraints.................: 0
Total number of inequality constraints...............: 0
inequality constraints with only lower bounds: 0
inequality constraints with lower and upper bounds: 0
inequality constraints with only upper bounds: 0
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
0 4.0000000e+00 0.00e+00 4.00e+00 -1.0 0.00e+00 - 0.00e+00 0.00e+00 0
1 0.0000000e+00 0.00e+00 0.00e+00 -1.0 2.00e+00 - 1.00e+00 1.00e+00f 1
Number of Iterations....: 1
(scaled) (unscaled)
Objective...............: 0.0000000000000000e+00 0.0000000000000000e+00
Dual infeasibility......: 0.0000000000000000e+00 0.0000000000000000e+00
Constraint violation....: 0.0000000000000000e+00 0.0000000000000000e+00
Variable bound violation: 0.0000000000000000e+00 0.0000000000000000e+00
Complementarity.........: 0.0000000000000000e+00 0.0000000000000000e+00
Overall NLP error.......: 0.0000000000000000e+00 0.0000000000000000e+00
Number of objective function evaluations = 2
Number of objective gradient evaluations = 2
Number of equality constraint evaluations = 0
Number of inequality constraint evaluations = 0
Number of equality constraint Jacobian evaluations = 0
Number of inequality constraint Jacobian evaluations = 0
Number of Lagrangian Hessian evaluations = 1
Total seconds in IPOPT = 0.001
EXIT: Optimal Solution Found. I think this should resolve all of our HSL problems. |
Have HSL changed their license? They never allowed binary redistribution except for the newest SPRAL solver, as far as I remember. |
Nop but we can create artifacts without Yggdrasil 😉 |
Yeah the plan is that it'll require a manual (licensed) download of That means that we're downloaded compiled binaries, so we never have to compile on a user's machine. |
The downloading of compiled binaries is what I meant by binary redistribution, which I always thought was disallowed by the HSL license. https://licences.stfc.ac.uk/product/coin-hsl
|
It'll be an official download from |
No, the license just says that you can't distribute the HSL package under any form. But for you own application on your computer you can do what you want with it. Until now it was only possible to download the source code. The new package will have the source files and precompiled versions (under a user-friendly form for Julia users) but as before it must be only available for you. |
If it's the HSL people hosting the download as an official part of what they license people to obtain directly from them, that works. Anyone other than them putting the files up somewhere else like on github releases wouldn't be allowed without some special arrangement that gets around that distribution prohibition. |
Yes, this is the plan. @amontoison has been working with them directly. |
I'm going to close this in favor of #247 for now. The underlying problem in this issue was an upstream issue with the HSL |
@tkelman @bennerh @LukasBarner |
This is pretty cool!! 🎉 🎉 |
Hi everyone,
I tried to add the full hsl library to Ipopt on a clean ubuntu following the ubuntu specific instructions on from here. However, running a basic optimization problem
Leads to the following error message
Other linear solver attributes as "ma57" lead to the same message.
I tried installation on both Ubuntu 18.04 and 20.04, using Ipopt version 1.1.0 and JuMP version 1.4.0
Are there any ideas of what I might have forgotten? Thanks a lot in advance!
The text was updated successfully, but these errors were encountered: