ifopt

所属分类:自然语言处理
开发工具:C++
文件大小:177KB
下载次数:0
上传日期:2022-11-25 12:18:55
上 传 者sh-1993
说明:  ifopt,一个基于特征的轻量级C++接口,用于非线性编程求解器(Ipopt,Snopt)
(ifopt,An Eigen-based, light-weight C++ Interface to Nonlinear Programming Solvers (Ipopt, Snopt))

文件列表:
CHANGELOG.rst (5348, 2022-09-15)
CMakeLists.txt (3302, 2022-09-15)
CODE_OF_CONDUCT.md (3226, 2022-09-15)
CONTRIBUTING.md (2437, 2022-09-15)
LICENSE (1520, 2022-09-15)
doc (0, 2022-09-15)
doc\example_nlp.png (6276, 2022-09-15)
doc\ifopt.png (100392, 2022-09-15)
doc\mainpage.md (359, 2022-09-15)
doc\manifest.yaml (703, 2022-09-15)
doc\rosdoc.yaml (142, 2022-09-15)
ifopt-config.cmake (1985, 2022-09-15)
ifopt_core (0, 2022-09-15)
ifopt_core\CMakeLists.txt (1779, 2022-09-15)
ifopt_core\cmake (0, 2022-09-15)
ifopt_core\cmake\FindEigen3.cmake (3501, 2022-09-15)
ifopt_core\cmake\FindGTest.cmake (9687, 2022-09-15)
ifopt_core\include (0, 2022-09-15)
ifopt_core\include\ifopt (0, 2022-09-15)
ifopt_core\include\ifopt\bounds.h (2624, 2022-09-15)
ifopt_core\include\ifopt\composite.h (8086, 2022-09-15)
ifopt_core\include\ifopt\constraint_set.h (5649, 2022-09-15)
ifopt_core\include\ifopt\cost_term.h (2723, 2022-09-15)
ifopt_core\include\ifopt\problem.h (10025, 2022-09-15)
ifopt_core\include\ifopt\solver.h (2687, 2022-09-15)
ifopt_core\include\ifopt\variable_set.h (2637, 2022-09-15)
ifopt_core\src (0, 2022-09-15)
ifopt_core\src\composite.cc (5887, 2022-09-15)
ifopt_core\src\leaves.cc (3903, 2022-09-15)
ifopt_core\src\problem.cc (6078, 2022-09-15)
ifopt_core\test (0, 2022-09-15)
ifopt_core\test\composite_test.cc (4318, 2022-09-15)
ifopt_core\test\ifopt (0, 2022-09-15)
ifopt_core\test\ifopt\test_vars_constr_cost.h (6438, 2022-09-15)
ifopt_core\test\problem_test.cc (6692, 2022-09-15)
ifopt_ipopt (0, 2022-09-15)
ifopt_ipopt\CMakeLists.txt (1809, 2022-09-15)
... ...

### [![Build Status](http://build.ros.org/buildStatus/icon?job=Kdev__ifopt__ubuntu_xenial_amd***)](http://build.ros.org/view/Kdev/job/Kdev__ifopt__ubuntu_xenial_amd***/) [![Documentation](https://img.shields.io/badge/docs-generated-brightgreen.svg)](http://docs.ros.org/api/ifopt/html/) [![ROS integration](https://img.shields.io/badge/ROS-integration-blue.svg)](http://wiki.ros.org/ifopt) ![](https://tokei.rs/b1/github/ethz-adrl/ifopt?category=code) [![CodeFactor](https://www.codefactor.io/repository/github/ethz-adrl/ifopt/badge)](https://www.codefactor.io/repository/github/ethz-adrl/ifopt) [![License BSD-3-Clause](https://img.shields.io/badge/license-BSD--3--Clause-blue.svg)](https://tldrlegal.com/license/bsd-3-clause-license-%28revised%29#fulltext) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1135046.svg)](https://doi.org/10.5281/zenodo.1135046) *A modern, light-weight, [Eigen]-based C++ interface to Nonlinear Programming solvers, such as [Ipopt] and [Snopt].* An example nonlinear optimization problem to solve is defined as: * To see how this problem is formulated, see [*test_vars_constr_cost.h*](ifopt_core/test/ifopt/test_vars_constr_cost.h). * Afterwards the problem can be solved using e.g. Ipopt as shown in [*ex_test_ipopt.cc*](ifopt_ipopt/test/ex_test_ipopt.cc).

Features Install Examples Contribute Publications Authors

