ZonoOpt v2.0.1
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 <Intervals.hpp>

Public Member Functions

 Box ()=default
 Default constructor.
 
 Box (const size_t size)
 Default construct with size specified.
 
 Box (const std::vector< Interval > &vals)
 Constructor using 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.
 
virtual ~Box ()=default
 Virtual destructor.
 
Boxoperator= (const Box &other)
 Copy assignment.
 
 Box (const Box &other)
 Copy constructor.
 
IntervalView operator[] (size_t i)
 Element-wise access, used for assignment.
 
Interval operator[] (size_t i) const
 Element-wise access.
 
size_t size () const
 get size of Box object
 
virtual void project (Eigen::Ref< Eigen::Vector< zono_float, -1 > > x) const
 Projects vector onto the Box.
 
virtual Boxclone () const
 Clone operation.
 
const Eigen::Vector< zono_float, -1 > & lower () const
 Get lower bounds.
 
const Eigen::Vector< zono_float, -1 > & upper () const
 Get upper bounds.
 
zono_float width () const
 Get width of box.
 
Eigen::Vector< zono_float, -1 > center () const
 get center of box
 
Box operator+ (const Box &other) const
 elementwise addition
 
Box operator- (const Box &other) const
 elementwise subtraction
 
Box operator* (const Box &other) const
 elementwise multiplication
 
Box operator* (zono_float alpha) const
 elementwise multiplication with scalar
 
Box operator/ (const Box &other) const
 elementwise division
 
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.
 
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, Eigen::RowMajor > &A) const
 Linear map of box based on interval arithmetic.
 
Interval dot (const Eigen::Vector< zono_float, -1 > &x) const
 Linear map with vector.
 
void permute (const Eigen::PermutationMatrix< Eigen::Dynamic, Eigen::Dynamic > &P)
 Permutes in place using permutation matrix, i.e., [x] <- P*[x].
 
std::string print () const
 Print method.
 

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

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

Detailed Description

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

Constructor & Destructor Documentation

◆ Box() [1/5]

ZonoOpt::Box::Box ( )
default

Default constructor.

◆ Box() [2/5]

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

Default construct with size specified.

Parameters
sizedimension of box

◆ Box() [3/5]

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

Constructor using vector of intervals.

Parameters
valsvector of intervals

◆ Box() [4/5]

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

◆ ~Box()

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

Virtual destructor.

◆ Box() [5/5]

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

Copy constructor.

Parameters
otherother Box object

Member Function Documentation

◆ 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

◆ 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.

◆ 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.

◆ dot()

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

Linear map with vector.

Parameters
xvector
Returns
Interval

◆ linear_map() [1/2]

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

◆ linear_map() [2/2]

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

◆ lower()

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

Get lower bounds.

Returns
const reference to lower bounds

◆ operator*() [1/2]

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

elementwise multiplication

Parameters
otherrhs box
Returns
this * other (elementwise)

◆ operator*() [2/2]

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

elementwise multiplication with scalar

Parameters
alphascalar multiplier
Returns
alpha * this (elementwise)

◆ operator+()

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

elementwise addition

Parameters
otherrhs box
Returns
this + other (elementwise)

◆ operator-()

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

elementwise subtraction

Parameters
otherrhs box
Returns
this - other (elementwise)

◆ operator/()

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

elementwise division

Parameters
otherrhs box
Returns
this / other (elementwise)

◆ operator=()

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

Copy assignment.

Parameters
otherother Box object
Returns
this = other

◆ operator[]() [1/2]

IntervalView ZonoOpt::Box::operator[] ( size_t  i)

Element-wise access, used for assignment.

Parameters
iindex
Returns
IntervalView for element i in Box

◆ operator[]() [2/2]

Interval ZonoOpt::Box::operator[] ( size_t  i) const

Element-wise access.

Parameters
iindex
Returns
Interval for element i in Box

◆ 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

◆ 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

◆ size()

size_t ZonoOpt::Box::size ( ) const

get size of Box object

Returns
size of box

◆ 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 sum of the widths of each interval in the box

Friends And Related Symbol Documentation

◆ 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: