ZonoOpt 2.4.1
Loading...
Searching...
No Matches
Functions
Setup Functions

Setup functions for ZonoOpt library. More...

Functions

std::unique_ptr< HybZonoZonoOpt::from_json (const std::string &filename)
 Read a HybZono object from a JSON file.
 
std::unique_ptr< ZonoZonoOpt::interval_2_zono (const Box &box)
 Builds a zonotope from a Box object.
 
std::unique_ptr< ZonoZonoOpt::make_regular_zono_2D (zono_float radius, int n_sides, bool outer_approx=false, const Eigen::Vector< zono_float, 2 > &c=Eigen::Vector< zono_float, 2 >::Zero())
 Builds a 2D regular zonotope with a given radius and number of sides.
 
void ZonoOpt::to_json (const HybZono &Z, const std::string &filename)
 Write a HybZono object to a JSON file.
 
std::unique_ptr< ConZonoZonoOpt::vrep_2_conzono (const Eigen::Matrix< zono_float, -1, -1 > &Vpoly)
 Builds a constrained zonotope from a vertex representation polytope.
 
std::unique_ptr< HybZonoZonoOpt::vrep_2_hybzono (const std::vector< Eigen::Matrix< zono_float, -1, -1 > > &Vpolys, bool expose_indicators=false)
 Computes a hybrid zonotope from a union of vertex representation polytopes.
 
std::unique_ptr< HybZonoZonoOpt::zono_union_2_hybzono (std::vector< std::shared_ptr< Zono > > &Zs, bool expose_indicators=false)
 Computes a hybrid zonotope from a union of zonotopes.
 

Detailed Description

Setup functions for ZonoOpt library.

Function Documentation

◆ from_json()

std::unique_ptr< HybZono > ZonoOpt::from_json ( const std::string &  filename)

Read a HybZono object from a JSON file.

Parameters
filenameThe name of the JSON file to read from
Returns
zonotopic set
Exceptions
std::runtime_errorif the file cannot be opened or the JSON contains an unrecognized set type.
std::invalid_argumentif the JSON contains malformed triplet data (e.g., mismatched triplet vector sizes or out-of-range indices).

◆ interval_2_zono()

std::unique_ptr< Zono > ZonoOpt::interval_2_zono ( const Box box)

Builds a zonotope from a Box object.

Parameters
boxBox object (vector of intervals)
Returns
zonotope

◆ make_regular_zono_2D()

std::unique_ptr< Zono > ZonoOpt::make_regular_zono_2D ( zono_float  radius,
int  n_sides,
bool  outer_approx = false,
const Eigen::Vector< zono_float, 2 > &  c = Eigen::Vector< zono_float, 2>::Zero() 
)

Builds a 2D regular zonotope with a given radius and number of sides.

Parameters
radiusradius of the zonotope
n_sidesnumber of sides (must be an even number >= 4)
outer_approxflag to do an outer approximation instead of an inner approximation
ccenter vector
Returns
zonotope
Exceptions
std::invalid_argumentif n_sides is not even or less than 4, or if radius is not positive.

◆ to_json()

void ZonoOpt::to_json ( const HybZono Z,
const std::string &  filename 
)

Write a HybZono object to a JSON file.

Parameters
Zzonotopic set
filenamethe name of the JSON file to write to
Exceptions
std::runtime_errorif Z is an unrecognized set type or the file cannot be opened for writing.

◆ vrep_2_conzono()

std::unique_ptr< ConZono > ZonoOpt::vrep_2_conzono ( const Eigen::Matrix< zono_float, -1, -1 > &  Vpoly)

Builds a constrained zonotope from a vertex representation polytope.

Parameters
Vpolyvertices of V-rep polytope
Returns
constrained zonotope

Vpoly is a matrix where each row is a vertex of the polytope.

◆ vrep_2_hybzono()

std::unique_ptr< HybZono > ZonoOpt::vrep_2_hybzono ( const std::vector< Eigen::Matrix< zono_float, -1, -1 > > &  Vpolys,
bool  expose_indicators = false 
)

Computes a hybrid zonotope from a union of vertex representation polytopes.

Parameters
VpolysV-rep polytopes to be unioned.
expose_indicatorsFlag to append indicator set to the union.
Returns
zonotopic set

Vpolys is a vector of matrices, where each matrix represents a polytope in vertex representation. Each row in each polytope matrix is a vertex of the polytope, and each column corresponds to a dimension. The function constructs a hybrid zonotope in [0,1] form that represents the union of these polytopes. This function computes union of sets {V0, V1, ..., Vn}. If expose_indicators is true, returns union({V0, ..., Vn}) x I where I is the indicator set for the union. Specifically, each dimension of I corresponds to one of the Vi in the union. So for vrep_2_hybzono({V0, V1, V2}, true) with V0, V1, V2 not intersecting, if a vector [z, i] is in union({V0, V1, V2}) x I, then i = [1, 0, 0] if z is in V0, etc.

Exceptions
std::invalid_argumentif Vpolys is empty or if its polytopes do not all share the same number of dimensions.

◆ zono_union_2_hybzono()

std::unique_ptr< HybZono > ZonoOpt::zono_union_2_hybzono ( std::vector< std::shared_ptr< Zono > > &  Zs,
bool  expose_indicators = false 
)

Computes a hybrid zonotope from a union of zonotopes.

Parameters
ZsA vector of zonotopes to be unioned.
expose_indicatorsFlag to append indicator set to the union.
Returns
zonotopic set

This function computes union of sets {Z0, Z1, ..., Zn}. This can be more efficient than union_of_many if all sets are zonotopes because generators can be reused. If expose_indicators is true, returns union({Z0, ..., Zn}) x I where I is the indicator set for the union. Specifically, each dimension of I corresponds to one of the Zi in the union. So for zono_union_2_hybzono({Z0, Z1, Z2}, true) with Z0, Z1, VZ2 not intersecting, if a vector [z, i] is in union({Z0, Z1, Z2}) x I, then i = [1, 0, 0] if z is in Z0, etc.

Exceptions
std::invalid_argumentif Zs is empty or if its zonotopes do not all share the same dimension.