ZonoOpt 2.5.0
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | Friends | List of all members
ZonoOpt::Box Class Reference

Box (i.e., interval vector) class. More...

#include <Box.hpp>

Public Member Functions

Box affine_map (const Eigen::Matrix< zono_float, -1, -1 > &R, const Eigen::Vector< zono_float, -1 > &s=Eigen::Vector< zono_float, -1 >()) const
 Affine map R*[x] + s of the box based on interval arithmetic.
 
Box affine_map (const Eigen::SparseMatrix< zono_float > &R, const Eigen::Vector< zono_float, -1 > &s=Eigen::Vector< zono_float, -1 >()) const
 Affine map R*[x] + s of the box based on interval arithmetic.
 
Box affine_map (const Eigen::SparseMatrix< zono_float, Eigen::RowMajor > &R, const Eigen::Vector< zono_float, -1 > &s=Eigen::Vector< zono_float, -1 >()) const
 Affine map R*[x] + s of the box based on interval arithmetic.
 
 Box ()=default
 Default constructor.
 
 Box (const Box &other)
 Copy constructor.
 
 Box (const Eigen::Vector< Interval, -1 > &vals)
 Constructor using Eigen vector of intervals.
 
 Box (const Eigen::Vector< zono_float, -1 > &x_lb, const Eigen::Vector< zono_float, -1 > &x_ub)
 Constructor from intervals of lower and upper bounds.
 
 Box (const size_t size)
 Default construct with size specified.
 
 Box (const std::vector< Interval > &vals)
 Constructor using vector of intervals.
 
Box cartesian_product (const Box &other) const
 Cartesian product of this box and other.
 
Eigen::Vector< zono_float, -1 > center () const
 Get center of box.
 
virtual Box * clone () const
 Clone operation.
 
bool contains (const Eigen::Vector< zono_float, -1 > &v)
 Check vector continment.
 
bool contains_set (const Box &other) const
 Check set containment.
 
bool contract (const Eigen::SparseMatrix< zono_float, Eigen::RowMajor > &A, const Eigen::Vector< zono_float, -1 > &b, int iter)
 Interval contractor.
 
bool contract_subset (const Eigen::SparseMatrix< zono_float, Eigen::RowMajor > &A_rm, const Eigen::Vector< zono_float, -1 > &b, int iter, const Eigen::SparseMatrix< zono_float > &A, const std::set< int > &inds, int tree_search_depth)
 Interval contractor over a subset of the dimensions of the box.
 
Interval dot (const Eigen::Vector< zono_float, -1 > &x) const
 Linear map with vector.
 
Interval get_element (int i) const
 Element-wise access.
 
Box intersect (const Box &other) const
 Box intersection.
 
Box intersection_over_dims (const Box &other, const std::vector< int > &dims) const
 Box intersection over a subset of dimensions.
 
Box interval_hull (const Box &other) const
 Box interval hull.
 
bool is_empty () const
 Determine whether box is empty (any contained interval is empty)
 
bool is_single_valued () const
 Determine whether box is single-valued (i.e., all intervals have width 0 within numerical tolerance)
 
Box linear_map (const Eigen::Matrix< zono_float, -1, -1 > &A) const
 Linear map of box based on interval arithmetic.
 
Box linear_map (const Eigen::SparseMatrix< zono_float > &A) const
 Linear map of box based on interval arithmetic.
 
Box linear_map (const Eigen::SparseMatrix< zono_float, Eigen::RowMajor > &A) const
 Linear map of box based on interval arithmetic.
 
const Eigen::Vector< zono_float, -1 > & lower () const
 Get lower bounds.
 
Box minkowski_sum (const Box &other) const
 Minkowski sum of this box and other.
 
Box operator& (const Box &other) const
 Box intersection.
 
Box operator* (const Box &other) const
 Elementwise multiplication.
 
Box operator* (const Eigen::Vector< zono_float, -1 > &v) const
 Elementwise multiplication with vector.
 
