#include <BoxSpace.h>
Public Member Functions | |
BoxSpace (MatNd *min, MatNd *max, std::vector< std::string > names={}) | |
BoxSpace (double min, double max, unsigned int m, unsigned int n=1, std::vector< std::string > names={}) | |
BoxSpace (const BoxSpace &) | |
BoxSpace & | operator= (const BoxSpace &) |
BoxSpace (BoxSpace &&) noexcept | |
BoxSpace & | operator= (BoxSpace &&) noexcept |
~BoxSpace () | |
bool | checkDimension (const MatNd *values, std::string *msg=NULL) const |
bool | contains (const MatNd *values, std::string *msg=NULL) const |
MatNd * | createValueMatrix () const |
void | sample (MatNd *out) const |
const MatNd * | getMin () const |
const MatNd * | getMax () const |
const std::vector< std::string > & | getNames () const |
Private Attributes | |
MatNd * | min |
MatNd * | max |
std::vector< std::string > | names |
A box in R^n.
Each coordinate is bounded by a minimum and maximum value.
This class doesn't define any advanced operations, it solely exists to clean up the C++ interface of the implementation.
Definition at line 49 of file BoxSpace.h.
Rcs::BoxSpace::BoxSpace | ( | MatNd * | min, |
MatNd * | max, | ||
std::vector< std::string > | names = {} |
||
) |
Create a box space from min/max value matrices. The shape of the matrices must match.
The BoxSpace object will assume ownership of the MatNds.
min | minimum values for each element. |
max | maximum values for each element. |
names | variable names for each element. |
Definition at line 54 of file BoxSpace.cpp.
Rcs::BoxSpace::BoxSpace | ( | double | min, |
double | max, | ||
unsigned int | m, | ||
unsigned int | n = 1 , |
||
std::vector< std::string > | names = {} |
||
) |
Create a box space with the same min/max value for all dimensions.
min | minimum value for any element |
max | maximum value for any element |
m | number of rows in space |
n | number of columns in space |
names | variable names for each element. |
Definition at line 73 of file BoxSpace.cpp.
Rcs::BoxSpace::BoxSpace | ( | const BoxSpace & | other | ) |
Definition at line 93 of file BoxSpace.cpp.
|
noexcept |
Definition at line 113 of file BoxSpace.cpp.
Rcs::BoxSpace::~BoxSpace | ( | ) |
Definition at line 141 of file BoxSpace.cpp.
bool Rcs::BoxSpace::checkDimension | ( | const MatNd * | values, |
std::string * | msg = NULL |
||
) | const |
Check if the given MatNd has the right shape for this space.
The optional parameter can take an error message to report back.
[in] | values | value matrix to check |
[out] | msg | string variable to write a message to if the values do not fit. |
Definition at line 147 of file BoxSpace.cpp.
bool Rcs::BoxSpace::contains | ( | const MatNd * | values, |
std::string * | msg = NULL |
||
) | const |
Check if the given MatNd has the right shape and it's values are valid.
The optional parameter can take an error message to report back.
[in] | values | value matrix to check |
[out] | msg | string variable to write a message to if the values do not fit. |
Definition at line 163 of file BoxSpace.cpp.
MatNd * Rcs::BoxSpace::createValueMatrix | ( | ) | const |
Create a matrix of the right shape to fit into the space.
Definition at line 197 of file BoxSpace.cpp.
|
inline |
Upper bounds for each variable.
Definition at line 137 of file BoxSpace.h.
|
inline |
Lower bounds for each variable.
Definition at line 129 of file BoxSpace.h.
|
inline |
Names for each variable.
These are intended for use in python, i.e., for pandas dataframe column names.
Definition at line 147 of file BoxSpace.h.
Definition at line 100 of file BoxSpace.cpp.
Definition at line 124 of file BoxSpace.cpp.
void Rcs::BoxSpace::sample | ( | MatNd * | out | ) | const |
Fill the given matrix out with random values fitting into the space bounds.
[out] | out | MatNd to fill. The shape must match. |
Definition at line 202 of file BoxSpace.cpp.
|
private |
Definition at line 155 of file BoxSpace.h.
|
private |
Definition at line 154 of file BoxSpace.h.
|
private |
Definition at line 159 of file BoxSpace.h.