1.IPOPT安裝
1.1安裝所需功能包
sudo apt-get install cppad
sudo apt-get install gcc g++ gfortran subversion patch wget
1.2下載最新源代碼3.14
https://www.coin-or.org/download/source/Ipopt/
1.3解壓進入IPOPT安裝包,下載ASL
git clone https://github.com/coin-or-tools/ThirdParty-ASL.git
1.4安裝ASL
sudo ./get.ASL
sudo ./configure
注:若出現error: Something went wrong bootstrapping makefile fragments
for automatic dependency tracking.
原因:沒有安裝make
解決:
sudo apt install make
sudo make
sudo make install
cd ..
1.5安裝HSL
git clone https://github.com/coin-or-tools/ThirdParty-HSL.git
cd ThirdParty-HSL
接下來需要下載coinhsl文件,并解壓到ThirdParty-HSL目錄下
https://github.com/CHH3213/testCPP/blob/master/coinhsl.zip
sudo ./configure
注:若出現configure: error: “Cannot check for existence of module lapack without pkgconf”
解決:
sudo apt install pkg-config
注:然后出現configure: error: Required package LAPACK not found.
解決:安裝LAPACK
(1)下載LAPACK
https://www.netlib.org/lapack/
tar -zxvf lapack-3.9.0.tar.gz
(2)
mkdir build
(3)
cd build
(4)
cp ../make.inc.example make.inc
(5)
sudo cmake ..
(6)
sudo cmake --build . --target install
或者
sudo apt-get install libblas-dev liblapack-dev
sudo make
sudo make install
cd ..
1.6安裝MUMPS
git clone https://github.com/coin-or-tools/ThirdParty-Mumps.git
cd ThirdParty-Mumps
sudo ./get.Mumps
sudo ./configure
sudo make
sudo make install
cd ..
1.7安裝IPOPT
mkdir build
cd build
sudo ../configure
sudo make
sudo make test
sudo make install
1.8測試
cd Ipopt/build/examples/Cpp_example
sudo make
./cpp_example
1.9后續問題/usr/include/coin/IpSmartPtr.hpp:19:4: error: #error “don’t have header file for stddef”
2.0安裝ipopt依賴
sudo apt-get install coinor-libipopt-dev
cd casadi-3.5.5.1
mkdir build && cd build
cmake .. -DWITH_IPOPT=ON -DWITH_EXAMPLES=OFF
make -j4
sudo make install
sudo ldconfig
參考
https://blog.csdn.net/weixin_42301220/article/details/127946528