Box operator* (const Interval &interval) const
 Elementwise multiplication with interval.
 
Box operator* (zono_float alpha) const
 Elementwise multiplication with scalar.
 
void operator*= (const Box &other)
 Elementwise multiplication in-place.
 
void operator*= (const Eigen::Vector< zono_float, -1 > &v)
 Elementwise multiplication with vector in-place.
 
void operator*= (const Interval &interval)
 Elementwise multiplication with interval in-place.
 
void operator*= (zono_float alpha)
 Elementwise multiplication with scalar in-place.
 
Box operator+ (const Box &other) const
 Elementwise addition.
 
Box operator+ (const Eigen::Vector< zono_float, -1 > &v) const
 Elementwise addition with vector.
 
void operator+= (const Box &other)
 Elementwise addition in-place.
 
void operator+= (const Eigen::Vector< zono_float, -1 > &v)
 Elementwise addition with vector in-place.
 
Box operator- () const
 Unary minus: returns -1 * this.
 
Box operator- (const Box &other) const
 Elementwise subtraction.
 
Box operator- (const Eigen::Vector< zono_float, -1 > &v) const
 Elementwise subtraction with vector.
 
void operator-= (const Box &other)
 Elementwise subtraction in-place.
 
void operator-= (const Eigen::Vector< zono_float, -1 > &v)
 Elementwise subtraction with vector in-place.
 
Box operator/ (const Box &other) const
 Elementwise division.
 
Box operator/ (const Interval &interval) const
 Elementwise division with interval.
 
Box operator/ (zono_float alpha) const
 Elementwise division with scalar.
 
void operator/= (const Box &other)
 Elementwise division in-place.
 
void operator/= (const Interval &interval)
 Elementwise division with interval in-place.
 
void operator/= (zono_float alpha)
 Elementwise division with scalar.
 
bool operator<= (const Box &other) const
 Set containment operator.
 
Box & operator= (const Box &other)
 Copy assignment.
 
bool operator== (const Box &other) const
 Set equality operator.
 
bool operator>= (const Box &other) const
 Set containment operator.
 
Box operator| (const Box &other) const
 Box interval hull.
 
void permute (const Eigen::PermutationMatrix< Eigen::Dynamic, Eigen::Dynamic > &P)
 Permutes in place using permutation matrix, i.e., [x] <- P*[x].
 
Box pontry_diff (const Box &other) const
 Pontryagin difference of this box and other, i.e., {x : x + y is in this for all y in other}.
 
std::string print () const
 Print method.
 
virtual void project (Eigen::Ref< Eigen::Vector< zono_float, -1 > > x) const
 Projects vector onto the Box.
 
Box project_onto_dims (const std::vector< int > &dims) const
 Projects the box onto the dimensions specified in dims.
 
Box radius () const
 Get radius of box.
 
void set_element (int i, const Interval &val)
 Element-wise assignment.
 
size_t size () const
 Get size of Box object.
 
zono_float support (const Eigen::Vector< zono_float, -1 > &d) const
 Computes the support function of the box in the direction d.
 
std::vector< Interval > to_array () const
 Convert to vector of intervals.
 
const Eigen::Vector< zono_float, -1 > & upper () const
 Get upper bounds.
 
zono_float width () const
 Get width of box.
 
virtual ~Box ()=default
 Virtual destructor.
 

Protected Attributes

Eigen::Vector< zono_float, -1 > x_lb
 vector of lower bounds
 
Eigen::Vector< zono_float, -1 > x_ub
 vector of upper bounds
 

Friends

class detail::MI_Box
 
Box operator* (const Eigen::Matrix< zono_float, -1, -1 > &A, const Box &box)
 Linear map.
 
Box operator* (const Eigen::SparseMatrix< zono_float, Eigen::RowMajor > &A, const Box &box)
 Linear map.
 
Box operator* (const Eigen::Vector< zono_float, -1 > &v, const Box &box)
 Elementwise multiplication with vector.
 
