Skip to main content

Geopy,

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geomin-0.0.4.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geomin-0.0.4-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file geomin-0.0.4.tar.gz.

File metadata

  • Download URL: geomin-0.0.4.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

Hashes for geomin-0.0.4.tar.gz
Algorithm Hash digest
SHA256 3e409d1c1ba39987fecd29ef15707aefe8afb434b334a4ec519a94116cf0e1b9
MD5 7e94dec2fbf116771f37f4260d4f76f1
BLAKE2b-256 0258278a015a43806ef67f71d93e167781041c332c296e6a23556f907f82b56d

See more details on using hashes here.

Provenance

The following attestation bundles were made for geomin-0.0.4.tar.gz:

Publisher: wheels.yaml on kul-optec/geomin

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file geomin-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: geomin-0.0.4-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

Hashes for geomin-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0df0103f6ab44ac1ac39d287d3398c8230822a07f30adfdbfaa635eaca93987b
MD5 edbf13345fa54d951720c79a762b1e4f
BLAKE2b-256 ff7612fd437647e4b0a1a438830a5dc6366645da1601244f6b75518359918140

See more details on using hashes here.

Provenance

The following attestation bundles were made for geomin-0.0.4-py3-none-any.whl:

Publisher: wheels.yaml on kul-optec/geomin

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page