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:
where
is the center vector,
is the dependent generator matrix,
is the independent generator matrix,
is the exponent matrix,
is the number of dependent generators,
is the number of independent generators, and
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
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: Noneid (torch.Tensor, optional) – The integer identifiers for the dependent generators. If
None
, it will be the range of the number of dependent generators. Default: Nonecopy_Z (bool, optional) – If
True
, it will copy the inputZ
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])zeros
(dims[, dtype, device])Attributes
Dependent generators of a polynimal zonotope return <torch.Tensor> , shape [N, nx]
Independent generators of a polynimal zonotope return <torch.Tensor> , shape [M, nx]
The center of a polynimal zonotope return <torch.Tensor> , shape [nx]
The device of a polynomial zonotope properties return 'cpu', 'cuda:0', or ...
The data type of vector elements (ex.
The data type of a polynomial zonotope exponent matrix return torch.short, torch.int, torch.long
- 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]
- 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
- 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#
- 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]