Box operator* (const Interval &interval, const Box &box)
 Elementwise multiplication with interval.
 
Box operator* (zono_float alpha, const Box &box)
 Elementwise multiplication with scalar.
 
Box operator+ (const Eigen::Vector< zono_float, -1 > &v, const Box &box)
 Elementwise addition with vector.
 
Box operator- (const Eigen::Vector< zono_float, -1 > &v, const Box &box)
 Elementwise subtraction with vector.
 
Box operator/ (const Interval &interval, const Box &box)
 Elementwise division with interval.
 
Box operator/ (zono_float alpha, const Box &box)
 Elementwise division with scalar.
 
std::ostream & operator<< (std::ostream &os, const Box &box)
 print to ostream
 

Detailed Description

Box (i.e., interval vector) class.

Warning
Unlike HybZono and its subclasses, Box operators have interval-arithmetic semantics, not set-operation semantics. Specifically, Box::operator* is elementwise interval multiplication (not Cartesian product) and Box::operator- is interval subtraction [a,b] - [c,d] = [a-d, b-c] (not the Pontryagin difference [a-c, b-d]). Use the named methods cartesian_product() and pontry_diff() for the set-operation meanings. Box::operator+ is elementwise interval addition, which for boxes coincides exactly with the Minkowski sum; minkowski_sum() is a named alias for it.

Constructor & Destructor Documentation

◆ Box() [1/6]

ZonoOpt::Box::Box ( )
default

Default constructor.

◆ Box() [2/6]

ZonoOpt::Box::Box ( const size_t  size)
explicit

Default construct with size specified.

Parameters
sizedimension of box

◆ Box() [3/6]

ZonoOpt::Box::Box ( const std::vector< Interval > &  vals)
explicit

Constructor using vector of intervals.

Parameters
valsvector of intervals

◆ Box() [4/6]

ZonoOpt::Box::Box ( const Eigen::Vector< Interval, -1 > &  vals)
explicit

Constructor using Eigen vector of intervals.

Parameters
valsEigen vector of intervals

◆ Box() [5/6]

ZonoOpt::Box::Box ( const Eigen::Vector< zono_float, -1 > &  x_lb,
const Eigen::Vector< zono_float, -1 > &  x_ub 
)

Constructor from intervals of lower and upper bounds.

Parameters
x_lbvector of lower bounds
x_ubvector of upper bounds
Exceptions
std::invalid_argumentif x_lb and x_ub do not have the same size.

◆ ~Box()

virtual ZonoOpt::Box::~Box ( )
virtualdefault

Virtual destructor.

◆ Box() [6/6]

ZonoOpt::Box::Box ( const Box &  other)

Copy constructor.

Parameters
otherother Box object

Member Function Documentation

◆ affine_map() [1/3]

Box ZonoOpt::Box::affine_map ( const Eigen::Matrix< zono_float, -1, -1 > &  R,
const Eigen::Vector< zono_float, -1 > &  s = Eigen::Vector<zono_float, -1>() 
) const

Affine map R*[x] + s of the box based on interval arithmetic.

Parameters
Rmap matrix (dense)
svector offset, defaults to zero
Returns
affine mapped box
Exceptions
std::invalid_argumentif R, s, and the Box have inconsistent dimensions.

◆ affine_map() [2/3]

Box ZonoOpt::Box::affine_map ( const Eigen::SparseMatrix< zono_float > &  R,
const Eigen::Vector< zono_float, -1 > &  s = Eigen::Vector<zono_float, -1>() 
) const

Affine map R*[x] + s of the box based on interval arithmetic.

Parameters
Rmap matrix (sparse column major)
svector offset, defaults to zero
Returns
affine mapped box
Exceptions
std::invalid_argumentif R, s, and the Box have inconsistent dimensions.

◆ affine_map() [3/3]

Box ZonoOpt::Box::affine_map ( const Eigen::SparseMatrix< zono_float, Eigen::RowMajor > &  R,
const Eigen::Vector< zono_float, -1 > &  s = Eigen::Vector<zono_float, -1>() 
) const

