Getting Started

Overview

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.

Installation

Automatic Installer

The simplest way to install pycddlib is to install it with pip:

pip install pycddlib

On Windows, this will install from a binary wheel (for Python 2.7 and Python 3.3 and up; for older versions of Python you will need to build from source, see below).

On Linux, this will install from source, and you will need GMP. Your distribution probably has a pre-built package for it. For example, on Fedora, install it by running:

yum install gmp-devel

Building From Source

Full build instructions are in the git repository, for Windows under appveyor.yml, and for Linux under .travis.yml.

The Windows build is rather complicated. First, you must take special care to use the 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 MSVC 2008 express edition will do just fine). For Python 3.3, use Microsoft Visual C/C++ 2010 (again, the MSVC 2010 express edition suffices).

Next, MPIR only provides a project file for MSVC 2010 and later. For versions of Python that require older versions of MSVC, such as Python 2.7 which requires MSVC 2008, you can use for instance:

msbuild mpir-x.x.x/build.vc10/lib_mpir_gc/lib_mpir_gc.vcxproj /p:PlatformToolset=v90

to instruct msbuild to use MSVC 2008 (i.e. v90) for compiling and linking.

To tell Python where MPIR is located on your Windows machine, you can use:

python setup.py build build_ext -I<mpir_include_folder> -L<mpir_lib_folder>