Interiorpointoptimisation
1.01
Interiorpointoptimisationlibrary

Ipo is a C++ library for solving convex optimisation problems using an interiorpoint algorithm. Specifically, it used barrier optimisation with a logarithmic barrier.
Ipo depends on the Gnu Scientific Library and also on the ccgsl C++ wrappers for it. So these should be installed before trying to build ipo
. The Gnu Scientific Library is available for many Gnu/Linux systems. And ccgsl
contains only headers and so only needs to be installed.
Ipo uses the Gnu build system. So you will need the Gnu build utilities autoconf
, automake
and libtool
besides a modern C++ compiler such as g++
. It uses features of C++11 and so your C++ compiler must be able to compile these. Recent versions of g++
can be passed the flags std=c++0x
, std=c++11
or std=c++14
. These can be set in bash
using
EXPORT CXXFLAGS="std=c++11"
Other g++
flags that you may wish to use and should work are O2
, pedantic
, Wall
, march=native
, maligndouble
and pipe
.
To build from a source file ipox.yyzz.tar.gz
you may use
If this succeeds, install using
You can also use make check to create some test code and, if you have Doxygen
installed, make doc to create this documentation.
Ipo is a library. So you must write C++ code to use it.
The starting point for using ipo is the ipo::Model class declared in the <ipo/Model.hpp>
header. A ipo::Model brings together various objects used to represent a convex optimisation problem.
() operator taking a ccgsl::vector argument. It is a good idea to define also the the gradient
and hessian
methods. And if it is more efficient to compute function value, gradient and Hessian simultaneously, it is a good idea to make the subclass also a subclass of ipoFunction::DerivativesEstimates and to define the setVector()
method to compute a functionValue
, functionGradient
and functionHessian
. Note that the interiorpoint method requires both a gradient and Hessian. If you do not supply one, ipo will substitute central difference quotient estimates, which are often less accurate and more expensive than computing values directly.setValue()
function. This can be used to set an equality constraint. Again, the only constraints that can be set to hold with equality in a convex optimisation problem are linear ones.Note that it is not enough to create the ipo::Objective and the ipo::Constraint objects you need. You must also add them to the model using the setObjective()
and addConstraint()
methods. The reason for this is that you may wish to change the objective or to add or remove constraints. For example, it is perfectly possible to use ipo with branchandbound to solve integer programming problems. In any case the summary()
method is useful if you need to check what has been added.
Note that ipo cannot, in general, check that the objective function and constraints are convex. That is your responsibility. Currently there are no sanity checks and so, for example, if you ask ipo to minimise sin(x)
subject to cos(x)
≤ 0 it will attempt to do so without complaining,
Once you have constructed an ipo::Model object you can use the minimise
or maximise()
methods to seek a solution. The findFeasible()
method is useful if you only wish to check if there is a set of variables satisfying the constraints. It uses a simple Phase I model to check this.
Since ipo is a library you will need to link to it. A standard ipo build will provide both a shared library (typically libipo.so
in /usr/local/lib
) and a static one (typically libipo.a
in /usr/local/lib
). Both depend on the Gnu Scientific Library, which in turn depends on a BLAS library and the C math library. So you must link four libraries. With g++
you can do this using the flags
You should look at the Gnu Scientific Library documentation for details on how to use other BLAS libraries.
Suppose we wish to maximise a concave funtion over the convex set given by
x² + y² ≤ 1,
x + y ≥ 0, and
x ≤ 0.5.
These are easy to model in ipo
. So suppose also the concave function of two variables is available together with its gradient and Hessian in C code. Suppose further that we do not wish to rewrite these functions in C++ but rather use the functions declared in the C header file "concave_function.h":
The following code will allow us to construct the model we want. Notice that we need to define only one new class, for the concave function. But it is useful to use a third variable for the linear constraint.
This is a convex optimisation problem. The code when run will produce output like the following (depending on the unspecified concave function). In the case below the optimal x and y lie on an intersection of the unit circle with the line x = 0.5.