Affine map R*[x] + s of the box based on interval arithmetic.

Parameters
Rmap matrix (sparse row major)
svector offset, defaults to zero
Returns
affine mapped box
Exceptions
std::invalid_argumentif R, s, and the Box have inconsistent dimensions.

◆ cartesian_product()

Box ZonoOpt::Box::cartesian_product ( const Box &  other) const

Cartesian product of this box and other.

Parameters
otherother box
Returns
Box of dimension size() + other.size() with this box's intervals first
Note
Box::operator* is elementwise interval multiplication, NOT the Cartesian product. This differs from HybZono, where operator* is the Cartesian product.

◆ center()

Eigen::Vector< zono_float, -1 > ZonoOpt::Box::center ( ) const

Get center of box.

Returns
center of box

◆ clone()

Box * ZonoOpt::Box::clone ( ) const
virtual

Clone operation.

Returns
pointer to newly created object

◆ contains()

bool ZonoOpt::Box::contains ( const Eigen::Vector< zono_float, -1 > &  v)

Check vector continment.

Parameters
vvector
Returns
true if v is contained in box, false otherwise
Exceptions
std::invalid_argumentif v does not have the same size as the Box.

◆ contains_set()

bool ZonoOpt::Box::contains_set ( const Box &  other) const

Check set containment.

Parameters
otherbox to check if subset
Returns
true if other is a subset of this
Exceptions
std::invalid_argumentif this and other have inconsistent dimensions.

◆ contract()

bool ZonoOpt::Box::contract ( const Eigen::SparseMatrix< zono_float, Eigen::RowMajor > &  A,
const Eigen::Vector< zono_float, -1 > &  b,
int  iter 
)

Interval contractor.

Parameters
Aconstraint matrix (row-major)
bconstraint vector
iternumber of contractor iterations
Returns
flag indicating that the contractor did not detect that A*x=b and the box do not intersect

Executes a forward-backward interval contractor for the equality constraint A*x=b. For points x in the box, this shrinks the box without removing any points x that satisfy A*x=b. If the contractor detects that the box does not intersect A*x=b, then this function will return false.

Exceptions
std::invalid_argumentif iter is not positive.

◆ contract_subset()

bool ZonoOpt::Box::contract_subset ( const Eigen::SparseMatrix< zono_float, Eigen::RowMajor > &  A_rm,
const Eigen::Vector< zono_float, -1 > &  b,
int  iter,
const Eigen::SparseMatrix< zono_float > &  A,
const std::set< int > &  inds,
int  tree_search_depth 
)

Interval contractor over a subset of the dimensions of the box.

Parameters
A_rmconstraint matrix, row major
bconstraint vector
iternumber of contractor iterations
Aconstraint matrix, column major
indsbox dimension indices
tree_search_depthhow deep to search constraint tree
Returns
flag indicating that the contractor did not detect that A*x=b and the box do not intersect

This is a forward-backward contractor over a subset of the dimensions of the box. This detects what other dimensions are affected up to a specified search depth prior to executing the contractor.

Exceptions
std::invalid_argumentif iter is not positive or if A_rm does not match A.

◆ dot()

Interval ZonoOpt::Box::dot ( const Eigen::Vector< zono_float, -1 > &  x) const

Linear map with vector.

Parameters
xvector
Returns
Interval
Exceptions
std::invalid_argumentif x does not have the same size as the Box.

◆ get_element()

Interval ZonoOpt::Box::get_element ( int  i) const

Element-wise access.

Parameters
iindex
Returns
Interval for element i in Box
Exceptions
std::out_of_rangeif i is outside [0, size()).

◆ intersect()

Box ZonoOpt::Box::intersect ( const Box &  other) const

Box intersection.

Parameters
otherother
Returns
intersection of this and other
Exceptions
std::invalid_argumentif this and other have inconsistent dimensions.

◆ intersection_over_dims()

