/solnp

C++ implementation of the SQP algorithm SOLNP, utilizing Lagrangian Relaxation to handle both Inequality and Equality constraint functions. Good for solving constrained objective functions on convex surfaces.

Primary LanguageC++OtherNOASSERTION

Python/C++ SOLNP

This is a C++ implementation of the SOLNP algorithm by Yinyu Ye (1989) with Python Wrappers. The algorithm was originally implemented in Matlab, and have gained some fame through it's R implementation (RSOLNP). Various implementations of the algorithm exists already, however, this version utilizes the power of DLIB and C++11.

This algorithm solves the general nonlinear optimization problem on the form:

    minimize f(x)
      subject to
       g(x) = 0
   l_h <= h(x) <= u_x
   l_x <=  x   <= u_X

where f(x), g(x) and h(x) are smooth functions.

Getting Started in Python

Simply install the package: pip install pysolnp
See the /python_examples folder for examples.

Getting Started in C++

The files are header-only and only rely on dlib. Import solnp.hpp and call the solnp function.
See the /test folder for examples.

Prerequisites

The sources for all prerequisites are downloaded by the CMake script when run. These are:

  • pybind11 - Bindings for C++ to Python
  • dlib - A c++ mathematical library
  • catch2 (for tests) - A testing library

Running the tests

Run the tests solnp_test using CMake.

CI and building Wheels

This project uses CI to automatically build wheels for a wide range of distributions. Notably currently only builds for CPython are available on PyPi, but one can also manually installing the package from source as explained above.

Appveyor CI:

  • Windows with Visual Studio
  • Mac OS with Clang

Travis CI:

  • manylinux2014 Docker with GCC

Built With

Libraries:

  • dlib - C++ math library
  • pybind11 - Bindings for building Python Wheels with c++11
  • manylinux - Docker images for building Linux wheels

Tools:

  • CMake - Build tools
  • CLion - IDE by JetBrains
  • Travis CI - Travis CI for building Manylinux Wheels
  • Appveyor CI - Appveyor CI for building Windows and Mac OS Wheels

Authors

License

This project is licensed under the Boost License - see the license file for details

Acknowledgments

  • Yinyu Ye - Publisher and mastermind behind the original SOLNP algorithm, Original Sources
  • Alexios Ghalanos and Stefan Theussl - The people behind RSOLNP, Github repository
  • Davis King - The mastermind behind Dlib, check out his blog! Blog