Using OMG-tools I wish to run an example with an HSL solver, such as the ma57
used in compare_distributed_optimization_quadrotors.py.
Firstly I installed OMG-tools using pip
, which also automatically installs Casadi and Ipopt. I then followed the Casadi tutorial to build HSL from source, where I can confirm that the package got installed in /usr/local/lib
, but when running OMG-tools' example, I always get Invalid_Option
for the selected solver. I added both the link and the environmental variable mentioned in the tutorial.
Are there any additional steps needed to set up HSL with Ipopt on my system, that I need to follow?
My system is running Ubuntu 16.04.
I got it running. Hopefully this short guide/advice will come in handy to someone else, apart from my future self.
First of all, when you declare a new problem
in OMG-tools, the options
syntax should look something like this:
options = {'horizon_time': horizon_time, 'solver_options': {'ipopt':{'ipopt.linear_solver': 'ma57'}}};
If you get a the error Invalid_Option
printed out in the terminal on each update_time
, the ipopt
command wasn't recognized.
If the program exits stating, a problem with the ma57
solver, then HSL is installed, only it can't find the correct solver - you have probably got the Archive version of HSL.
To install go to the Casadi guide on obtaining HSL follow the first option, building from source. Note, instead of libblas3gf
and liblapack3gf
, you can also use libblas3
and liblapack3
. Once that is done, you need to obtain HSL. Download the source code of one of the two packages (RC, stable) accessed using the academic license. At this step you need to fill out some forms and wait a daz or two to receive a link to the download files.
After you have prepared the environment and downloaded all the necessary files, run the configuration as described in the guide, where I recommend using the /usr/local
, which will in terms install the package in /usr/local/lib
:
$> ./configure --prefix=(where_you_want_to_install) LIBS="-llapack" --with-blas="-L/usr/lib -lblas" CXXFLAGS="-g -O2 -fopenmp" FCFLAGS="-g -O2 -fopenmp" CFLAGS="-g -O2 -fopenmp"
After configuring, run make and (sudo) install. Lastly, add /usr/local/lib
to $LD_LIBRARY_PATH
. Make sure the path is valid by echoing it to the terminal.
Now both ma27
and ma57
solvers should work. Form more information on which solvers and how you can use them, go to http://www.hsl.rl.ac.uk/.
PS: Each Coin-HSL
package has a README of its own. Furthermore you can run configure --help
to understand the command itself. Make sure to read both, if you encounter any problems during installation.