現代,輕巧,基於特徵的C ++接口,用於非線性編程求解器,例如IPOPT和SNOPT。
一個示例要解決的非線性優化問題定義為:
功能•安裝•示例•貢獻•出版物•作者
結合了ipopt / snopt和eigen的優勢:
| ipopt / snopt | 特徵 |
|---|---|
| ✔資用非線性優化的高質量求解器 | ✔️矢量和矩陣的現代,直觀的配方 |
| C ++ API不便和容易出錯(原始指針,索引管理,Jacobian Construction) | ✔️高效實施 |
| 鏈接和導出困難 |
find_package(ifopt)或CATKIN/ROS(可選)優化問題由多個自變量和約束集組成。每組代表一個共同的概念,例如,一組變量可能代表樣條係數,另一個腳步位置。同樣,約束集組相似的約束。 ifopt允許用戶在單獨的類中獨立定義這些集合,然後從這些集合中構建總體問題。 (在添加或刪除集合時不再擔心適應索引)。
find x0, x1 (variable-sets 0 & 1)
s.t
x0_lower <= x0 <= x0_upper (bounds on variable-set x0 in R^2)
{x0,x1} = arg min c0(x0,x1)+c1(x0,x1) (cost-terms 0 and 1)
g0_lower < g0(x0,x1) < g0_upper (constraint-set 0 in R^2)
g1_lower < g1(x0,x1) < g0_upper (constraint-set 1 in R^1)
提供導數信息大大提高了解決方案速度。 ifopt允許獨立相對於每個變量集定義每個成本計數/約束集的衍生物。這樣可以確保當變量集的總體矢量發生變化時,此派生信息仍然有效。這些“ Jacobian塊”必須通過ConstraintSet::FillJacobianBlock()提供,然後用於為成本和約束構建完整的Jacobian。
在這裡可以看到圖形概述。
最簡單的安裝方法是通過ROS二進制裝置,您都設置了!
sudo apt-get install ros-<distro>-ifopt
如果您不使用ROS或不存在二進製文件的發行版,則可以輕鬆地從源構建這些軟件包。為此,使用所需的依賴項CMAKE,EIGEN和IPOPT使用
sudo apt-get install cmake libeigen3-dev coinor-libipopt-dev
如果要鏈接到IPOPT的本地安裝或SNOPT,請參見此處。
安裝
git clone https://github.com/ethz-adrl/ifopt.git && cd ifopt
mkdir build && cd build
cmake ..
make
sudo make install # copies files in this folder to /usr/local/*
# sudo xargs rm < install_manifest.txt # in case you want to uninstall the above使用:要在您的CMAKE項目中使用,請參閱此最小CMakelists.txt :
find_package (ifopt)
# Formulate (ifopt:ifopt_core) and solve (ifopt::ifopt_ipopt) the problem
add_executable (main main.cpp)
# Pull in include directories, libraries, ...
target_link_libraries (main PUBLIC ifopt::ifopt_ipopt) 安裝:下載Catkin或Catkin命令行工具,然後:
cd catkin_ws/src
git clone https://github.com/ethz-adrl/ifopt.git
cd ..
catkin_make_isolated # `catkin build` if you are using catkin command-line tools
source ./devel/setup.bash使用:通過添加到您的cmakelists.txt中包括在catkin項目中
add_compile_options (-std=c++11)
find_package (catkin COMPONENTS ifopt)
include_directories ( ${catkin_INCLUDE_DIRS} )
target_link_libraries (foo ${catkin_LIBRARIES} )將以下內容添加到您的軟件包.xml :
< package >
< depend >ifopt</ depend >
</ package >導航到Makefile所在的構建文件夾,這取決於您構建代碼的方式:
cd ifopt/build # plain cmake
cd catkin_ws/build_isolated/ifopt/devel # catkin_make_isolated
cd catkin_ws/build/ifopt # catkin build通過運行test目標確保正確安裝了所有內容
make test您應該查看ifopt_ipopt-example....Passed (或SNOPT)以及ifopt_core-test 。
如果您正確安裝了IPOPT並鏈接了,也可以直接運行二進制示例(再次,首先導航到使用Makefile的構建文件夾)
make test ARGS= ' -R ifopt_ipopt-example -V '輸出:
1.0 0.0從TOWR中提取的一個更涉及的問題,具有多組變量和約束,以生成腿部機器人的動議,從而產生以下內容:
我們喜歡拉動請求,無論是與其他求解器的接口,錯誤修復,單元測試還是更新文檔。請查看貢獻.md以獲取更多信息。請參閱此處參與該項目的貢獻者列表。
如果您使用這項工作,請考慮以下引用:
@misc{ifopt,
author = {Alexander W Winkler},
title = {{Ifopt - A modern, light-weight, Eigen-based C++ interface to
Nonlinear Programming solvers Ipopt and Snopt.}},
year = 2018,
doi = {10.5281/zenodo.1135046},
url = {https://doi.org/10.5281/zenodo.1135046}
}
開發該代碼的研究項目:
亞歷山大·W·溫克勒(Alexander W. Winkler) - 初始工作/維護者
這是在以下機構進行的:
如果您是從源構建的,並且想使用iPOPT本地安裝的版本添加到您的ipopt build文件夾的路徑到~/.bashrc ,例如
export IPOPT_DIR=/home/your_name/Code/Ipopt-3.12.8/build如果您的操作系統不提供預編譯的二進製文件或所需的版本,則也可以輕鬆地從源中安裝IPOPT,如下所述。該摘要可能對您有用:
wget https://www.coin-or.org/download/source/Ipopt/Ipopt-3.11.10.zip
unzip Ipopt-3.11.10.zip
cd Ipopt-3.11.10/ThirdParty/Mumps
./get.Mumps # HSL routines are faster (http://www.hsl.rl.ac.uk/ipopt/)
cd ../../
mkdir build && cd build
../configure --prefix=/usr/local
make
make test
make install
export IPOPT_DIR= ` pwd `如果您需要一個接口來snopt,請通過EG指向~/.bashrc中的構建文件夾
export SNOPT_DIR=/home/your_name/Code/Snopt並運行cmake
cmake -DBUILD_SNOPT=ON ..