![]() |
aGrUM
0.16.0
|
Defines a discrete random variable over an integer interval. More...
#include <rangeVariable.h>
Public Member Functions | |
virtual const std::string | domain () const |
string represent the domain of the variable More... | |
Idx | operator[] (const std::string &label) const |
from the label to its index in var. 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... | |
Constructors / Destructors | |
RangeVariable (const std::string &aName, const std::string &aDesc, long minVal, long maxVal) | |
constructors More... | |
RangeVariable (const std::string &aName, const std::string &aDesc) | |
by de default min=0, max=1 More... | |
RangeVariable (const RangeVariable &aDRV) | |
Copy Constructor. More... | |
virtual | ~RangeVariable () |
destructor More... | |
virtual DiscreteVariable * | clone () const |
Copy Factory. More... | |
Accessors / Modifiers | |
virtual Size | domainSize () const |
returns the size of the random discrete variable domain More... | |
virtual VarType | varType () const |
returns the type of variable More... | |
virtual std::string | label (Idx indice) const |
Get the indice-th label. More... | |
virtual double | numerical (Idx indice) const |
get a numerical representation of he indice-the value. More... | |
long | minVal () const |
Returns the lower bound. More... | |
void | setMinVal (long minVal) |
Set a new value for the lower bound. More... | |
long | maxVal () const |
Returns the upper bound. More... | |
void | setMaxVal (long maxVal) |
Set a new value of the upper bound. More... | |
bool | belongs (long val) const |
Returns true if the param belongs to the variable's interval. More... | |
virtual Idx | index (const std::string &) const |
Operators | |
RangeVariable & | operator= (const RangeVariable &aRV) |
Copy operator. More... | |
Accessors / Modifiers | |
bool | empty () const |
std::vector< std::string > | labels () const |
vector of labels More... | |
Operators | |
virtual bool | operator== (const DiscreteVariable &aRV) const |
equality operator More... | |
virtual bool | operator!= (const DiscreteVariable &aRV) const |
inequality operator 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... | |
Defines a discrete random variable over an integer interval.
It is technically possible to create RangeVariable with minVal > maxVal (or modify in that way an already created RangeVariable). The result is an empty variable (i.e. empty() returns true). If maxVal - minVal < 0, then domainsize() = 0.
Definition at line 54 of file rangeVariable.h.
gum::RangeVariable::RangeVariable | ( | const std::string & | aName, |
const std::string & | aDesc, | ||
long | minVal, | ||
long | maxVal | ||
) |
constructors
Definition at line 41 of file rangeVariable.cpp.
Referenced by clone().
gum::RangeVariable::RangeVariable | ( | const std::string & | aName, |
const std::string & | aDesc | ||
) |
by de default min=0, max=1
Definition at line 50 of file rangeVariable.cpp.
gum::RangeVariable::RangeVariable | ( | const RangeVariable & | aDRV | ) |
Copy Constructor.
If aDRV haves any listener, it will not be copied.
aDRV | the variable we copy |
Definition at line 62 of file rangeVariable.cpp.
|
virtual |
destructor
Definition at line 71 of file rangeVariable.cpp.
|
protectedinherited |
protected copy
aRV | to be copied |
INLINE bool gum::RangeVariable::belongs | ( | long | val | ) | const |
Returns true if the param belongs to the variable's interval.
Definition at line 95 of file rangeVariable_inl.h.
References __maxBound, and __minBound.
Referenced by index(), and label().
|
virtual |
Copy Factory.
Implements gum::DiscreteVariable.
Definition at line 38 of file rangeVariable_inl.h.
References RangeVariable().
|
inherited |
returns the description of the variable
|
virtual |
string represent the domain of the variable
Implements gum::DiscreteVariable.
Definition at line 73 of file rangeVariable.cpp.
References maxVal(), and minVal().
|
virtual |
returns the size of the random discrete variable domain
(or modify in that way an already created RangeVariable). The result is an empty variable (i.e. empty() returns true). If maxVal - minVal < 0, then domainsize() = 0.maxVal
Implements gum::DiscreteVariable.
Definition at line 43 of file rangeVariable_inl.h.
References __maxBound, and __minBound.
|
inherited |
|
virtual |
NotFound |
Implements gum::DiscreteVariable.
Definition at line 67 of file rangeVariable_inl.h.
References __minBound, belongs(), and GUM_ERROR.
|
virtual |
Get the indice-th label.
indice | the index of the label we wish to return |
OutOfBound |
Implements gum::DiscreteVariable.
Definition at line 50 of file rangeVariable_inl.h.
References __minBound, belongs(), and GUM_ERROR.
|
inherited |
vector of labels
INLINE long gum::RangeVariable::maxVal | ( | ) | const |
Returns the upper bound.
Definition at line 89 of file rangeVariable_inl.h.
References __maxBound.
Referenced by domain(), and setMaxVal().
INLINE long gum::RangeVariable::minVal | ( | ) | const |
Returns the lower bound.
Definition at line 83 of file rangeVariable_inl.h.
References __minBound.
Referenced by domain(), and setMinVal().
|
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().
get a numerical representation of he indice-the value.
Implements gum::DiscreteVariable.
Definition at line 62 of file rangeVariable_inl.h.
References __minBound.
inequality operator
|
virtualinherited |
inequality operator
INLINE RangeVariable & gum::RangeVariable::operator= | ( | const RangeVariable & | aRV | ) |
Copy operator.
aRV | to be copied |
Definition at line 102 of file rangeVariable_inl.h.
References __maxBound, and __minBound.
equality operator
|
virtualinherited |
equality operator
|
inlineinherited |
from the label to its index in var.
NotFound |
Definition at line 140 of file discreteVariable.h.
References gum::DiscreteVariable::domain(), gum::DiscreteVariable::index(), gum::DiscreteVariable::label(), gum::DiscreteVariable::toString(), and gum::DiscreteVariable::toStringWithDescription().
|
inherited |
sets the description of the variable
theValue |
INLINE void gum::RangeVariable::setMaxVal | ( | long | maxVal | ) |
Set a new value of the upper bound.
Definition at line 92 of file rangeVariable_inl.h.
References __maxBound, and maxVal().
INLINE void gum::RangeVariable::setMinVal | ( | long | minVal | ) |
Set a new value for the lower bound.
Definition at line 86 of file rangeVariable_inl.h.
References __minBound, and minVal().
|
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().
|
inherited |
string version of *this
Referenced by gum::DiscreteVariable::operator[]().
|
inherited |
string version of *this using description attribute instead of name.
Referenced by gum::DiscreteVariable::operator[]().
|
virtual |
returns the type of variable
Implements gum::DiscreteVariable.
Definition at line 108 of file rangeVariable_inl.h.
References gum::Range.
|
private |
The upper bound.
Definition at line 164 of file rangeVariable.h.
Referenced by belongs(), domainSize(), maxVal(), operator=(), and setMaxVal().
|
private |
The lower bound.
Definition at line 161 of file rangeVariable.h.
Referenced by belongs(), domainSize(), index(), label(), minVal(), numerical(), operator=(), and setMinVal().