Metadata-Version: 1.1
Name: pypoman
Version: 0.5.3
Summary: Polyhedron and polytope manipulation in Python
Home-page: https://github.com/stephane-caron/pypoman
Author: Stéphane Caron
Author-email: stephane.caron@lirmm.fr
License: LGPL
Description-Content-Type: UNKNOWN
Description: This library implements common operations over `convex polyhedra <https://en.wikipedia.org/wiki/Convex_polyhedron>`_ such
        as `polytope projection <https://scaron.info/doc/pypoman/index.html#module-pypoman.projection>`_, `double description <https://scaron.info/doc/pypoman/index.html#module-pypoman.duality>`_ (conversion between
        halfspace and vertex representations), computing the `Chebyshev center <https://scaron.info/doc/pypoman/index.html#chebyshev-center>`_,
        etc.
        
        See the complete `API documentation <https://scaron.info/doc/pypoman/>`_ for details.
        
        Installation
        ------------
        
        Make sure you have all system-wide dependencies by:
        
        .. code-block::
        
            sudo apt-get install cython libglpk-dev python python-dev python-pip python-scipy
        
        Then, install the module itself:
        
        .. code-block::
        
            pip install pypoman
        
        Examples
        --------
        
        Vertex enumeration
        ~~~~~~~~~~~~~~~~~~
        
        We can compute the list of vertices of a polytope described in halfspace
        representation by ``A * x <= b``:
        
        .. code:: python
        
            import numpy
            import pypoman
        
            A = numpy.array([
                [-1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0],
                [0, -1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0],
                [0,  0, -1,  0,  0,  0,  0,  0,  0,  0,  0,  0],
                [0,  0,  0, -1,  0,  0,  0,  0,  0,  0,  0,  0],
                [0,  0,  0,  0, -1,  0,  0,  0,  0,  0,  0,  0],
                [0,  0,  0,  0,  0, -1,  0,  0,  0,  0,  0,  0],
                [0,  0,  0,  0,  0,  0, -1,  0,  0,  0,  0,  0],
                [0,  0,  0,  0,  0,  0,  0, -1,  0,  0,  0,  0],
                [0,  0,  0,  0,  0,  0,  0,  0, -1,  0,  0,  0],
                [0,  0,  0,  0,  0,  0,  0,  0,  0, -1,  0,  0],
                [0,  0,  0,  0,  0,  0,  0,  0,  0,  0, -1,  0],
                [0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, -1],
                [1,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0],
                [0,  0,  0,  1,  1,  1,  0,  0,  0,  0,  0,  0],
                [0,  0,  0,  0,  0,  0,  1,  1,  1,  0,  0,  0],
                [0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  1,  1],
                [1,  0,  0,  1,  0,  0,  1,  0,  0,  1,  0,  0],
                [0,  1,  0,  0,  1,  0,  0,  1,  0,  0,  1,  0],
                [0,  0,  1,  0,  0,  1,  0,  0,  1,  0,  0,  1]])
            b = numpy.array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 2, 2, 1, 2, 3])
            vertices = pypoman.compute_polytope_vertices(A, b)
        
        Polytope projection
        ~~~~~~~~~~~~~~~~~~~
        
        Let us project an n-dimensional polytope over ``x = [x_1 ... x_n]`` onto its
        first two coordinates ``proj(x) = [x_1 x_2]``:
        
        .. code:: python
        
            import pypoman
            from numpy import array, eye, ones, vstack, zeros
        
            n = 10  # dimension of the original polytope
            p = 2   # dimension of the projected polytope
        
            # Original polytope:
            # - inequality constraints: \forall i, |x_i| <= 1
            # - equality constraint: sum_i x_i = 0
            A = vstack([+eye(n), -eye(n)])
            b = ones(2 * n)
            C = ones(n).reshape((1, n))
            d = array([0])
            ineq = (A, b)  # A * x <= b
            eq = (C, d)    # C * x == d
        
            # Projection is proj(x) = [x_0 x_1]
            E = zeros((p, n))
            E[0, 0] = 1.
            E[1, 1] = 1.
            f = zeros(p)
            proj = (E, f)  # proj(x) = E * x + f
        
            vertices = pypoman.project_polytope(proj, ineq, eq, method='bretl')
        
            if __name__ == "__main__":   # plot projected polytope
                import pylab
                pylab.ion()
                pylab.figure()
                pypoman.plot_polygon(vertices)
        
Keywords: convex,polyhedron,polyhedra,polytope,projection,duality
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
