dualdesc-0.1.0
توضیحات
Dual description of polytopes.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | dualdesc-0.1.0 |
| نام | dualdesc |
| نسخه کتابخانه | 0.1.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | valtron |
| ایمیل نویسنده | - |
| آدرس صفحه اصلی | https://gitlab.com/valtron/dualdesc |
| آدرس اینترنتی | https://pypi.org/project/dualdesc/ |
| مجوز | - |
# dualdesc
[](https://gitlab.com/valtron/dualdesc)
[](https://gitlab.com/valtron/dualdesc/-/pipelines)
[]()
[](https://pepy.tech/project/dualdesc)
[](https://gitlab.com/valtron/dualdesc/-/blob/master/LICENSE)
Dual description for polytopes. A wrapper around [pycddlib](https://pycddlib.readthedocs.io).
Mainly for easily converting between H- and V-representations.
No utilities for facet enumeration, adjacencies, etc.
## Usage
This package contains two classes, `HRepr` and `VRepr`, for the H- and V-representations of polytopes.
They have methods `to_v()` and `to_h()`, respectively, for converting between them.
`HRepr(Au, bu, Ae, be)` represents the polytope defined by all points `x` s.t. `Au @ x <= bu` and `Ae @ x == be`.
`Au`, `bu` (inequality constraints) and `Ae`, `be` (equality constraints) are also fields on the `HRepr` object.
If there are `nu` inequality and `ne` equality constraints, and the ambient dimension is `d`,
the shapes of these matrices are:
- `Au`: `(nu, d)`
- `bu`: `(d,)`
- `Ae`: `(ne, d)`
- `be`: `(d,)`
`VRepr(Vc, Vn, Vl)` represents the polytope defined by `conv(Vc) + nonneg(Vn) + linspace(Vl)`,
where `conv` is the convex combination of a set of points, `nonneg` is non-negative linear combinations
of a set of points, `linspace` is a linear combination of a set of points, and `+` is Minkowski addition.
### A simple example
The example below defines an unbounded (i.e. non-null cone part) polytope with 3 facets and 2 vertices:
```python
import numpy as np
import dualdesc as dd
M = np.array([
[1, 0, 1], # x0 <= 1
[0, 2, 1], # 2 x1 <= 1
[1, 1, 1], # x0 + x1 <= 1
], dtype = np.float64)
Au = M[:,:2]
bu = M[:,-1]
h = dd.HRepr(Au, bu)
v = h.to_v()
# Vertices (conv component):
# v.Vc = [[0.5, 0.5], [1, 0]]
# Cone part (nonneg and linear components):
# v.Vn = [[-1, 0], [0, -1]]
# v.Vl = []
```
## Why not pypoman?
[pypoman](https://scaron.info/doc/pypoman) has more features, but only supports bounded polytopes.
## Why not use pycddlib directly?
[pycddlib](https://pycddlib.readthedocs.io) has more features (like adjacency lists), but is too low level and doesn't have a nice interface.
نیازمندی
| مقدار | نام |
|---|---|
| ~=2.1.5 | pycddlib |
| ~=4.2.0 | typing-extensions |
| ~=1.21 | numpy |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6 | Python |
نحوه نصب
نصب پکیج whl dualdesc-0.1.0:
pip install dualdesc-0.1.0.whl
نصب پکیج tar.gz dualdesc-0.1.0:
pip install dualdesc-0.1.0.tar.gz