No description, website, or topics provided.
C++ Python CMake
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Madopt = Modelling and Automatic Differentiation for Optimisation

What it is

Madopt is a c++/python modelling interface for the MINLP solver Bonmin and the NLP solver Ipopt.

Madopt implements (c++):

  • expression building using operator overloading.
  • automatic differentiation for expressions.
  • an interface to the solvers Ipopt and Bonmin.
  • a python wrapper using cython.

Supported Operators are +, +=, *, *=, /, -, pow, sin, cos, tan, sqrt, ln, log2.


  • c++11 std
  • Bonmin >= 1.8 (Bonmin includes Ipopt)



mkdir build
cd build
cmake ..

creates static libraries called libmadopt.a, libmadopt_ipopt.a and libmadopt_bonmin.a. If ipopt/bonmin is installed in a custom location, one can provide the absolute path to the ipopt/bonmin libraries and headers via

cmake -DCUSTOM_LIBRARY=/path/to/bonmin/libs -DCUSTOM_INCLUDE=/path/to/bonmin/includes ..

To be able to use the C++ version of madopt one has to install the libraries by running

make install

The python interface depends on cython. Madopt can be complied for python 2 or 3 as long as the right cython version is present. To use the python interface it is not neccessary to install the C++ libraries, however they have to be build. To build and install the python module run the setup file in the base path of madopt. For example after doing the build run

cd ..
python install

To build a python module object '''' that can be copied to wherever it may be used run

cd ..
python build_ext --inplace


An example for the usage with C++ can be found in examples/get_started.cpp.

An example for the usage with python can be found in examples/ To run it call

python examples/


Apache License Version 2.0


If you are using madopt for your research, please consider citing the Ipopt project. The details on how to cite it can be found on the Ipopt website.