Skip to content

Latest commit

 

History

History
37 lines (32 loc) · 2.08 KB

casadi-ipopt-hsl.md

File metadata and controls

37 lines (32 loc) · 2.08 KB

How to install CasADi + IPOPT + HSL

This guide should help you to install CasADi with IPOPT and HSL support.

  1. Install some dependencies sudo apt-get install build-essential gfortran liblapack-dev libmetis-dev libopenblas-dev and remove the ipopt installed with apt to avoid conflicts with the one that you will install sudo apt-get remove coinor-libipopt-dev
  2. mkdir -p ~/robot-code/CoinIpopt && cd ~/robot-code/CoinIpopt
  3. Get coinbrew
    1. wget https://raw.githubusercontent.com/coin-or/coinbrew/master/coinbrew
    2. chmod u+x coinbrew
  4. Run ./coinbrew Ipopt and follow the instruction to fetch IPOPT and all the dependencies
  5. mkdir install
  6. Build ipopt ./coinbrew build Ipopt --prefix=install --test --no-prompt --verbosity=3 (have a ☕)
  7. Obtain an archive with HSL source code from http://www.hsl.rl.ac.uk/ipopt/. (That for example is named coinhsl-YYYY.MM.DD)
  8. Unzip the folder coinhsl-YYYY.MM.DD.zip into ~/robot-code/CoinIpopt/ThirdParty/HSL/ and rename it coinhsl.
  9. cd ~/robot-code/CoinIpopt
  10. Build ipopt ./coinbrew build Ipopt --prefix=install --test --no-prompt --verbosity=3 (have a ☕)
  11. Run ./coinbrew install Ipopt --no-prompt
  12. cd ~/robot-code/CoinIpopt/install/lib
  13. ln -s libcoinhsl.so libhsl.so
  14. Add to the .bashrc the following lines
    export IPOPT_DIR=~/robot-code/CoinIpopt/install
    export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:${IPOPT_DIR}/lib/pkgconfig
    export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${IPOPT_DIR}/lib
    
    # ipopt this is required for casadi
    export PATH=${PATH}:${IPOPT_DIR}/lib
    
    # this may speed up ipopt 
    export OMP_NUM_THREADS=1
  15. Clone CasADi cd ~/robot-code && git clone https://github.com/casadi/casadi.git
  16. mkdir -p casadi/build && cd casadi/build
  17. Run cmake -DWITH_IPOPT:BOOL=ON -DWITH_HSL:BOOL=ON -DINCLUDE_PREFIX:PATH=include -DCMAKE_PREFIX:PATH=lib/cmake/casadi -DLIB_PREFIX:PATH=lib -DBIN_PREFIX:PATH=bin ..
  18. make and make install
  19. Enjoy CasADi with IPOPT and HSL solvers 🚀