zonopy.polyZonotope#

class zonopy.polyZonotope(Z, n_dep_gens=0, expMat=None, id=None, copy_Z=True, dtype=None, device=None)[source]#

Bases: object

1D Polynomial Zonotopes

The Polynomial Zonotope (similar to Talyor model) is a non-convex set representation of a summation over multivariate polynomials multiplied with intervals.

It is defined as a set of the following form:

PZ:={c+i=1N(k=1pαkE(k,i))G(,i)+j=1MβjGrest(,j)  |  αk,βj[1,1]k=1,...,pj=1,...,M}\mathcal{PZ} := \left\{ c + \sum_{i=1}^{N} \left( \prod_{k=1}^{p}\alpha_{k}^{E_{(k,i)}}\right) G_{(\cdot,i)}+\sum_{j=1}^{M}\beta_{j}G_{rest(\cdot,j)} \; \middle\vert \; \begin{array}{l} \alpha_k, \beta_j \in [-1,1] \\ \forall k = 1,...,p \\ \forall j=1,...,M \end{array} \right\}

where

  • cRdc\in\mathbb{R}^d is the center vector,

  • GRd×NG\in\mathbb{R}^{d\times N} is the dependent generator matrix,

  • GrestRd×MG_{rest}\in\mathbb{R}^{d\times M} is the independent generator matrix,

  • ERp×NE\in\mathbb{R}^{p\times N} is the exponent matrix,

  • NN is the number of dependent generators,

  • MM is the number of independent generators, and

  • pp is the number of indeterminants.

__init__(Z, n_dep_gens=0, expMat=None, id=None, copy_Z=True, dtype=None, device=None)[source]#

Initialize the polynomial zonotope

Parameters:
  • Z (torch.Tensor) – The center and generator matrix of the polynomial zonotope Z=[c,G,Grest]T\mathbf{Z} = [c, G, G_{rest}]^T

  • n_dep_gens (int, optional) – The number of dependent generators. Default: 0

  • expMat (torch.Tensor, optional) – The exponent matrix of the dependent generators. If None, it will be the identity matrix. Default: None

  • id (torch.Tensor, optional) – The integer identifiers for the dependent generators. If None, it will be the range of the number of dependent generators. Default: None

  • copy_Z (bool, optional) – If True, it will copy the input Z value. Default: True

  • dtype (torch.dtype, optional) – The data type of the polynomial zonotope. If None, it will be inferred. Default: None

  • device (torch.device, optional) – The device of the polynomial zonotope. If None, it will be inferred. Default: None

Raises:
  • AssertionError – If the exponent matrix does not seem to be valid for the given dependent generators or ids.

  • AssertionError – If the number of dependent generators does not match the number of ids.

  • AssertionError – If the exponent matrix is not a non-negative integer matrix.

Methods

__init__(Z[, n_dep_gens, expMat, id, ...])

Initialize the polynomial zonotope

center_slice_all_dep(val_slc)

compress(compression_level)

cpu()

deleteZerosGenerators([eps])

exactCartProd(other)

self: <polyZonotope> other: <polyZonotope> return <polyZonotope>

grad_center_slice_all_dep(val_slc)

hess_center_slice_all_dep(val_slc)

ones(dims[, dtype, device])

project([dim])

reduce(order[, option])

reduce_indep(order[, option])

slice_all_dep(val_slc)

Slice polynomial zonotpe in all depdent generators

slice_dep(id_slc, val_slc)

Slice polynomial zonotpe in depdent generators id_slc: id to slice val_slc: indeterminant to slice

split_dep_indep([center_on_dep])

to([dtype, itype, device])

to_interval([method])

to_zonotope()

zeros(dims[, dtype, device])

Attributes

G

Dependent generators of a polynimal zonotope return <torch.Tensor> , shape [N, nx]

Grest

Independent generators of a polynimal zonotope return <torch.Tensor> , shape [M, nx]

c

The center of a polynimal zonotope return <torch.Tensor> , shape [nx]

device

The device of a polynomial zonotope properties return 'cpu', 'cuda:0', or ...

dimension

dtype

The data type of vector elements (ex.

input_pairs

itype

The data type of a polynomial zonotope exponent matrix return torch.short, torch.int, torch.long

n_generators

n_indep_gens

property G#

Dependent generators of a polynimal zonotope return <torch.Tensor> , shape [N, nx]

property Grest#

Independent generators of a polynimal zonotope return <torch.Tensor> , shape [M, nx]

property c#

The center of a polynimal zonotope return <torch.Tensor> , shape [nx]

center_slice_all_dep(val_slc)[source]#
compress(compression_level)[source]#
cpu()[source]#
deleteZerosGenerators(eps=0)[source]#
property device#

The device of a polynomial zonotope properties return ‘cpu’, ‘cuda:0’, or …

property dimension#
property dtype#

The data type of vector elements (ex. center) of a polynomial zonotope return torch.float or torch.double

exactCartProd(other)[source]#

self: <polyZonotope> other: <polyZonotope> return <polyZonotope>

grad_center_slice_all_dep(val_slc)[source]#
hess_center_slice_all_dep(val_slc)[source]#
property input_pairs#
property itype#

The data type of a polynomial zonotope exponent matrix return torch.short, torch.int, torch.long

property n_generators#
property n_indep_gens#
static ones(dims, dtype=None, device=None)[source]#
project(dim=[0, 1])[source]#
reduce(order, option='girard')[source]#
reduce_indep(order, option='girard')[source]#
slice_all_dep(val_slc)[source]#

Slice polynomial zonotpe in all depdent generators

id_slc: id to slice val_slc: indeterminant to slice return, c: <torch.Tensor>, shape [nx] grad_c: <torch.Tensor>, shape [n_ids,nx]

slice_dep(id_slc, val_slc)[source]#

Slice polynomial zonotpe in depdent generators id_slc: id to slice val_slc: indeterminant to slice

split_dep_indep(center_on_dep=True)[source]#
to(dtype=None, itype=None, device=None)[source]#
to_interval(method='interval')[source]#
to_zonotope()[source]#
static zeros(dims, dtype=None, device=None)[source]#