Box ZonoOpt::Box::intersection_over_dims ( const Box &  other,
const std::vector< int > &  dims 
) const

Box intersection over a subset of dimensions.

Parameters
otherother box, must have size equal to dims.size()
dimsdimensions of this box over which the intersection is computed
Returns
intersection of this and other over the specified dimensions
Exceptions
std::invalid_argumentif dims.size() does not equal other.size(), or if any entry in dims is not a valid dimension of this box.

This computes the exact intersection {x in this : x(dims) in other}. Repeated indices in dims are intersected cumulatively.

◆ interval_hull()

Box ZonoOpt::Box::interval_hull ( const Box &  other) const

Box interval hull.

Parameters
otherother box
Returns
interval hull of this and other
Exceptions
std::invalid_argumentif this and other have inconsistent dimensions.

◆ is_empty()

bool ZonoOpt::Box::is_empty ( ) const

Determine whether box is empty (any contained interval is empty)

Returns
true if box is empty

◆ is_single_valued()

bool ZonoOpt::Box::is_single_valued ( ) const

Determine whether box is single-valued (i.e., all intervals have width 0 within numerical tolerance)

Returns
true if box is single-valued

◆ linear_map() [1/3]

Box ZonoOpt::Box::linear_map ( const Eigen::Matrix< zono_float, -1, -1 > &  A) const

Linear map of box based on interval arithmetic.

Parameters
Amap matrix (dense)
Returns
Linear mapped box
Exceptions
std::invalid_argumentif A's number of columns does not equal the size of the Box.

◆ linear_map() [2/3]

Box ZonoOpt::Box::linear_map ( const Eigen::SparseMatrix< zono_float > &  A) const

Linear map of box based on interval arithmetic.

Parameters
Amap matrix (sparse column major)
Returns
Linear mapped box
Exceptions
std::invalid_argumentif A's number of columns does not equal the size of the Box.

◆ linear_map() [3/3]

Box ZonoOpt::Box::linear_map ( const Eigen::SparseMatrix< zono_float, Eigen::RowMajor > &  A) const

Linear map of box based on interval arithmetic.

Parameters
Amap matrix (sparse row major)
Returns
Linear mapped box
Exceptions
std::invalid_argumentif A's number of columns does not equal the size of the Box.

◆ lower()

const Eigen::Vector< zono_float, -1 > & ZonoOpt::Box::lower ( ) const
inline

Get lower bounds.

Returns
const reference to lower bounds

◆ minkowski_sum()

Box ZonoOpt::Box::minkowski_sum ( const Box &  other) const

Minkowski sum of this box and other.

Parameters
otherother box
Returns
Minkowski sum of this and other
Note
For boxes, the Minkowski sum coincides exactly with elementwise interval addition, so this is a named alias for Box::operator+.
Exceptions
std::invalid_argumentif this and other have inconsistent dimensions.

◆ operator&()

Box ZonoOpt::Box::operator& ( const Box &  other) const

Box intersection.

Parameters
otherother box
Returns
Intersection of this and other
Exceptions
std::invalid_argumentif this and other have inconsistent dimensions.

◆ operator*() [1/4]

Box ZonoOpt::Box::operator* ( const Box &  other) const

Elementwise multiplication.

Parameters
otherrhs box
Returns
enclosure of this * other (elementwise)
Exceptions
std::invalid_argumentif this and other have inconsistent dimensions.

◆ operator*() [2/4]

Box ZonoOpt::Box::operator* ( const Eigen::Vector< zono_float, -1 > &  v) const

Elementwise multiplication with vector.

Parameters
vvector to multiply
Returns
enclosure of this * v (elementwise)
Exceptions
std::invalid_argumentif v does not have the same size as the Box.

◆ operator*() [3/4]

Box ZonoOpt::Box::operator* ( const Interval &  interval) const

Elementwise multiplication with interval.

Parameters
intervalinterval to multiply
Returns
enclosure of this * interval (elementwise)

◆ operator*() [4/4]

