pycddlib is a Python wrapper for Komei Fukuda’s cddlib.
cddlib is an implementation of the Double Description Method of Motzkin et al. for generating all vertices (i.e. extreme points) and extreme rays of a general convex polyhedron given by a system of linear inequalities.
The program also supports the reverse operation (i.e. convex hull computation). This means that one can move back and forth between an inequality representation and a generator (i.e. vertex and ray) representation of a polyhedron with cdd. Also, it can solve a linear programming problem, i.e. a problem of maximizing and minimizing a linear function over a polyhedron.
The simplest way to install pycddlib, is to download an installer matching your version of Python, and run it.
To compile pycddlib, you need MPIR. On Linux, your distributions probably has a pre-built package for it. For example, on Fedora, install it by running:
yum install mpir-devel
On Windows, download the latest MPIR source tarball (decompress the mpir-x.x.x.tar.bz2 file with 7-Zip), and follow the instructions in mpir-x.x.x\build.vc9\readme.txt. [1] For pycddlib, you only need to build the lib_mpir_gc project. Once built, go to the build.vc9\lib\win32\release folder, and copy mpir.h to:
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include
and mpir.lib and mpir.pdb to:
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib
Once MPIR is installed, download and extract the source .zip. On Windows, start the MSVC command line, and run the setup script from within the extracted folder:
cd ....\pycddlib-x.x.x
C:\PythonXX\python.exe setup.py install
On Linux, start a terminal and run:
cd ..../pycddlib-x.x.x
python setup.py build
su -c 'python setup.py install'
To compile the latest code, clone the project with Git by running:
git clone --recursive git://github.com/mcmtroffaes/pycddlib
Then simply run the build.sh script: this will build the library, install it, generate the documentation, and run all the doctests. Note that, besides MPIR, you also need Cython to compile the source, and Sphinx to generate the documentation.
Footnotes
[1] | When compiling extension modules, it is easiest to use same compiler that was used to compile Python. For Python 2.6, 2.7, 3.0, and 3.1, this is Microsoft Visual C/C++ 2008 (the express edition will do just fine). |