Difference between revisions of "Installing IPOPT"

From Wiki for iCub and Friends
Jump to: navigation, search
(Binary distributions)
Line 11: Line 11:
== Binary distributions ==
== Install from binaries distribution==
* Windows. MSVC users can download a precompiled version of IpOpt; this version is compatible with YARP (compiled with Multi-threaded DLL switch enabled and packed using lib command). Further, '''IpOpt binaries distributed with MUMPS need to have the bin subdirectory (containing some Fortran DLL) within the path'''.
** [http://www.icub.org/download/packages/windows Windows distribution]
* Linux. Compiling IpOpt on Linux is easy. If you really want to download precompiled versions, pick the version that matches your system; some are available from the IpOpt official web site, some are provided by us. However, remember that '''the use of precompiled versions tends to generate unexpected results such as compilation errors''', since the match between your machine and the machine where that version has been produced is likely to be not exact.
=== Windows ===
** [http://www.coin-or.org/download/binary/Ipopt/ Linux distribution].
Ipopt can be easily installed via [https://docs.microsoft.com/en-us/cpp/build/vcpkg?view=vs-2019#installation vcpkg]:
** [http://www.icub.org/download/packages/linux Linux distribution (more)].
  ./vcpkg.exe --overlay-ports=<repo_parent_directory>/robotology-vcpkg-binary-ports install ipopt-binary:x64-windows
Remember to set the environment variable '''IPOPT_DIR''' pointing to the local directory where you have installed the libraries.
=== Linux ===
Just type:
  sudo apt install coinor-libipopt-dev
=== macOS ===
Ipopt can be easily installed via [https://docs.brew.sh/Installation homebrew]:
  brew install ipopt
== Compiling IpOpt ==
== Compiling IpOpt ==

Revision as of 12:04, 12 June 2020

IpOpt is an open-source tool from COIN-OR project for nonlinear constrained optimization. It is required to install it in order to enable IpOpt-based features of iKin library.

IpOpt can be installed as iCub dependency, as stand-alone binaries, or compiled by getting the sources directly from the web. See below.

iCub dependency

Visit the iCub Software Installation page and follow the guide for installing from sources: this way you will get IpOpt installed as a dependency.

Let us enforce that INSTALLING IPOPT AS A DEPENDENCY IS THE RECOMMENDED SOLUTION, which minimizes how package maintenance impacts your system.

Install from binaries distribution


Ipopt can be easily installed via vcpkg:

 ./vcpkg.exe --overlay-ports=<repo_parent_directory>/robotology-vcpkg-binary-ports install ipopt-binary:x64-windows


Just type:

 sudo apt install coinor-libipopt-dev


Ipopt can be easily installed via homebrew:

 brew install ipopt

Compiling IpOpt

You can compile the library yourself. Visit the IpOpt web site, download the source code archive (we support releases from 3.5.4 onward) and follow the documentation to compile it carefully. Among all the possible sparse symmetric linear solvers IpOpt can rely on, we suggest to use MUMPS: it is fully open source and it turns to be suitable for our needs. Moreover, if you are a linux user, make sure that the package gfortran is installed.

Hint: to check whether IpOpt is working along with iKin framework, compile and execute the examples located under the iKin tutorials directory: if the IpOpt banner is displayed when the examples are launched then IpOpt is correctly configured.

Hereafter a simple list is given resuming all the basic steps you need to compile IpOpt under Linux:

  1) do "sudo apt-get install gfortran" (if you do not have it yet)
  2) download IpOpt source code and put it wherever you like; call this location IPOPT_DWN_DIR
  3) "cd $IPOPT_DWN_DIR/ThirdParty/Blas" and launch "./get.Blas"
  4) "cd $IPOPT_DWN_DIR/ThirdParty/Lapack" and launch "./get.Lapack"
  5) "cd $IPOPT_DWN_DIR/ThirdParty/MUMPS" and launch "./get.Mumps"
  6) "cd $IPOPT_DWN_DIR/ThirdParty/Metis" and launch "./get.Metis"
  7) "cd $IPOPT_DWN_DIR/ThirdParty/ASL" and launch "./get.ASL"
  8) create a build directory wherever you like; call this location IPOPT_DIR and export it from within .bashrc
  9) "cd $IPOPT_DIR" and launch "$IPOPT_DWN_DIR/configure"
 10) launch "make"
 11) launch "make test"
 12) launch "make install"

Should you experience problems while downloading third-party code (e.g. Blas, Lapack), please replace the ftp protocol with http for the source address within the corresponding scripts (e.g. get.Blas, get.Lapack). For example: ftp://www.netlib.org/[...] becomes http://www.netlib.org/[...].

If, for any reason, the MUMPS package cannot be downloaded straightaway through the script, you need then to sign in here to receive the link to the archive via e-mail. Select options "Real, Symmetric" while submitting your request. Once got it (it takes a few minutes to receive the link), put the archive in "$IPOPT_DWN_DIR/ThirdParty/MUMPS" and proceed with the operations reported within the get.Mumps script (i.e. gunzip, tar, rm, mv).