Box ZonoOpt::Box::operator* ( zono_float  alpha) const

Elementwise multiplication with scalar.

Parameters
alphascalar multiplier
Returns
enclosure of alpha * this (elementwise)

◆ operator*=() [1/4]

void ZonoOpt::Box::operator*= ( const Box &  other)

Elementwise multiplication in-place.

Parameters
otherother box
Exceptions
std::invalid_argumentif this and other have inconsistent dimensions.

◆ operator*=() [2/4]

void ZonoOpt::Box::operator*= ( const Eigen::Vector< zono_float, -1 > &  v)

Elementwise multiplication with vector in-place.

Parameters
vvector to multiply
Exceptions
std::invalid_argumentif v does not have the same size as the Box.

◆ operator*=() [3/4]

void ZonoOpt::Box::operator*= ( const Interval &  interval)

Elementwise multiplication with interval in-place.

Parameters
intervalinterval to multiply

◆ operator*=() [4/4]

void ZonoOpt::Box::operator*= ( zono_float  alpha)

Elementwise multiplication with scalar in-place.

Parameters
alphascalar multiplier

◆ operator+() [1/2]

Box ZonoOpt::Box::operator+ ( const Box &  other) const

Elementwise addition.

Parameters
otherrhs box
Returns
enclosure of this + other (elementwise)
Exceptions
std::invalid_argumentif this and other have inconsistent dimensions.

◆ operator+() [2/2]

Box ZonoOpt::Box::operator+ ( const Eigen::Vector< zono_float, -1 > &  v) const

Elementwise addition with vector.

Parameters
vvector to add
boxbox to add
Returns
enclosure of v + box (elementwise)
Exceptions
std::invalid_argumentif v does not have the same size as the Box.

◆ operator+=() [1/2]

void ZonoOpt::Box::operator+= ( const Box &  other)

Elementwise addition in-place.

Parameters
otherother box
Exceptions
std::invalid_argumentif this and other have inconsistent dimensions.

◆ operator+=() [2/2]

void ZonoOpt::Box::operator+= ( const Eigen::Vector< zono_float, -1 > &  v)

Elementwise addition with vector in-place.

Parameters
vvector
Exceptions
std::invalid_argumentif v does not have the same size as the Box.

◆ operator-() [1/3]

Box ZonoOpt::Box::operator- ( ) const

Unary minus: returns -1 * this.

Returns
enclosure of -this

◆ operator-() [2/3]

Box ZonoOpt::Box::operator- ( const Box &  other) const

Elementwise subtraction.

Parameters
otherrhs box
Returns
enclosure of this - other (elementwise)
Exceptions
std::invalid_argumentif this and other have inconsistent dimensions.

◆ operator-() [3/3]

Box ZonoOpt::Box::operator- ( const Eigen::Vector< zono_float, -1 > &  v) const

Elementwise subtraction with vector.

Parameters
vvector to subtract
Returns
enclosure of this - v (elementwise)
Exceptions
std::invalid_argumentif v does not have the same size as the Box.

◆ operator-=() [1/2]

void ZonoOpt::Box::operator-= ( const Box &  other)

Elementwise subtraction in-place.

Parameters
otherother box
Exceptions
std::invalid_argumentif this and other have inconsistent dimensions.

◆ operator-=() [2/2]

void ZonoOpt::Box::operator-= ( const Eigen::Vector< zono_float, -1 > &  v)

Elementwise subtraction with vector in-place.

Parameters
vvector to subtract
Exceptions
std::invalid_argumentif v does not have the same size as the Box.

◆ operator/() [1/3]

Box ZonoOpt::Box::operator/ ( const Box &  other) const

Elementwise division.

Parameters
otherrhs box
Returns
enclosure of this / other (elementwise)
Exceptions
std::invalid_argumentif this and other have inconsistent dimensions.

◆ operator/() [2/3]

Box ZonoOpt::Box::operator/ ( const Interval &  interval) const

Elementwise division with interval.

