aGrUM  0.16.0
gum::IDiscretizedVariable Class Referenceabstract

A base class for discretized variables, independent of the ticks type. More...

#include <agrum/variables/IDiscretizedVariable.h>

+ Inheritance diagram for gum::IDiscretizedVariable:
+ Collaboration diagram for gum::IDiscretizedVariable:

Public Member Functions

Idx operator[] (const std::string &label) const
 from the label to its index in var. More...
 
virtual Idx index (const std::string &label) const =0
 
virtual std::string label (Idx i) const =0
 get the indice-th label. This method is pure virtual. 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...
 
virtual const std::string domain () const =0
 string represent the domain of the variable More...
 
Constructors / Destructors
 IDiscretizedVariable (const std::string &aName, const std::string &aDesc)
 Default constructor. More...
 
 IDiscretizedVariable (const IDiscretizedVariable &from)
 Copy Constructor. More...
 
virtual ~IDiscretizedVariable ()
 destructor More...
 
virtual IDiscretizedVariableclone () const =0
 Copy Factory. More...
 
Accessors / Modifiers
virtual std::vector< doubleticksAsDoubles () const =0
 return the list of ticks as a vector of doubles More...
 
Accessors / Modifiers
bool empty () const
 
virtual Size domainSize () const =0
 
std::vector< std::string > labels () const
 vector of labels More...
 
virtual double numerical (Idx indice) const =0
 get a numerical representation of the indice-th value. More...
 
virtual VarType varType () const =0
 returns the varType of variable 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

IDiscretizedVariableoperator= (const IDiscretizedVariable &from)
 copy operator More...
 
void _copy (const Variable &aRV)
 protected copy More...
 

Detailed Description

A base class for discretized variables, independent of the ticks type.

Definition at line 40 of file IDiscretizedVariable.h.

Constructor & Destructor Documentation

◆ IDiscretizedVariable() [1/2]

gum::IDiscretizedVariable::IDiscretizedVariable ( const std::string &  aName,
const std::string &  aDesc 
)

Default constructor.

◆ IDiscretizedVariable() [2/2]

gum::IDiscretizedVariable::IDiscretizedVariable ( const IDiscretizedVariable from)

Copy Constructor.

If from has any listener, it will not be copied.

Parameters
fromthe variable we copy

◆ ~IDiscretizedVariable()

virtual gum::IDiscretizedVariable::~IDiscretizedVariable ( )
virtual

destructor

Member Function Documentation

◆ _copy()

void gum::Variable::_copy ( const Variable aRV)
protectedinherited

protected copy

Parameters
aRVto be copied

◆ clone()

virtual IDiscretizedVariable* gum::IDiscretizedVariable::clone ( ) const
pure virtual

Copy Factory.

Implements gum::DiscreteVariable.

Implemented in gum::DiscretizedVariable< T_TICKS >.

◆ description()

const std::string& gum::Variable::description ( ) const
inherited

returns the description of the variable

◆ domain()

virtual const std::string gum::DiscreteVariable::domain ( ) const
pure virtualinherited

string represent the domain of the variable

Implements gum::Variable.

Implemented in gum::DiscretizedVariable< T_TICKS >, gum::LabelizedVariable, and gum::RangeVariable.

Referenced by gum::DiscreteVariable::operator[]().

+ Here is the caller graph for this function:

◆ domainSize()

virtual Size gum::DiscreteVariable::domainSize ( ) const
pure virtualinherited
Returns
the number of modalities of the random discrete

Implemented in gum::DiscretizedVariable< T_TICKS >, gum::LabelizedVariable, and gum::RangeVariable.

