![]() |
aGrUM
0.16.0
|
Defines a continuous random variable. More...
#include <continuousVariable.h>
Public Member Functions | |
template<> | |
float | operator[] (const std::string &str) const |
template<> | |
double | operator[] (const std::string &str) const |
Constructors / Destructors | |
ContinuousVariable (const std::string &aName, const std::string &aDesc, GUM_SCALAR lower_bound=-std::numeric_limits< GUM_SCALAR >::infinity(), GUM_SCALAR upper_bound=std::numeric_limits< GUM_SCALAR >::infinity()) | |
Default constructor. More... | |
ContinuousVariable (const ContinuousVariable< GUM_SCALAR > &from) | |
Copy Constructor. More... | |
template<typename TX_VAL > | |
ContinuousVariable (const ContinuousVariable< TX_VAL > &from) | |
generalized copy constructor More... | |
ContinuousVariable (ContinuousVariable< GUM_SCALAR > &&from) | |
move constructor More... | |
virtual | ~ContinuousVariable () |
destructor More... | |
virtual ContinuousVariable< GUM_SCALAR > * | clone () const |
Copy Factory. More... | |
Operators | |
ContinuousVariable< GUM_SCALAR > & | operator= (const ContinuousVariable< GUM_SCALAR > &from) |
copy operator More... | |
template<typename TX_VAL > | |
ContinuousVariable< GUM_SCALAR > & | operator= (const ContinuousVariable< TX_VAL > &from) |
generalized copy operator More... | |
ContinuousVariable< GUM_SCALAR > & | operator= (ContinuousVariable< GUM_SCALAR > &&from) |
move operator More... | |
GUM_SCALAR | operator[] (const std::string &str) const |
returns the T_VAL corresponding to a string More... | |
Accessors / Modifiers | |
GUM_SCALAR | lowerBound () const |
returns the lower bound of the domain of the variable More... | |
virtual double | lowerBoundAsDouble () const |
returns the lower bound of the domain of the variable as a double More... | |
GUM_SCALAR | upperBound () const |
returns the upper bound of the domain of the variable More... | |
virtual double | upperBoundAsDouble () const |
returns the upper bound of the domain of the variable as a double More... | |
void | setLowerBound (const GUM_SCALAR &new_bound) |
updates the lower bound of the domain of the variable More... | |
virtual void | setLowerBoundFromDouble (const double new_bound) |
updates the lower bound of the domain of the variable More... | |
void | setUpperBound (const GUM_SCALAR &new_bound) |
updates the lower bound of the domain of the variable More... | |
virtual void | setUpperBoundFromDouble (const double new_bound) |
updates the lower bound of the domain of the variable More... | |
virtual std::string | label (const GUM_SCALAR &value) const |
returns a string containing the value of the variable passed in argument More... | |
bool | belongs (const GUM_SCALAR &value) const |
Returns true if the param belongs to the domain of the variable. More... | |
virtual const std::string | domain () const |
returns the domain of the variable as a string More... | |
virtual VarType | varType () const |
returns the type of the variable More... | |
const std::string | toString () const |
string version of *this More... | |
const std::string | toStringWithDescription () const |
string version of *this using description attribute instead of name. More... | |
Operators | |
virtual bool | operator== (const Variable &aRV) const |
equality operator More... | |
virtual bool | operator!= (const Variable &aRV) const |
inequality operator More... | |
Accessors / Modifiers | |
void | setName (const std::string &theValue) |
sets the name of the variable More... | |
const std::string & | name () const |
returns the name of the variable More... | |
void | setDescription (const std::string &theValue) const |
sets the description of the variable More... | |
const std::string & | description () const |
returns the description of the variable More... | |
Protected Member Functions | |
void | _copy (const Variable &aRV) |
protected copy More... | |
Friends | |
template<typename TX_VAL > | |
class | ContinuousVariable |
Defines a continuous random variable.
Definition at line 47 of file continuousVariable.h.
gum::ContinuousVariable< GUM_SCALAR >::ContinuousVariable | ( | const std::string & | aName, |
const std::string & | aDesc, | ||
GUM_SCALAR | lower_bound = -std::numeric_limits< GUM_SCALAR >::infinity() , |
||
GUM_SCALAR | upper_bound = std::numeric_limits< GUM_SCALAR >::infinity() |
||
) |
Default constructor.
It is possible to create ContinuousVariable with lower_bound > upper_bound. In this case, the min and the max are swapped. By default, the range of the variable is (-inf,+inf).
gum::ContinuousVariable< GUM_SCALAR >::ContinuousVariable | ( | const ContinuousVariable< GUM_SCALAR > & | from | ) |
Copy Constructor.
gum::ContinuousVariable< GUM_SCALAR >::ContinuousVariable | ( | const ContinuousVariable< TX_VAL > & | from | ) |
generalized copy constructor
gum::ContinuousVariable< GUM_SCALAR >::ContinuousVariable | ( | ContinuousVariable< GUM_SCALAR > && | from | ) |
move constructor
|
virtual |
destructor
|
protectedinherited |
protected copy
aRV | to be copied |
bool gum::ContinuousVariable< GUM_SCALAR >::belongs | ( | const GUM_SCALAR & | value | ) | const |
Returns true if the param belongs to the domain of the variable.
|
virtual |
|
inherited |
returns the description of the variable
|
virtual |
returns the domain of the variable as a string
Implements gum::Variable.
|
virtual |
returns a string containing the value of the variable passed in argument
value | the value of the variable we wish to return |
OutOfBounds | is raised if the value does not belong to the domain of the variable |
GUM_SCALAR gum::ContinuousVariable< GUM_SCALAR >::lowerBound | ( | ) | const |
returns the lower bound of the domain of the variable
|
virtual |
returns the lower bound of the domain of the variable as a double
Implements gum::IContinuousVariable.
|
inherited |
returns the name of the variable
Referenced by gum::BNdistance< GUM_SCALAR >::__checkCompatibility(), gum::prm::PRMFactory< GUM_SCALAR >::__retrieveCommonType(), gum::prm::PRMFactory< GUM_SCALAR >::__retrieveInputs(), gum::BayesNetFactory< GUM_SCALAR >::__setCPTAndParents(), gum::GibbsBNdistance< GUM_SCALAR >::_computeKL(), gum::MultiDimImplementation< std::string >::add(), gum::Instantiation::add(), gum::FMDP< double >::addTransitionForAction(), gum::FMDP< double >::addVariable(), gum::MultiDimICIModel< GUM_SCALAR >::causalWeight(), gum::Instantiation::chgVal(), gum::learning::genericBNLearner::Database::Database(), gum::prm::PRMFactory< GUM_SCALAR >::endDiscreteType(), gum::prm::PRMFactory< GUM_SCALAR >::endDiscretizedType(), gum::FMDPFactory< GUM_SCALAR >::endVariableDeclaration(), gum::BayesNetFactory< GUM_SCALAR >::endVariableDeclaration(), gum::MarkovBlanket::hasSameStructure(), gum::BayesNetFragment< GUM_SCALAR >::nodeId(), gum::StructuredPlaner< double >::optimalPolicy2String(), gum::Estimator< GUM_SCALAR >::posterior(), gum::prm::PRMFormAttribute< GUM_SCALAR >::PRMFormAttribute(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::PRMScalarAttribute(), gum::Instantiation::setValsFrom(), gum::BayesNetFactory< GUM_SCALAR >::setVariable(), gum::BayesNetFactory< GUM_SCALAR >::setVariableValues(), gum::BayesNetFactory< GUM_SCALAR >::setVariableValuesUnchecked(), gum::MarkovBlanket::toDot(), gum::EssentialGraph::toDot(), gum::InfluenceDiagram< GUM_SCALAR >::toDot(), gum::prm::InstanceBayesNet< GUM_SCALAR >::toDot(), gum::prm::ClassBayesNet< GUM_SCALAR >::toDot(), gum::MultiDimFunctionGraph< bool, ExactTerminalNodePolicy >::toDot(), gum::Estimator< GUM_SCALAR >::update(), and gum::MultiDimFunctionGraph< bool, ExactTerminalNodePolicy >::varNodeListe().
inequality operator
ContinuousVariable< GUM_SCALAR >& gum::ContinuousVariable< GUM_SCALAR >::operator= | ( | const ContinuousVariable< GUM_SCALAR > & | from | ) |
copy operator
ContinuousVariable< GUM_SCALAR >& gum::ContinuousVariable< GUM_SCALAR >::operator= | ( | const ContinuousVariable< TX_VAL > & | from | ) |
generalized copy operator
ContinuousVariable< GUM_SCALAR >& gum::ContinuousVariable< GUM_SCALAR >::operator= | ( | ContinuousVariable< GUM_SCALAR > && | from | ) |
move operator
equality operator
GUM_SCALAR gum::ContinuousVariable< GUM_SCALAR >::operator[] | ( | const std::string & | str | ) | const |
returns the T_VAL corresponding to a string
OutOfBounds | is raised if the value does not belong to the domain of the variable |
TypeError | if the string cannot be converted into a T_VAL |
float gum::ContinuousVariable< float >::operator[] | ( | const std::string & | str | ) | const |
double gum::ContinuousVariable< double >::operator[] | ( | const std::string & | str | ) | const |
|
inherited |
sets the description of the variable
theValue |
void gum::ContinuousVariable< GUM_SCALAR >::setLowerBound | ( | const GUM_SCALAR & | new_bound | ) |
updates the lower bound of the domain of the variable
OutOfBounds | is raised if the new bound is higher than the current upper bound. |
|
virtual |
updates the lower bound of the domain of the variable
OutOfBounds | is raised if the new bound is higher than the current upper bound. |
Implements gum::IContinuousVariable.
|
inherited |
sets the name of the variable
theValue |
Referenced by gum::prm::PRMSystem< double >::__groundAttr(), gum::prm::PRMType::__updateName(), gum::FMDP< double >::addVariable(), and gum::TaxiSimulator::TaxiSimulator().
void gum::ContinuousVariable< GUM_SCALAR >::setUpperBound | ( | const GUM_SCALAR & | new_bound | ) |
updates the lower bound of the domain of the variable
OutOfBounds | is raised if the new bound is lower than the current lower bound |
|
virtual |
updates the lower bound of the domain of the variable
OutOfBounds | is raised if the new bound is lower than the current lower bound |
Implements gum::IContinuousVariable.
const std::string gum::ContinuousVariable< GUM_SCALAR >::toString | ( | ) | const |
string version of *this
const std::string gum::ContinuousVariable< GUM_SCALAR >::toStringWithDescription | ( | ) | const |
string version of *this using description attribute instead of name.
GUM_SCALAR gum::ContinuousVariable< GUM_SCALAR >::upperBound | ( | ) | const |
returns the upper bound of the domain of the variable
|
virtual |
returns the upper bound of the domain of the variable as a double
Implements gum::IContinuousVariable.
|
virtual |
returns the type of the variable
Implements gum::Variable.
|
friend |
Definition at line 185 of file continuousVariable.h.
|
private |
Definition at line 179 of file continuousVariable.h.
|
private |
Definition at line 182 of file continuousVariable.h.