Parameters
intervalinterval to divide
Returns
enclosure of this / interval (elementwise)

◆ operator/() [3/3]

Box ZonoOpt::Box::operator/ ( zono_float  alpha) const

Elementwise division with scalar.

Parameters
alphascalar divisor
Returns
enclosure of this / alpha (elementwise)

◆ operator/=() [1/3]

void ZonoOpt::Box::operator/= ( const Box &  other)

Elementwise division in-place.

Parameters
otherrhs box
Exceptions
std::invalid_argumentif this and other have inconsistent dimensions.

◆ operator/=() [2/3]

void ZonoOpt::Box::operator/= ( const Interval &  interval)

Elementwise division with interval in-place.

Parameters
intervalinterval to divide

◆ operator/=() [3/3]

void ZonoOpt::Box::operator/= ( zono_float  alpha)

Elementwise division with scalar.

Parameters
alphascalar divisor

◆ operator<=()

bool ZonoOpt::Box::operator<= ( const Box &  other) const

Set containment operator.

Parameters
other
Returns
true if this is subset of other

◆ operator=()

Box & ZonoOpt::Box::operator= ( const Box &  other)

Copy assignment.

Parameters
otherother Box object
Returns
this = other

◆ operator==()

bool ZonoOpt::Box::operator== ( const Box &  other) const

Set equality operator.

Parameters
other
Returns
true if sets are equal

◆ operator>=()

bool ZonoOpt::Box::operator>= ( const Box &  other) const

Set containment operator.

Parameters
other
Returns
true if this is superset of other

◆ operator|()

Box ZonoOpt::Box::operator| ( const Box &  other) const

Box interval hull.

Parameters
otherbox
Returns
Interval hull of this and other
Exceptions
std::invalid_argumentif this and other have inconsistent dimensions.

◆ permute()

void ZonoOpt::Box::permute ( const Eigen::PermutationMatrix< Eigen::Dynamic, Eigen::Dynamic > &  P)

Permutes in place using permutation matrix, i.e., [x] <- P*[x].

Parameters
Ppermutation matrix

◆ pontry_diff()

Box ZonoOpt::Box::pontry_diff ( const Box &  other) const

Pontryagin difference of this box and other, i.e., {x : x + y is in this for all y in other}.

Parameters
othersubtrahend
Returns
Pontryagin difference of this and other
Warning
Box::operator- is interval subtraction, i.e., [a,b] - [c,d] = [a-d, b-c], which is NOT the Pontryagin difference [a-c, b-d]. This differs from HybZono, where operator- is the Pontryagin difference.
Exceptions
std::invalid_argumentif this and other have inconsistent dimensions.

◆ print()

std::string ZonoOpt::Box::print ( ) const

Print method.

Returns
string display of Box

◆ project()

void ZonoOpt::Box::project ( Eigen::Ref< Eigen::Vector< zono_float, -1 > >  x) const
virtual

Projects vector onto the Box.

Parameters
xvector reference
Exceptions
std::invalid_argumentif x does not have the same size as the Box.

◆ project_onto_dims()

Box ZonoOpt::Box::project_onto_dims ( const std::vector< int > &  dims) const

Projects the box onto the dimensions specified in dims.

Parameters
dimsvector of dimensions
Returns
Box of dimension dims.size() whose k-th interval is this box's dims[k]-th interval

dims need not be sorted and may contain repeats.

Exceptions
std::invalid_argumentif any entry in dims is not a valid dimension of the Box.

◆ radius()

Box ZonoOpt::Box::radius ( ) const

Get radius of box.

Returns
radius of box

Returns box with intervals centered at zero with width equal to the width of the original box

◆ set_element()

void ZonoOpt::Box::set_element ( int  i,
const Interval &  val 
)

Element-wise assignment.

Parameters
iindex
valinterval to assign

◆ size()

size_t ZonoOpt::Box::size ( ) const

Get size of Box object.

Returns
size of box

◆ support()