Referenced by gum::MultiDimFunctionGraphManager< bool, ExactTerminalNodePolicy >::__adjacentSwap(), gum::BNdistance< GUM_SCALAR >::__checkCompatibility(), gum::MultiDimFunctionGraphManager< bool, ExactTerminalNodePolicy >::__checkIsomorphism(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__checkParameterValue(), gum::TreeOperator< GUM_SCALAR, COMBINEOPERATOR, TerminalNodePolicy >::__checkRedundancy(), gum::BayesNetFactory< GUM_SCALAR >::__checkVariableModality(), gum::Regress< GUM_SCALAR, COMBINEOPERATOR, PROJECTOPERATOR, TerminalNodePolicy >::__compute(), gum::MultiDimFunctionGraphOperator< GUM_SCALAR, FUNCTOR, TerminalNodePolicy >::__compute(), gum::prm::PRMSystem< double >::__groundAgg(), gum::StatesCounter::__incState(), gum::IMDDI< AttributeSelection, isScalar >::__insertLeafInFunctionGraph(), gum::StatesChecker::__insertState(), gum::ITI< AttributeSelection, isScalar >::__insertTerminalNode(), gum::credal::CredalNet< GUM_SCALAR >::__intervalToCredal(), gum::MultiDimFunctionGraphManager< bool, ExactTerminalNodePolicy >::__isRedundant(), gum::prm::PRMType::__isValid(), gum::StructuredPlaner< double >::__recurArgMaxCopy(), gum::StructuredPlaner< double >::__recurExtractOptPol(), gum::NodeDatabase< AttributeSelection, isScalar >::__valueDomain(), gum::AdaptiveRMaxPlaner::__visitLearner(), gum::TreeOperator< GUM_SCALAR, COMBINEOPERATOR, TerminalNodePolicy >::__xPloreDT2(), gum::TreeRegress< GUM_SCALAR, COMBINEOPERATOR, PROJECTOPERATOR, TerminalNodePolicy >::__xPloreVFunc(), gum::aggregator::Median< GUM_SCALAR >::_buildValue(), gum::MultiDimWithOffset< GUM_SCALAR >::_computeInstantiationValue(), gum::MultiDimFunctionGraphManager< bool, ExactTerminalNodePolicy >::_nodeRedundancyCheck(), gum::IncrementalGraphLearner< AttributeSelection, isScalar >::_transpose(), gum::prm::PRMFormAttribute< GUM_SCALAR >::_type(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::_type(), gum::MultiDimWithOffset< GUM_SCALAR >::add(), gum::MultiDimDecorator< GUM_SCALAR >::add(), gum::MultiDimArray< GUM_SCALAR >::add(), gum::MultiDimImplementation< std::string >::add(), gum::BayesNet< double >::addAND(), gum::BayesNet< double >::addEXISTS(), gum::BayesNet< double >::addFORALL(), gum::prm::PRMFactory< GUM_SCALAR >::addLabel(), gum::BayesNet< double >::addOR(), gum::InfluenceDiagram< GUM_SCALAR >::addUtilityNode(), gum::InternalNode::allocateNodeSons(), gum::Instantiation::chgVal(), gum::InternalNode::deallocateNodeSons(), gum::Instantiation::decVar(), gum::Potential< GUM_SCALAR >::draw(), gum::prm::PRMFactory< GUM_SCALAR >::endDiscreteType(), gum::prm::PRMFactory< GUM_SCALAR >::endDiscretizedType(), gum::MultiDimWithOffset< GUM_SCALAR >::erase(), gum::MultiDimArray< GUM_SCALAR >::erase(), gum::MultiDimImplementation< std::string >::erase(), gum::credal::CredalNet< GUM_SCALAR >::fillConstraint(), gum::Potential< GUM_SCALAR >::fillWith(), gum::MultiDimFunctionGraphGenerator::generate(), gum::aggregator::MultiDimAggregator< GUM_SCALAR >::get(), gum::getMaxModality(), gum::Instantiation::incVar(), gum::credal::CredalNet< GUM_SCALAR >::intervalToCredal(), gum::credal::CredalNet< GUM_SCALAR >::intervalToCredalWithFiles(), gum::credal::CredalNet< GUM_SCALAR >::lagrangeNormalization(), gum::MultiDimFunctionGraphProjector< GUM_SCALAR, FUNCTOR, TerminalNodePolicy >::project(), gum::MultiDimInterface::replace(), gum::VariableSelector::select(), gum::prm::PRMFactory< GUM_SCALAR >::setCPFByRule(), gum::credal::CredalNet< GUM_SCALAR >::setCPT(), gum::credal::CredalNet< GUM_SCALAR >::setCPTs(), gum::Instantiation::setLastVar(), gum::BayesNetFactory< GUM_SCALAR >::setVariableValues(), gum::prm::PRMFormAttribute< GUM_SCALAR >::swap(), and gum::prm::PRMScalarAttribute< GUM_SCALAR >::swap().

◆ empty()

bool gum::DiscreteVariable::empty ( ) const
inherited
Returns
true if the domainSize() < 2;

◆ index()

virtual Idx gum::DiscreteVariable::index ( const std::string &  label) const
pure virtualinherited

Implemented in gum::DiscretizedVariable< T_TICKS >, gum::RangeVariable, and gum::LabelizedVariable.

Referenced by gum::DiscreteVariable::operator[]().

+ Here is the caller graph for this function:

◆ label()

virtual std::string gum::DiscreteVariable::label ( Idx  i) const
pure virtualinherited

◆ labels()

std::vector< std::string > gum::DiscreteVariable::labels ( ) const
inherited

vector of labels

◆ name()

const std::string& gum::Variable::name ( ) const
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().

◆ numerical()

virtual double gum::DiscreteVariable::numerical ( Idx  indice) const
pure virtualinherited

get a numerical representation of the indice-th value.

Implemented in gum::DiscretizedVariable< T_TICKS >, gum::LabelizedVariable, and gum::RangeVariable.

◆ operator!=() [1/2]

virtual bool gum::Variable::operator!= ( const Variable aRV) const
virtualinherited

inequality operator

◆ operator!=() [2/2]

virtual bool gum::DiscreteVariable::operator!= ( const DiscreteVariable aRV) const
virtualinherited

inequality operator

◆ operator=()

IDiscretizedVariable& gum::IDiscretizedVariable::operator= ( const IDiscretizedVariable from)
protected

copy operator

◆ operator==() [1/2]

virtual bool gum::Variable::operator== ( const Variable aRV) const
virtualinherited

equality operator

◆ operator==() [2/2]

virtual bool gum::DiscreteVariable::operator== ( const DiscreteVariable aRV) const
virtualinherited

equality operator

◆ operator[]()

Idx gum::DiscreteVariable::operator[] ( const std::string &  label) const
inlineinherited

from the label to its index in var.

Warning
This operation may have different complexity in different subclasses.
Exceptions
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().

140 { return index(label); };
virtual std::string label(Idx i) const =0
get the indice-th label. This method is pure virtual.
virtual Idx index(const std::string &label) const =0
+ Here is the call graph for this function:

◆ setDescription()

void gum::Variable::setDescription ( const std::string &  theValue) const
inherited

sets the description of the variable

Warning
since __description is mutable, setDescription() is const
Parameters
theValue

◆ setName()

void gum::Variable::setName ( const std::string &  theValue)
inherited

sets the name of the variable

Parameters
theValue

Referenced by gum::prm::PRMSystem< double >::__groundAttr(), gum::prm::PRMType::__updateName(), gum::FMDP< double >::addVariable(), and gum::TaxiSimulator::TaxiSimulator().

+ Here is the caller graph for this function:

◆ ticksAsDoubles()

virtual std::vector< double > gum::IDiscretizedVariable::ticksAsDoubles ( ) const
pure virtual

return the list of ticks as a vector of doubles

Implemented in gum::DiscretizedVariable< T_TICKS >.

◆ toString()

const std::string gum::DiscreteVariable::toString ( ) const
inherited

string version of *this

Referenced by gum::DiscreteVariable::operator[]().

+ Here is the caller graph for this function:

◆ toStringWithDescription()

const std::string gum::DiscreteVariable::toStringWithDescription ( ) const
inherited

string version of *this using description attribute instead of name.

Referenced by gum::DiscreteVariable::operator[]().

+ Here is the caller graph for this function:

◆ varType()

virtual VarType gum::DiscreteVariable::varType ( ) const
pure virtualinherited

returns the varType of variable

Implements gum::Variable.

Implemented in gum::LabelizedVariable, gum::DiscretizedVariable< T_TICKS >, and gum::RangeVariable.


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