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 on Windows, you need MPIR. Download the latest MPIR source tarball (decompress the mpir-x.x.x.tar.bz2 file with 7-Zip), and run configure.bat and make.bat from the mpir-x.x.x\win folder. [1] Once built, go to the mpir-x.x.x folder, and copy mpir.h and mpirxx.h to:
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include
and mpir.lib and mpirxx.lib to either (for a 32-bit build):
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib
or (for a 64-bit build):
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\amd64
On Linux, you need GMP (although you can also use MPIR if you desire so, by tweaking the setup.py file). Your distribution probably has a pre-built package for it. For example, on Fedora, install it by running:
yum install gmp-devel
Once MPIR/GMP 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, 3.1, and 3.2, this is Microsoft Visual C/C++ 2008 (the express edition will do just fine). |