zono_float ZonoOpt::Box::support ( const Eigen::Vector< zono_float, -1 > &  d) const

Computes the support function of the box in the direction d.

Parameters
dvector defining direction for support function
Returns
support

Computes max_{x in [x]} <x, d>. Unlike HybZono::support this is exact and closed-form (no solver settings are required), since each variable appears exactly once in the sum and there is no dependency problem.

Exceptions
std::invalid_argumentif d does not have the same size as the Box.

◆ to_array()

std::vector< Interval > ZonoOpt::Box::to_array ( ) const

Convert to vector of intervals.

Returns
std::vector<Interval>

◆ upper()

const Eigen::Vector< zono_float, -1 > & ZonoOpt::Box::upper ( ) const
inline

Get upper bounds.

Returns
const reference to upper bounds

◆ width()

zono_float ZonoOpt::Box::width ( ) const

Get width of box.

Returns
width of box

Specifically, this returns the max width for any interval in the box

Friends And Related Symbol Documentation

◆ detail::MI_Box

friend class detail::MI_Box
friend

◆ operator* [1/5]

Box operator* ( const Eigen::Matrix< zono_float, -1, -1 > &  A,
const Box &  box 
)
friend

Linear map.

Parameters
Amatrix to multiply
Returns
enclosure of A * this

◆ operator* [2/5]

Box operator* ( const Eigen::SparseMatrix< zono_float, Eigen::RowMajor > &  A,
const Box &  box 
)
friend

Linear map.

Parameters
Amatrix to multiply
Returns
enclosure of A * this

◆ operator* [3/5]

Box operator* ( const Eigen::Vector< zono_float, -1 > &  v,
const Box &  box 
)
friend

Elementwise multiplication with vector.

Parameters
vvector to multiply
boxbox to multiply
Returns
enclosure of v * box (elementwise)
Exceptions
std::invalid_argumentif v does not have the same size as the Box.

◆ operator* [4/5]

Box operator* ( const Interval &  interval,
const Box &  box 
)
friend

Elementwise multiplication with interval.

Parameters
intervalinterval to multiply
boxbox to multiply
Returns
enclosure of interval * box (elementwise)

◆ operator* [5/5]

Box operator* ( zono_float  alpha,
const Box &  box 
)
friend

Elementwise multiplication with scalar.

Parameters
alphascalar multiplier
boxbox to multiply
Returns
enclosure of alpha * box (elementwise)

◆ operator+

Box operator+ ( const Eigen::Vector< zono_float, -1 > &  v,
const Box &  box 
)
friend

Elementwise addition with vector.

Parameters
vvector to add
boxbox to add
Returns
enclosure of v + box (elementwise)
Exceptions
std::invalid_argumentif v does not have the same size as the Box.

◆ operator-

Box operator- ( const Eigen::Vector< zono_float, -1 > &  v,
const Box &  box 
)
friend

Elementwise subtraction with vector.

Parameters
vvector
boxbox to subtract
Returns
enclosure of v - box (elementwise)
Exceptions
std::invalid_argumentif v does not have the same size as the Box.

◆ operator/ [1/2]

Box operator/ ( const Interval &  interval,
const Box &  box 
)
friend

Elementwise division with interval.

Parameters
intervalinterval
boxbox to divide
Returns
enclosure of interval / box (elementwise)

◆ operator/ [2/2]

Box operator/ ( zono_float  alpha,
const Box &  box 
)
friend

Elementwise division with scalar.

Parameters
alphascalar divisor
boxbox to divide
Returns
enclosure of alpha / box (elementwise)

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const Box &  box 
)
friend

print to ostream

Parameters
osostream
boxreference to box
Returns
ostream

Member Data Documentation

◆ x_lb

Eigen::Vector<zono_float, -1> ZonoOpt::Box::x_lb
protected

vector of lower bounds

◆ x_ub

Eigen::Vector<zono_float, -1> ZonoOpt::Box::x_ub
protected

vector of upper bounds


The documentation for this class was generated from the following files: