GithubHelp home page GithubHelp logo

fbiemueller / ifopt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ethz-adrl/ifopt

0.0 0.0 0.0 322 KB

An Eigen-based, light-weight C++ Interface to Nonlinear Programming Solvers (Ipopt, Snopt)

Home Page: http://wiki.ros.org/ifopt

License: BSD 3-Clause "New" or "Revised" License

CMake 24.38% C++ 75.62%

ifopt's Introduction

Build Status Documentation ROS integration CodeFactor License BSD-3-Clause DOI

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:

Related variables and constraints are implemented (grouped) in independent sets. Ifopt automatically generates the overall problem from these sets. No more changing indices in your variable vector or Jacobian when adding or removing variables/constraints. See this large problem, that requires multiple variable- and constraint sets to generate the motion for legged robot (implemented in towr).

More Features:
✔️ Eigen allows inuitive formulation and fast performance due to sparse matrix exploitation.
✔️ exports cmake scripts to easily find_package(ifopt) in your project.
✔️ catkin integration (optional).
✔️ light-weight (~2k lines of code) makes it easy to use and extend.

Dependencies

Name Min. Ver. Description Install
CMake v3.1.0 C++ build tool sudo apt-get install cmake (upgrade)
Eigen v3.2.0 Library for linear algebra sudo apt-get install libeigen3-dev
Ipopt v3.11.9 NLP solver (Interior-Point) sudo apt-get install coinor-libipopt-dev
(Snopt) 7.4 NLP solver (SQP) non-free

Quick Install:

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 the doxygen documentation.

Building with cmake

  • Install

    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:

    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) 

Building with catkin

  • Install: Download catkin or catkin command line tools, then:

    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

    find_package(catkin COMPONENTS ifopt) 
    include_directories(${catkin_INCLUDE_DIRS})
    target_link_libraries(foo ${catkin_LIBRARIES})

    Add the following to your package.xml:

    <package>
      <depend>ifopt</depend>
    </package>

Test

Navigate to your build folder in which the Makefile resides, which depends on how you built the code:

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

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 directly (again, first navigate to the build folder with the Makefile)

make test ARGS='-R ifopt_ipopt-example -V'

Output:

1.0 0.0

Each set of variables, costs and constraints are formulated by one C++ object purely through Eigen vectors and matrices and independent from any specific solver. Although the above example adds just one, multiple sets of variables or constraints can be added to the NLP and ifopt manages the overall variable vector and jacobian, so each set can be implemented independent of the others. A more involved problem definition with multiple sets of variables and constraints, taken from towr can be seen in the following:

Authors

Alexander W. Winkler - Initial Work/Maintainer

This was has been carried out at the following institutions:

               

Publications

If you use this work in an academic context, please consider citing the currently released version as shown here or 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, IEEE Robotics and Automation Letters (RA-L), 2018:

  @article{winkler18,
    author    = {Winkler, Alexander W and Bellicoso, Dario C and 
                 Hutter, Marco and Buchli, Jonas},
    title     = {Gait and Trajectory Optimization for Legged Systems 
                 through Phase-based End-Effector Parameterization},
    journal   = {IEEE Robotics and Automation Letters (RA-L)},
    year      = {2018},
    month     = {July},
    pages     = {1560-1567},
    volume    = {3},
    doi       = {10.1109/LRA.2018.2798285},
  }

Contributing

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 for more information. See here the list of contributors who participated in this project.

Bugs & Feature Requests

To report bugs, request features or ask questions, please have a look at CONTRIBUTING.md.

ifopt's People

Contributors

awinkler avatar depardo avatar traversaro avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.