## Features *Combines* the advantages of [Ipopt] / [Snopt] and [Eigen]: [Ipopt] / [Snopt] | [Eigen] ----------|--------- :heavy_check_mark: high-quality solvers for nonlinear optimization | :heavy_check_mark: modern, intuitive formulations of vectors and matrices :x: C++ API inconvenient and error-prone (raw pointers, index management, jacobian construction) | :heavy_check_mark: highly efficient implementations :x: linking and exporting difficult | * Solver independent formulation of variables and constraints with Eigen (highly efficient) * Automatic index management by formulation of [variable- and constraint-sets](http://docs.ros.org/api/ifopt/html/group__ProblemFormulation.html) * Integration: pure cmake `find_package(ifopt)` or [catkin]/[ROS] (optional) * light-weight (~[2k lines of code](https://i.imgur.com/NCPJsSw.png)) makes it easy to use and extend
An optimization problem consists of multiple *independent variable- and constraint-sets*. Each set represents a common concept, e.g. a set of variables might represents spline coefficients, another footstep positions. Similarly, a constraint-set groups similar constraints together. `ifopt` allows users to define each of these sets independently in separate classes and then builds the overall problem from these sets. (No more worrying adapting indices when adding or removing sets).
``` 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) ```
Supplying derivative information greatly increases solution speed. `ifopt` allows to define the derivative of each cost-term/constraint-set with respect to each variable-set *independently*. This ensures that when the order of variable-sets changes in the overall vector, this derivative information is still valid. These "Jacobian blocks" must be supplied through ``ConstraintSet::FillJacobianBlock()`` and are then used to build the complete Jacobian for the cost and constraints.
A graphical overview as UML can be seen [here](http://docs.ros.org/api/ifopt/html/inherits.html). ## Install The easiest way to install is through the [ROS binaries](http://wiki.ros.org/ifopt) and you're all set! ``` sudo apt-get install ros--ifopt ``` #### Install dependencies In case you don't use ROS or the binaries don't exist for your distro, you can easily build these packages from source. For this, install the required dependencies [Cmake], [Eigen] and [Ipopt] using ``` sudo apt-get install cmake libeigen3-dev coinor-libipopt-dev ``` If you want to link to a local installation of [Ipopt] or to [Snopt], see [here](#additional-information). #### Build with cmake * Install ```bash 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 ``` * Use: To use in your cmake project, see this minimal *CMakeLists.txt*: ```cmake 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) ``` #### Build with catkin * Install: Download [catkin] or [catkin command line tools], then: ```bash 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 ``` * Use: Include in your catkin project by adding to your *CMakeLists.txt* ```cmake add_compile_options(-std=c++11) find_package(catkin COMPONENTS ifopt) include_directories(${catkin_INCLUDE_DIRS}) target_link_libraries(foo ${catkin_LIBRARIES}) ``` Add the following to your *package.xml*: ```xml ifopt ``` ## Examples #### Unit tests & toy problem Navigate to your build folder in which the `Makefile` resides, which depends on how you built the code: ```bash cd ifopt/build # plain cmake cd catkin_ws/build_isolated/ifopt/devel # catkin_make_isolated cd catkin_ws/build/ifopt # catkin build ``` Make sure everything installed correctly by running the `test` target ```bash make test ``` You should see `ifopt_ipopt-example....Passed` (or snopt if installed) as well as `ifopt_core-test` if [gtest] is installed. If you have IPOPT installed and linked correctly, you can also run the [binary example](ifopt_ipopt/test/ex_test_ipopt.cc) directly (again, first navigate to the build folder with the `Makefile`) ```bash make test ARGS='-R ifopt_ipopt-example -V' ``` Output: ```bash 1.0 0.0 ``` #### towr A more involved problem, taken from [towr], with multiple sets of variables and constraints to generate motions for legged robots produces the following: ## Contribute We love pull request, whether its interfaces to additional solvers, bug fixes, unit tests or updating the documentation. Please have a look at [CONTRIBUTING.md](CONTRIBUTING.md) for more information. See here the list of [contributors](https://github.com/ethz-adrl/ifopt/graphs/contributors) who participated in this project. ## Publications If you use this work, please consider citing as follows: @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} } The research project within which this code was developed: * A. W. Winkler, D. Bellicoso, M. Hutter, J. Buchli, [Gait and Trajectory Optimization for Legged Systems through Phase-based End-Effector Parameterization](http://awinkler.me), IEEE Robotics and Automation Letters (RA-L), 2018: ## Authors [Alexander W. Winkler](https://www.alex-winkler.com) - Initial Work/Maintainer This was has been carried out at the following institutions: [](https://www.ethz.ch/en.html "ETH Zurich")         [](http://www.adrl.ethz.ch/doku.php "Agile and Dexterous Robotics Lab")        [](http://www.rsl.ethz.ch/ "Robotic Systems Lab") ## Additional Information #### Linking to custom Ipopt or Snopt If you are building from source and want to use a locally installed version of [Ipopt] add the path to your Ipopt build folder to your `~/.bashrc`, e.g. ```bash export IPOPT_DIR=/home/your_name/Code/Ipopt-3.12.8/build ``` In case your OS doesn't provide the precompiled binaries or the required version, you can also easily install Ipopt from source as described [here](https://www.coin-or.org/Ipopt/documentation/node14.html). This summary might work for you: ```bash 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` ``` If you need an interface to [Snopt], point cmake to that build folder in your `~/.bashrc` through e.g. ```bash export SNOPT_DIR=/home/your_name/Code/Snopt ``` and run cmake as ```bash cmake -DBUILD_SNOPT=ON .. ``` [CMake]: https://cmake.org/cmake/help/v3.0/ [Eigen]: http://eigen.tuxfamily.org [Ipopt]: https://projects.coin-or.org/Ipopt [Snopt]: http://ampl.com/products/solvers/solvers-we-sell/snopt/ [catkin]: http://wiki.ros.org/catkin/Tutorials/create_a_workspace [catkin command line tools]: http://catkin-tools.readthedocs.io/en/latest/installing.html [towr]: https://github.com/ethz-adrl/towr [catkin tools]: http://catkin-tools.readthedocs.org/ [ROS]: http://www.ros.org [rviz]: http://wiki.ros.org/rviz [gtest]: https://github.com/google/googletest

近期下载者

相关文件


收藏者