A Python library for manipulating, plotting and computing with polyhedral and ellipsoidal sets.
Project description
Geomin
Python library for manipulating, plotting and computing with polyhedral and ellipsoidal sets. It is a relatively thin wrapper around Pycddlib, including some utility functions for convenience.
Installation
(The following assume you have already created a Python virtual environment)
Option 1. Install directly from PyPI:
pip install geomin
This does assume some prerequisites for pycddlib have already been installed.
See their documentation
for more information.
Option 2. Clone the repo and from within its root, run
pip install .
Usage
Creation of polytopes
From inequalities
Use the Polyhedron.from_inequalities method to build a polyhedron $X$ from
a system of linear inequalities
$$ X = { x \in \mathbb{R}^n \mid H x \le h }. $$
For example, to represent the system
$$ \begin{cases} x_1 \ge -1 \ x_2 \ge -1 \ x_1 + x_2 \le 1 \end{cases} $$
You would write
import geomin as gp
import numpy as np
H = np.vstack([-np.eye(2), np.ones((1,2))])
h = np.array([1., 1., 1.])
poly = gp.Polyhedron.from_inequalities(H, h)
From vertices
Alternatively, a polyhedron can be constructed as the convex hull of a list of vertices.
import geomin as gp
import numpy as np
verts = np.array([(0, 0), (1, 0), (0, 1)])
poly = gp.Polyhedron.from_generators(verts)
Creation of ellipsoids
An ellipsoid created as gp.Ellipsoid(Q, c) represents
$$ { x: (x - c)^\top Q (x - c) \leq 1 }. $$
The argument $c$ is optional and is assumed to be $0$ by default.
Plotting
We provide some functions for easy plotting of sets, built on Matplotlib. Check the examples folder for more.
import matplotlib.pyplot as plt
# basic usage
plot_polytope(poly)
# Or with some styling
plt.figure()
plot_polytope(
poly,
color="tab:green", # base color
alpha=0.5, # transparency
)
plt.show()
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 Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file geomin-0.0.5.tar.gz.
File metadata
- Download URL: geomin-0.0.5.tar.gz
- Upload date:
- Size: 16.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85cace990f2bc375e25f9dd353b02b029556cb239f75198c255fda8f44acd6bc
|
|
| MD5 |
2c3456c8ff91ae7563dc7957de5313a5
|
|
| BLAKE2b-256 |
841adad933d1c4fbd5e7f915d836b25674875a33835a67c85790b72778123857
|
Provenance
The following attestation bundles were made for geomin-0.0.5.tar.gz:
Publisher:
wheels.yaml on kul-optec/geomin
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
geomin-0.0.5.tar.gz -
Subject digest:
85cace990f2bc375e25f9dd353b02b029556cb239f75198c255fda8f44acd6bc - Sigstore transparency entry: 736743149
- Sigstore integration time:
-
Permalink:
kul-optec/geomin@5fd861d8bd80279eff382691f1fda8e8d96089bd -
Branch / Tag:
refs/tags/0.0.5 - Owner: https://github.com/kul-optec
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yaml@5fd861d8bd80279eff382691f1fda8e8d96089bd -
Trigger Event:
release
-
Statement type:
File details
Details for the file geomin-0.0.5-py3-none-any.whl.
File metadata
- Download URL: geomin-0.0.5-py3-none-any.whl
- Upload date:
- Size: 16.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8d4303f35d80209e2078cb5be4b040051eabf1615c1c9b42842dacdfe618887
|
|
| MD5 |
820ecba29b1f2f5966e45d44f11b25b6
|
|
| BLAKE2b-256 |
7b894c3a0689a459bbf6b6192d33a870863629055d7b12ebb5e3896e9bb8490d
|
Provenance
The following attestation bundles were made for geomin-0.0.5-py3-none-any.whl:
Publisher:
wheels.yaml on kul-optec/geomin
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
geomin-0.0.5-py3-none-any.whl -
Subject digest:
c8d4303f35d80209e2078cb5be4b040051eabf1615c1c9b42842dacdfe618887 - Sigstore transparency entry: 736743153
- Sigstore integration time:
-
Permalink:
kul-optec/geomin@5fd861d8bd80279eff382691f1fda8e8d96089bd -
Branch / Tag:
refs/tags/0.0.5 - Owner: https://github.com/kul-optec
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yaml@5fd861d8bd80279eff382691f1fda8e8d96089bd -
Trigger Event:
release
-
Statement type: