passagemath: Convex polyhedra in arbitrary dimension, mixed integer linear optimization
Project description
About SageMath
- “Creating a Viable Open Source Alternative to
Magma, Maple, Mathematica, and MATLAB”
Copyright (C) 2005-2024 The Sage Development Team
SageMath fully supports all major Linux distributions, recent versions of macOS, and Windows (Windows Subsystem for Linux).
See https://doc.sagemath.org/html/en/installation/index.html for general installation instructions.
About this pip-installable distribution
This pip-installable distribution passagemath-polyhedra is a distribution of a part of the Sage Library. It provides a small subset of the modules of the Sage library (“sagelib”, passagemath-standard), sufficient for computations with convex polyhedra in arbitrary dimension (in exact rational arithmetic), and linear and mixed integer linear optimization (in floating point arithmetic).
What is included
Combinatorial and Discrete Geometry: Polyhedra, lattice polyhedra, lattice points in polyhedra, triangulations, fans, polyhedral complexes, hyperplane arrrangements
Parma Polyhedra Library (PPL) backends for rational polyhedra, lattice polygons, lattice polytopes; via pplpy
Linear, Mixed Integer Linear, and Semidefinite Optimization frontends
see https://github.com/passagemath/passagemath/blob/main/pkgs/sagemath-polyhedra/MANIFEST.in
Examples
A quick way to try it out interactively:
$ pipx run --pip-args="--prefer-binary" --spec "passagemath-polyhedra[test]" ipython In [1]: from sage.all__sagemath_polyhedra import * In [2]: P = Polyhedron(ieqs=[[0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1], [0, 0, 1, -1, -1, 1, 0], [0, 0, -1, 1, -1, 1, 0]], eqns=[[-31, 1, 1, 1, 1, 1, 1]]); P Out[2]: A 5-dimensional polyhedron in QQ^6 defined as the convex hull of 7 vertices In [3]: P.Vrepresentation() Out[4]: (A vertex at (31, 0, 0, 0, 0, 0), A vertex at (0, 0, 0, 0, 0, 31), A vertex at (0, 0, 0, 0, 31, 0), A vertex at (0, 0, 31/2, 0, 31/2, 0), A vertex at (0, 31/2, 31/2, 0, 0, 0), A vertex at (0, 31/2, 0, 0, 31/2, 0), A vertex at (0, 0, 0, 31/2, 31/2, 0))
Available as extras, from other distributions
Additional features
- pip install “passagemath-polyhedra[graphs]”
Face lattices, combinatorial polyhedra, graph-theoretic constructions
$ pipx run --pip-args="--prefer-binary" --spec "passagemath-polyhedra[graphs,test]" ipython In [1]: from sage.all__sagemath_polyhedra import * In [2]: c5_10 = Polyhedron(vertices = [[i, i**2, i**3, i**4, i**5] for i in range(1, 11)]); c5_10 Out[2]: A 5-dimensional polyhedron in ZZ^5 defined as the convex hull of 10 vertices In [3]: c5_10_fl = c5_10.face_lattice(); [len(x) for x in c5_10_fl.level_sets()] Out[3]: [1, 10, 45, 100, 105, 42, 1]
- pip install “passagemath-polyhedra[graphs,groups]”
Constructing symmetric polyhedra, computing automorphisms, lattice point counting modulo group actions
$ pipx run --pip-args="--prefer-binary" --spec "passagemath-polyhedra[graphs,groups,test]" ipython In [1]: from sage.all__sagemath_polyhedra import * In [2]: P24 = polytopes.twenty_four_cell(); P24 Out[2]: A 4-dimensional polyhedron in QQ^4 defined as the convex hull of 24 vertices In [3]: AutP24 = P24.restricted_automorphism_group(); AutP24.order() Out[3]: 1152
- pip install “passagemath-polyhedra[toric]”
-
$ pipx run --pip-args="--prefer-binary" --spec "passagemath-polyhedra[graphs,toric,test]" ipython In [1]: from sage.all__sagemath_polyhedra import * In [2]: TV3 = ToricVariety(NormalFan(lattice_polytope.cross_polytope(3))); TV3 Out[2]: 3-d toric variety covered by 6 affine patches In [3]: TV3.is_orbifold() Out[3]: False
- pip install “passagemath-polyhedra[latte]”
Installs LattE integrale for lattice point counting and volume computation using generating function techniques.
$ pipx run --pip-args="--prefer-binary" --spec "passagemath-polyhedra[latte,test]" ipython In [1]: from sage.all__sagemath_polyhedra import * In [2]: P = polytopes.cube() In [3]: P.integral_points_count() Out[3]: 27 In [4]: (1000000000*P).integral_points_count(verbose=True) This is LattE integrale... ... Total time:... Out[4]: 8000000012000000006000000001
Additional backends for polyhedral computations
- pip install “passagemath-polyhedra[normaliz]”
Normaliz, via PyNormaliz, provides very fast computations in particular for polyhedra with data in algebraic number fields.
$ pipx run --pip-args="--prefer-binary" --spec "passagemath-polyhedra[normaliz,test]" ipython In [1]: from sage.all__sagemath_polyhedra import * In [2]: gap_norm = polytopes.grand_antiprism(backend='normaliz'); gap_norm In [3]: gap_norm.f_vector()
- pip install “passagemath-polyhedra[cddlib]”
cddlib provides support for computations with polyhedra in floating-point arithmetic.
$ pipx run --pip-args="--prefer-binary" --spec "passagemath-polyhedra[cddlib,test]" ipython In [1]: from sage.all__sagemath_polyhedra import * In [2]: P1 = polytopes.regular_polygon(5, exact=False); P1 Out[2]: A 2-dimensional polyhedron in RDF^2 defined as the convex hull of 5 vertices
- pip install “passagemath-polyhedra[lrslib]”
lrslib can be used for polytope volume computations and for enumerating Nash equilibria.
$ pipx run --pip-args="--prefer-binary" --spec "passagemath-polyhedra[flint,lrslib,test]" ipython In [1]: from sage.all__sagemath_polyhedra import * In [2]: A = matrix([[2, 1], [1, 5/2]]); B = matrix([[-1, 3], [2, 1]]) In [3]: g = NormalFormGame([A, B]); g.obtain_nash(algorithm='lrs') Out[3]: [[(1/5, 4/5), (3/5, 2/5)]]
- pip install “passagemath-polyhedra[polymake]”
-
This currently requires a separate installation of polymake.
Optional backends for optimization
- pip install “passagemath-polyhedra[cbc]”
COIN/OR CBC Mixed Integer Linear Optimization solver, via sage_numerical_backends_coin
- pip install “passagemath-polyhedra[cplex]”
CPLEX Mixed Integer Optimization solver (proprietary; requires licensed installation), via sage_numerical_backends_cplex
- pip install “passagemath-polyhedra[cvxpy]”
CVXPy as middle-end for various backends
- pip install “passagemath-polyhedra[gurobi]”
Gurobi Mixed Integer Optimization solver (proprietary; requires licensed installation), via sage_numerical_backends_gurobi
- pip install “passagemath-polyhedra[scip]”
Development
$ git clone --origin passagemath https://github.com/passagemath/passagemath.git $ cd passagemath passagemath $ ./bootstrap passagemath $ python3 -m venv polyhedra-venv passagemath $ source polyhedra-venv/bin/activate (polyhedra-venv) passagemath $ pip install -v -e pkgs/sagemath-polyhedra
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file passagemath_polyhedra-10.4.66.tar.gz
.
File metadata
- Download URL: passagemath_polyhedra-10.4.66.tar.gz
- Upload date:
- Size: 987.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c99afc6785a223262f6efcbef8f30cb3a6e2229cfa08b01f133d6fcaa5c1d4cc |
|
MD5 | 7fd409cb947d15866052c5c49d1bf54c |
|
BLAKE2b-256 | 0f0dd126caf43f6800b145b23c60d00b2fae8a90d22467d28df922f5facaf8a0 |
File details
Details for the file passagemath_polyhedra-10.4.66-cp312-cp312-musllinux_1_2_x86_64.whl
.
File metadata
- Download URL: passagemath_polyhedra-10.4.66-cp312-cp312-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 13.3 MB
- Tags: CPython 3.12, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6f8b1a656c42290792a911b29cabd085922d1d3e84f4882eab9367ab457a7c6 |
|
MD5 | 290202a6506d26ae6eb7b99a2f4541ae |
|
BLAKE2b-256 | 0c272cec58e96dcb9f4638aae6b20832fdec3d42ef796a9f0361e51ecf4c0720 |
File details
Details for the file passagemath_polyhedra-10.4.66-cp312-cp312-macosx_14_0_arm64.whl
.
File metadata
- Download URL: passagemath_polyhedra-10.4.66-cp312-cp312-macosx_14_0_arm64.whl
- Upload date:
- Size: 6.9 MB
- Tags: CPython 3.12, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11f7b812c5503db216dabaef0d6347854ffc77c9c87e67ac85cc4d2ad6500e26 |
|
MD5 | 1f6ff5fb4c315abff833d4c946c3ab90 |
|
BLAKE2b-256 | ca3263b7055726e700728ee58477d42edec968e7a7e18fec03dcddba04d0ef5f |
File details
Details for the file passagemath_polyhedra-10.4.66-cp312-cp312-macosx_13_0_x86_64.whl
.
File metadata
- Download URL: passagemath_polyhedra-10.4.66-cp312-cp312-macosx_13_0_x86_64.whl
- Upload date:
- Size: 3.0 MB
- Tags: CPython 3.12, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44d3e260c96b6cb38889bb8e8c65484b758a35a124fae37d1285608b477e576d |
|
MD5 | d5cd3704d12b63b35dab2c42d81da954 |
|
BLAKE2b-256 | b902e0bae8b7e5c5ae79ac6c2737a1002c41750307b6d7cfa86123357eee903d |
File details
Details for the file passagemath_polyhedra-10.4.66-cp311-cp311-musllinux_1_2_x86_64.whl
.
File metadata
- Download URL: passagemath_polyhedra-10.4.66-cp311-cp311-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 13.5 MB
- Tags: CPython 3.11, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33c35ef7b0134f2782047dd58d17d5cb365dc4b62237d90c9ceff0553f1110f4 |
|
MD5 | cbc1c122624feed7059c20bbf6926d2e |
|
BLAKE2b-256 | abc35ea3768ec0794e909cc285bae9fafd4ac951ba560b079c2678064c7589a2 |
File details
Details for the file passagemath_polyhedra-10.4.66-cp311-cp311-macosx_14_0_arm64.whl
.
File metadata
- Download URL: passagemath_polyhedra-10.4.66-cp311-cp311-macosx_14_0_arm64.whl
- Upload date:
- Size: 6.9 MB
- Tags: CPython 3.11, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c03bef5f7f80327700c0f580111e596b507affd1948fcf01812b5212be1bcc6d |
|
MD5 | 17a790bf909d2afa77d88e1215884357 |
|
BLAKE2b-256 | cde25ed34a2b4f6f6c0d8edb1ccd1b5c3468e637506a2d84fe5693ef2024f182 |
File details
Details for the file passagemath_polyhedra-10.4.66-cp311-cp311-macosx_13_0_x86_64.whl
.
File metadata
- Download URL: passagemath_polyhedra-10.4.66-cp311-cp311-macosx_13_0_x86_64.whl
- Upload date:
- Size: 3.0 MB
- Tags: CPython 3.11, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b854725c3f694d7cf42e6b52a88dfdb2fe802ad89e6ad8947fbde5e5b321007 |
|
MD5 | e53cab1122138c517ffdfa0bd9693ff6 |
|
BLAKE2b-256 | 09672f284c928542c1d6509276c1cd1e4956c516d543ba26763054a0c0e00182 |
File details
Details for the file passagemath_polyhedra-10.4.66-cp310-cp310-musllinux_1_2_x86_64.whl
.
File metadata
- Download URL: passagemath_polyhedra-10.4.66-cp310-cp310-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 12.8 MB
- Tags: CPython 3.10, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebc65a2e47a5ba7a3e7291a0aa59461ae43d7d15a88bceb2a988c56f1a10d0a3 |
|
MD5 | d9e4236a049dfa63607016fc8c46db47 |
|
BLAKE2b-256 | f27f1f88430ab3d14a1e3b98e81240e6c857e2c6e4c75523100417cf87e214d6 |
File details
Details for the file passagemath_polyhedra-10.4.66-cp310-cp310-macosx_14_0_arm64.whl
.
File metadata
- Download URL: passagemath_polyhedra-10.4.66-cp310-cp310-macosx_14_0_arm64.whl
- Upload date:
- Size: 6.9 MB
- Tags: CPython 3.10, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b9a657b5d6f59c75d81d95dfffa4d75b6048b9a33242182dd6c9a3858c7c387 |
|
MD5 | 1d9c6031a0fe2f6e8043dae34ed301af |
|
BLAKE2b-256 | 65a4127e9021d40d17df383ad4a3ce360ceef9416ad4a5a277d611cecfa2ee64 |
File details
Details for the file passagemath_polyhedra-10.4.66-cp310-cp310-macosx_13_0_x86_64.whl
.
File metadata
- Download URL: passagemath_polyhedra-10.4.66-cp310-cp310-macosx_13_0_x86_64.whl
- Upload date:
- Size: 3.0 MB
- Tags: CPython 3.10, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d9d2922b469247677c1802401a0599377bae1d28113e3305535816f0d1c8067 |
|
MD5 | a7467e1a6a95a4ab61e473a9474e3c34 |
|
BLAKE2b-256 | 226c2671006b3de9577de39c891609071d0fc61cd0ac96bdc309010e6bc49099 |
File details
Details for the file passagemath_polyhedra-10.4.66-cp39-cp39-musllinux_1_2_x86_64.whl
.
File metadata
- Download URL: passagemath_polyhedra-10.4.66-cp39-cp39-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 12.8 MB
- Tags: CPython 3.9, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b19b5b5410fe4ab1c2f72a4dce4f4b8f6970a2fdf7aa76fe4d08daae4afa6093 |
|
MD5 | 179b235c68c6542929c49d3584d293cb |
|
BLAKE2b-256 | 77aaa70caa6cbd5e0ec1dc2699a90a8605b9dfdc20d7e3f6df11f449be015bb0 |
File details
Details for the file passagemath_polyhedra-10.4.66-cp39-cp39-macosx_14_0_arm64.whl
.
File metadata
- Download URL: passagemath_polyhedra-10.4.66-cp39-cp39-macosx_14_0_arm64.whl
- Upload date:
- Size: 6.9 MB
- Tags: CPython 3.9, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa3a736ca299a1f65580988b5c4765819459e97a1be470aecea2c3f51beac1a8 |
|
MD5 | 230039f8d32360753b60d5d30888bd75 |
|
BLAKE2b-256 | f34a6fd8f8b8c8aaa41b5afbdd753b9e61030cbc80ecbb4113396afd292b27f4 |
File details
Details for the file passagemath_polyhedra-10.4.66-cp39-cp39-macosx_13_0_x86_64.whl
.
File metadata
- Download URL: passagemath_polyhedra-10.4.66-cp39-cp39-macosx_13_0_x86_64.whl
- Upload date:
- Size: 3.0 MB
- Tags: CPython 3.9, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b87ae5bb5d2368bd01ffd3550b719ae5ddcb8560dc43d710a7e52ff7a05c0682 |
|
MD5 | 048d98a3befdb05a8efadc2f7ff6f8fe |
|
BLAKE2b-256 | b707ea33905c3adbab810e7e841886b2e88247c8ed9f675be3c8f9e4ca956ba4 |