![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
Factory which builds a PRM<GUM_SCALAR>. More...
#include <PRMType.h>
Public Member Functions | |
Constructors & destructor | |
PRMFactory () | |
Default constructor. More... | |
PRMFactory (PRM< GUM_SCALAR > *prm) | |
This constructor let you set on which PRM instance the factory works. More... | |
PRMFactory (const PRMFactory &from)=delete | |
Copy constructor. Don't use it. More... | |
PRMFactory & | operator= (const PRMFactory &from)=delete |
Copy operator. Don't use it. More... | |
virtual | ~PRMFactory () |
Destructor. More... | |
Getters & Setters | |
PRM< GUM_SCALAR > * | prm () const |
Returns a pointer on the PRM<GUM_SCALAR> created by this factory. More... | |
virtual PRMObject::prm_type | currentType () const override |
virtual PRMObject * | getCurrent () override |
virtual const PRMObject * | getCurrent () const override |
Returns a pointer on the PRM<GUM_SCALAR> created by this factory. More... | |
virtual PRMObject * | closeCurrent () override |
Close current object being built. More... | |
virtual std::string | currentPackage () const override |
PRMClass< GUM_SCALAR > & | retrieveClass (const std::string &name) |
Returns a reference over a Class<GUM_SCALAR> given its name. More... | |
PRMType & | retrieveType (const std::string &name) |
Returns a reference over a PRMType given its name. More... | |
PRMType & | retrieveCommonType (const std::vector< PRMClassElement< GUM_SCALAR > * > &elts) |
Returns a pointer on the PRM<GUM_SCALAR> created by this factory. More... | |
Package construction methods. | |
virtual void | pushPackage (const std::string &name) override |
Define the current package. More... | |
virtual std::string | popPackage () override |
Pop the current package from the package stack. More... | |
virtual void | addImport (const std::string &name) override |
Add an import for namespace lookup. More... | |
PRMType construction methods. | |
virtual void | startDiscreteType (const std::string &name, std::string super="") override |
Start a discrete subtype declaration. More... | |
virtual void | addLabel (const std::string &l, std::string ext="") override |
Add a label to the current discrete type. More... | |
virtual void | endDiscreteType () override |
End the current discrete type declaration. More... | |
virtual void | startDiscretizedType (const std::string &name) override |
Start a discretized type declaration. More... | |
virtual void | addTick (double tick) override |
Add a tick to the current discretized type. More... | |
virtual void | endDiscretizedType () override |
End the current discretized type declaration. More... | |
virtual void | addRangeType (const std::string &name, long minVal, long maxVal) override |
Add a range variable type declaration. More... | |
several checks for parsers | |
virtual bool | isClassOrInterface (const std::string &type) const override |
virtual bool | isArrayInCurrentSystem (const std::string &name) const override |
Class<GUM_SCALAR> construction models. | |
virtual void | startClass (const std::string &c, const std::string &ext="", const Set< std::string > *implements=nullptr, bool delayInheritance=false) override |
Tells the factory that we start a class declaration. More... | |
virtual void | continueClass (const std::string &c) override |
Continue the declaration of a class. More... | |
virtual void | endClass (bool checkImplementations=true) override |
Tells the factory that we finished a class declaration. More... | |
PRMInterface<GUM_SCALAR> construction models. | |
virtual void | startInterface (const std::string &i, const std::string &ext="", bool delayInheritance=false) override |
Tells the factory that we start an interface declaration. More... | |
virtual void | continueInterface (const std::string &name) override |
Continue the declaration of an interface. More... | |
virtual void | addAttribute (const std::string &type, const std::string &name) override |
Add an attribute to an interface. More... | |
virtual void | endInterface () override |
Tells the factory that we finished an interface declaration. More... | |
Attributes construction methods. | |
virtual void | addAttribute (PRMAttribute< GUM_SCALAR > *attr) |
Add an already created attribute to the current class. More... | |
virtual void | startAttribute (const std::string &type, const std::string &name, bool scalar_atttr=false) override |
Tells the factory that we start an attribute declaration. More... | |
virtual void | continueAttribute (const std::string &name) override |
Continues the declaration of an attribute. More... | |
virtual void | addParent (const std::string &name) override |
Tells the factory that we add a parent to the current declared attribute. More... | |
void | setRawCPFByLines (const std::vector< GUM_SCALAR > &array) |
Gives the factory the CPF in its raw form. More... | |
void | setRawCPFByColumns (const std::vector< GUM_SCALAR > &array) |
Gives the factory the CPF in its raw form. More... | |
virtual void | setCPFByRule (const std::vector< std::string > &labels, const std::vector< GUM_SCALAR > &values) |
Fills the CPF using a rule. More... | |
virtual void | setCPFByRule (const std::vector< std::string > &labels, const std::vector< std::string > &values) override |
Fills the CPF using a rule and gum::Formula. More... | |
virtual void | setRawCPFByFloatLines (const std::vector< float > &array) override |
Gives the factory the CPF in its raw form. More... | |
virtual void | setRawCPFByFloatColumns (const std::vector< float > &array) override |
Gives the factory the CPF in its raw form. More... | |
virtual void | setRawCPFByColumns (const std::vector< std::string > &array) override |
Gives the factory the CPF in its raw form use gum::Formula. More... | |
virtual void | setRawCPFByLines (const std::vector< std::string > &array) override |
Gives the factory the CPF in its raw form using gum::Formula. More... | |
virtual void | setCPFByFloatRule (const std::vector< std::string > &labels, const std::vector< float > &values) override |
Fills the CPF using a rule. More... | |
virtual void | endAttribute () override |
Tells the factory that we finished declaring an attribute. More... | |
Parameters construction methods. | |
void | addParameter (const std::string &type, const std::string &name, double value) override |
Add a parameter to the current class with a default value. More... | |
Aggregator and function construction methods. | |
virtual void | addAggregator (const std::string &name, const std::string &agg_type, const std::vector< std::string > &chains, const std::vector< std::string > ¶ms, std::string type="") override |
Add an aggregator in the current declared class. More... | |
void | startAggregator (const std::string &name, const std::string &agg_type, const std::string &rv_type, const std::vector< std::string > ¶ms) |
Start an aggregator declaration. More... | |
void | continueAggregator (const std::string &name) |
Conitnues an aggregator declaration. More... | |
void | endAggregator () |
Finishes an aggregate declaration. More... | |
virtual void | addNoisyOrCompound (const std::string &name, const std::vector< std::string > &chains, const std::vector< float > &numbers, float leak, const std::vector< std::string > &label) override |
Add a compound noisy-or as an PRMAttribute<GUM_SCALAR> to the current Class<GUM_SCALAR>. More... | |
PRMReferenceSlot<GUM_SCALAR> construction methods. | |
virtual void | addReferenceSlot (const std::string &type, const std::string &name, bool isArray) override |
Tells the factory that we started declaring a slot. More... | |
Systems constructions methods. | |
virtual void | startSystem (const std::string &name) override |
Tells the factory that we started declaring a model. More... | |
virtual void | endSystem () override |
Tells the factory that we finished declaring a model. More... | |
virtual void | addInstance (const std::string &type, const std::string &name) override |
Add an instance to the model. More... | |
void | addInstance (const std::string &type, const std::string &name, const HashTable< std::string, double > ¶ms) override |
Add an instance with params as values of type's parameters. More... | |
virtual void | addArray (const std::string &type, const std::string &name, Size size) override |
Creates an array with the given number of instances of the given type. More... | |
virtual void | incArray (const std::string &l_i, const std::string &r_i) override |
Add an instance to an array. More... | |
virtual void | setReferenceSlot (const std::string &left_instance, const std::string &left_reference, const std::string &right_instance) override |
Instantiate a reference in the current model. More... | |
virtual void | setReferenceSlot (const std::string &l_i, const std::string &r_i) override |
Instantiate a reference in the current model. More... | |
Factory which builds a PRM<GUM_SCALAR>.
The Factory always create one PRM<GUM_SCALAR> which is not deleted with the factory, so be very careful to delete the PRM<GUM_SCALAR> built by this factory.
The factory does not allow any sequence of calls, if you call a method when the factory is in an incoherent state it will raise a FactoryInvalidState exception.
Keep in mind that most methods could raise gum::FatalError if something unexpected happens, since the framework is meant to evolve it is possible.
INLINE gum::prm::PRMFactory< GUM_SCALAR >::PRMFactory | ( | ) |
Default constructor.
Definition at line 1291 of file PRMFactory_tpl.h.
INLINE gum::prm::PRMFactory< GUM_SCALAR >::PRMFactory | ( | PRM< GUM_SCALAR > * | prm | ) |
This constructor let you set on which PRM instance the factory works.
Definition at line 1297 of file PRMFactory_tpl.h.
|
delete |
Copy constructor. Don't use it.
|
virtual |
Destructor.
Definition at line 1303 of file PRMFactory_tpl.h.
|
private |
Adds a instance to the current model.
Definition at line 1658 of file PRMFactory_tpl.h.
|
private |
Add a parent to an attribute.
Definition at line 236 of file PRMFactory_tpl.h.
|
private |
Add a parent to an aggregate.
Definition at line 592 of file PRMFactory_tpl.h.
|
private |
Adds prefix to str iff prefix != "".
Definition at line 1674 of file PRMFactory_tpl.h.
|
private |
Builds all Aggregates CPF in the given model. This must be called after all the slot chains have been generated.
|
private |
This methods build a PRMSlotChain<GUM_SCALAR> given a starting element and a string.
Definition at line 915 of file PRMFactory_tpl.h.
|
private |
Check if c implements correctly all his interfaces.
Definition at line 104 of file PRMFactory_tpl.h.
|
private |
Return a pointer on a PRMObject at stack.size() - i position after checking the type of the object given obj_type.
FactoryInvalidState | Raised if the stack isn't consistent with the |
Definition at line 1686 of file PRMFactory_tpl.h.
|
private |
Adds prefix to str iff prefix != "".
Definition at line 1720 of file PRMFactory_tpl.h.
|
private |
Adds prefix to str iff prefix != "".
Definition at line 1703 of file PRMFactory_tpl.h.
|
private |
Instantiate a slot chain in the given instance.
|
private |
Returns a pointer on a class given it's name. Used when building models, meaning that the class name can either be local (need to add the current prefix) or global (no prefix needed).
NotFound | If no class matching the name is found. |
Definition at line 1194 of file PRMFactory_tpl.h.
|
private |
Retrieve the common PRMType of a vector of PRMClassElement<GUM_SCALAR>.
The vector elts must only contains PRMClassElement<GUM_SCALAR> with a PRMType, i.e. PRMAttribute<GUM_SCALAR>, PRMAggregate and PRMSlotChain<GUM_SCALAR>. If not a WrongClassElement is raised.
A common PRMType is PRMType t such as t.isSuperTypeOf(elts[i]) for 0 < i < elts.size(), where elts is a PRMType container.
elts | A vector of PRMClassElement<GUM_SCALAR>. |
WrongClassElement | Raised if elts contains a PRMClassElement<GUM_SCALAR> without a PRMType. |
NotFound | Raised if there exists no common super type of all PRMClassElement<GUM_SCALAR> in elts. |
Definition at line 1013 of file PRMFactory_tpl.h.
|
private |
Retrieve inputs for an PRMAggregate.
The vector chains contains names of the PRMAggregate inputs. If a name does not match an existing PRMClassElement<GUM_SCALAR> in c, then a call to PRMFactory:: buildSlotChains() is made. Such created PRMSlotChain<GUM_SCALAR> are added to c.
c | The class in which the PRMAggregate is defined. |
chains | Vector of the PRMAggregate inputs names. |
inputs | Vector filled with the PRMClassElement<GUM_SCALAR> matching the names in chains. |
NotFound | Raised if a name in chains does not match a legal PRMSlotChain<GUM_SCALAR> or an existing PRMClassElement<GUM_SCALAR> in c. |
Definition at line 957 of file PRMFactory_tpl.h.
|
private |
Fill seq with the sequence of instance build using inst as the instantiation of sc-> class and seeking each instantiation of reference in sc.
|
private |
Returns a pointer on an interface given it's name. Used when building models, meaning that the interface name can either be local (need to add the current prefix) or global (no prefix needed).
NotFound | If no class matching the name is found. |
Definition at line 1241 of file PRMFactory_tpl.h.
|
private |
Returns a pointer on a PRMType given it's name. Since the type can be given either with it's local name (without the prefix), full name (with the prefix) or can come from an import unit, or maybe one day with a using declaration we need some processing to find it.
The following precedences on finding the name is used:
OperationNotAllowed | If the type is undeclared. |
Definition at line 1131 of file PRMFactory_tpl.h.
|
private |
Returns the inheritance depth of a PRMType.
This used by PRMFactory:: retrieveCommonType. This returns 0 if t does not have a super type.
t | The PRMType for which we compute its depth. |
Definition at line 1741 of file PRMFactory_tpl.h.
|
overridevirtual |
Add an aggregator in the current declared class.
If at least one parent of an aggregator is a PRMSlotChain<GUM_SCALAR>, then all of it's parents must be PRMSlotChain<GUM_SCALAR>. When an aggregator parents are only composed of PRMAttribute<GUM_SCALAR> and PRMAggregate, then it is directly added as an PRMAttribute<GUM_SCALAR> to it's Class<GUM_SCALAR>.
name | The name of this aggregator. |
agg_type | The name of the aggregator type of this aggregator. |
chains | The set of chains on which this aggregate applies. |
params | The list of parameters for this aggregator. |
type | Some aggregators have a user defined type, use this parameter to define it. |
OperationNotAllowed | Raised if one or more parameters misses or are not correct. |
TypeError | Raised if the aggregator's type or one or more of the chains are not of the good type. |
Implements gum::prm::IPRMFactory.
Definition at line 655 of file PRMFactory_tpl.h.
|
overridevirtual |
Creates an array with the given number of instances of the given type.
PRMInstance<GUM_SCALAR> are name using "name" as prefix and adding the suffix "[i]", with "i" being the position of the instance in the array.
Implements gum::prm::IPRMFactory.
Definition at line 831 of file PRMFactory_tpl.h.
|
overridevirtual |
Add an attribute to an interface.
Implements gum::prm::IPRMFactory.
Definition at line 1503 of file PRMFactory_tpl.h.
|
virtual |
Add an already created attribute to the current class.
Use this method when you must add functions, such as Noisy-Or.
Use this method when you need to add functions, such as Noisy-Or. The attribute CPT is checked for parents and arcs will be added using the DiscreteVariable pointers, thus be careful to use those of the attributes, aggregates and slotchains of the current class. gum::prm::Class<GUM_SCALAR>::insertArc() will be called for each found parent of attr, so you should overload gum::prm::PRMAttribute<GUM_SCALAR>::addParent() to prevent duplication errors. Such class exists: gum::prm::PRMFuncAttribute .
The pointer is given to the class, so do not worry about deleting it.
attr | The attribute added to the current class. |
NotFound | Raised if one of the DiscreteVariable in attr CPT does not match any PRMClassElement<GUM_SCALAR> in this. |
Definition at line 211 of file PRMFactory_tpl.h.
|
overridevirtual |
Add an import for namespace lookup.
When loading a module, you should push all import declarations using this method. The order in which you add imports will impact name resolution (first found, first used).
Imports are sync with packages: when you push a new package a new empty list of imports is added. When you pop a package the current list of imports is discarded and the previous one is restored.
name | The name of the package for all further objects. |
Implements gum::prm::IPRMFactory.
Definition at line 1778 of file PRMFactory_tpl.h.
|
overridevirtual |
Add an instance to the model.
Implements gum::prm::IPRMFactory.
Definition at line 1581 of file PRMFactory_tpl.h.
|
overridevirtual |
Add an instance with params as values of type's parameters.
Implements gum::prm::IPRMFactory.
Definition at line 1597 of file PRMFactory_tpl.h.
|
overridevirtual |
Add a label to the current discrete type.
l | The label value. |
ext | The super type label for which l is an extension. |
OperationNotAllowed | Raised if the current type does not have a super type, see PRMFactory::addLabel(const std::string&). |
DuplicateElement | Raised if a label with the same value already exists. |
NotFound | Raised if ext does not match any label in the current type's super type. |
Implements gum::prm::IPRMFactory.
Definition at line 1373 of file PRMFactory_tpl.h.
|
overridevirtual |
Add a compound noisy-or as an PRMAttribute<GUM_SCALAR> to the current Class<GUM_SCALAR>.
The type of a noisy-or must be a boolean.
name | the name of the PRMAttribute<GUM_SCALAR> added as a noisy-or. |
chains | the list of parents of the noisy-or. |
numbers | the list of weights for each parent. Can consist of only one value which will be applied to all the parents. |
leak | the leak |
label | the label on which the noisy-or applies, can be an empty string (the noisy-or will behave as if chains are all booleans). |
NotFound | Raised if one of the chains or the label is not found. |
FactoryInvalidState | Raised if a Class<GUM_SCALAR> is not the current declared PRMObject. |
OperationNotAllowed | Raised if for some reasons the parameters are invalid. |
Implements gum::prm::IPRMFactory.
Definition at line 1068 of file PRMFactory_tpl.h.
|
overridevirtual |
Add a parameter to the current class with a default value.
A parameter with a default value is an PRMAttribute<GUM_SCALAR> (aka mutable PRMAttribute<GUM_SCALAR>) with no parents and with a CPF filled with 1.
type | The type of this parameter. |
name | The name of this parameter. |
value | The label used as default value for this parameter. |
Implements gum::prm::IPRMFactory.
Definition at line 523 of file PRMFactory_tpl.h.
|
overridevirtual |
Tells the factory that we add a parent to the current declared attribute.
The name can refer to an already declared attribute or aggregate of the same class. It can also be a slot chain only if there is no multiple reference in it.
OperationNotAllowed | Raised if the given operation is illegal. |
Implements gum::prm::IPRMFactory.
Definition at line 290 of file PRMFactory_tpl.h.
|
overridevirtual |
Add a range variable type declaration.
name | The variable's name |
minVal | The variable's lower bound. |
maxVal | The variable's upper bound. |
DuplicateElement | Raised if an object with the same name already exists. |
OperationNotAllowed | Raised if the range variable is not a valid discrete type. |
Implements gum::prm::IPRMFactory.
Definition at line 1477 of file PRMFactory_tpl.h.
|
overridevirtual |
Tells the factory that we started declaring a slot.
OperationNotAllowed | Raised if the given operation is illegal. |
Implements gum::prm::IPRMFactory.
Definition at line 808 of file PRMFactory_tpl.h.
|
overridevirtual |
Add a tick to the current discretized type.
tick | The tick value. |
Implements gum::prm::IPRMFactory.
Definition at line 1448 of file PRMFactory_tpl.h.
|
overridevirtual |
Close current object being built.
Nothing is done in particular except removing the current object from the factory's stack. If the object was not added to a container it will not be deleted properly, so you might want to delete it yourself (at your own risks!).
Implements gum::prm::IPRMFactory.
Definition at line 1339 of file PRMFactory_tpl.h.
INLINE void gum::prm::PRMFactory< GUM_SCALAR >::continueAggregator | ( | const std::string & | name | ) |
Conitnues an aggregator declaration.
Definition at line 579 of file PRMFactory_tpl.h.
|
overridevirtual |
Continues the declaration of an attribute.
Implements gum::prm::IPRMFactory.
Definition at line 1540 of file PRMFactory_tpl.h.
|
overridevirtual |
Continue the declaration of a class.
Implements gum::prm::IPRMFactory.
Definition at line 82 of file PRMFactory_tpl.h.
|
overridevirtual |
Continue the declaration of an interface.
Implements gum::prm::IPRMFactory.
Definition at line 200 of file PRMFactory_tpl.h.
|
overridevirtual |
Implements gum::prm::IPRMFactory.
Definition at line 1350 of file PRMFactory_tpl.h.
|
overridevirtual |
NotFound | if no type is being built. |
Implements gum::prm::IPRMFactory.
Definition at line 1318 of file PRMFactory_tpl.h.
INLINE void gum::prm::PRMFactory< GUM_SCALAR >::endAggregator | ( | ) |
Finishes an aggregate declaration.
Definition at line 649 of file PRMFactory_tpl.h.
|
overridevirtual |
Tells the factory that we finished declaring an attribute.
OperationNotAllowed | Raised if the given operation is illegal. |
Implements gum::prm::IPRMFactory.
Definition at line 1554 of file PRMFactory_tpl.h.
|
overridevirtual |
Tells the factory that we finished a class declaration.
PRMTypeError | Raised if the current Class<GUM_SCALAR> does not respect one of it's PRMInterface<GUM_SCALAR>. |
Implements gum::prm::IPRMFactory.
Definition at line 93 of file PRMFactory_tpl.h.
|
overridevirtual |
End the current discrete type declaration.
OperationNotAllowed | Raised if the current type is not a valid discrete type. |
Implements gum::prm::IPRMFactory.
Definition at line 1421 of file PRMFactory_tpl.h.
|
overridevirtual |
End the current discretized type declaration.
OperationNotAllowed | Raised if the current type is not a valid discrete type. |
Implements gum::prm::IPRMFactory.
Definition at line 1462 of file PRMFactory_tpl.h.
|
overridevirtual |
Tells the factory that we finished an interface declaration.
Implements gum::prm::IPRMFactory.
Definition at line 1497 of file PRMFactory_tpl.h.
|
overridevirtual |
Tells the factory that we finished declaring a model.
OperationNotAllowed | Raised if the given operation is illegal. |
Implements gum::prm::IPRMFactory.
Definition at line 1571 of file PRMFactory_tpl.h.
|
overridevirtual |
NotFound | if nothing is being built. |
Implements gum::prm::IPRMFactory.
Definition at line 1325 of file PRMFactory_tpl.h.
|
overridevirtual |
Returns a pointer on the PRM<GUM_SCALAR> created by this factory.
This pointer will not be deleted when the factory is destroyed.
Implements gum::prm::IPRMFactory.
Definition at line 1332 of file PRMFactory_tpl.h.
|
overridevirtual |
Add an instance to an array.
Implements gum::prm::IPRMFactory.
Definition at line 858 of file PRMFactory_tpl.h.
|
overridevirtual |
Implements gum::prm::IPRMFactory.
Definition at line 1835 of file PRMFactory_tpl.h.
|
overridevirtual |
Implements gum::prm::IPRMFactory.
Definition at line 1816 of file PRMFactory_tpl.h.
|
delete |
Copy operator. Don't use it.
|
overridevirtual |
Pop the current package from the package stack.
Implements gum::prm::IPRMFactory.
Definition at line 1760 of file PRMFactory_tpl.h.
INLINE PRM< GUM_SCALAR > * gum::prm::PRMFactory< GUM_SCALAR >::prm | ( | ) | const |
Returns a pointer on the PRM<GUM_SCALAR> created by this factory.
This pointer will not be deleted when the factory is destroyed.
Definition at line 1313 of file PRMFactory_tpl.h.
|
overridevirtual |
Define the current package.
A stack is used to keep track of packages given the different imports.
name | The name of the package for all further objects. |
Implements gum::prm::IPRMFactory.
Definition at line 1754 of file PRMFactory_tpl.h.
INLINE PRMClass< GUM_SCALAR > & gum::prm::PRMFactory< GUM_SCALAR >::retrieveClass | ( | const std::string & | name | ) |
Returns a reference over a Class<GUM_SCALAR> given its name.
This methods adds if necessary the current package as a prefix to name.
name | The name of the Class<GUM_SCALAR>. |
NotFound | if no Class<GUM_SCALAR> matches the given name. |
Definition at line 1799 of file PRMFactory_tpl.h.
INLINE PRMType & gum::prm::PRMFactory< GUM_SCALAR >::retrieveCommonType | ( | const std::vector< PRMClassElement< GUM_SCALAR > * > & | elts | ) |
Returns a pointer on the PRM<GUM_SCALAR> created by this factory.
This pointer will not be deleted when the factory is destroyed.
Definition at line 1809 of file PRMFactory_tpl.h.
INLINE PRMType & gum::prm::PRMFactory< GUM_SCALAR >::retrieveType | ( | const std::string & | name | ) |
Returns a reference over a PRMType given its name.
This methods adds if necessary the current package as a prefix to name.
name | The name of the PRMType. |
Definition at line 1804 of file PRMFactory_tpl.h.
|
overridevirtual |
Fills the CPF using a rule.
The labels vector is filled with one of each parent's labels or with a wildcard ("*"). If a wildcard is used then all values of the corresponding parents are used. The sequence of parents must be the declaration order used when adding the current attribute's parents.
labels | The value of each parents. |
values | The probability values of the current attribute given the values in parenst. |
Implements gum::prm::IPRMFactory.
Definition at line 377 of file PRMFactory_tpl.h.
|
virtual |
Fills the CPF using a rule.
The labels vector is filled with one of each parent's labels or with a wildcard ("*"). If a wildcard is used then all values of the corresponding parents are used. The sequence of parents must be the declaration order used when adding the current attribute's parents.
labels | The value of each parents. |
values | The probability values of the current attribute given the values in parents. |
Definition at line 395 of file PRMFactory_tpl.h.
|
overridevirtual |
Fills the CPF using a rule and gum::Formula.
The labels vector is filled with one of each parent's labels or with a wildcard ("*"). If a wildcard is used then all values of the corresponding parents are used. The sequence of parents must be the declaration order used when adding the current attribute's parents.
labels | The value of each parents. |
values | The probability values of the current attribute given the values in parents. |
Implements gum::prm::IPRMFactory.
Definition at line 459 of file PRMFactory_tpl.h.
INLINE void gum::prm::PRMFactory< GUM_SCALAR >::setRawCPFByColumns | ( | const std::vector< GUM_SCALAR > & | array | ) |
Gives the factory the CPF in its raw form.
The creation of the CPF is left to the factory because we do not know what level of complexity for CPF implementation can be handled by the PRM<GUM_SCALAR> implementation.
How to fill a CPT? If you want to fill the CPT of P(A|B,C) with A, B and C boolean variables ( {f, t}, the order is important), then the following array is valid:
See PRMFactory::setRawCPFByLines() for more details.
OperationNotAllowed | Raised if the given operation is illegal. |
Definition at line 345 of file PRMFactory_tpl.h.
|
overridevirtual |
Gives the factory the CPF in its raw form use gum::Formula.
The creation of the CPF is left to the factory because we do not know what level of complexity for CPF implementation can be handled by the PRM<GUM_SCALAR> implementation.
How to fill a CPT? If you want to fill the CPT of P(A|B,C) with A, B and C boolean variables ( {f, t}, the order is important), then the following array is valid:
See PRMFactory::setRawCPFByLines() for more details.
OperationNotAllowed | Raised if the given operation is illegal. |
Implements gum::prm::IPRMFactory.
Definition at line 1843 of file PRMFactory_tpl.h.
|
overridevirtual |
Gives the factory the CPF in its raw form.
The creation of the CPF is left to the factory because we do not know what level of complexity for CPF implementation can be handled by the PRM<GUM_SCALAR> implementation.
How to fill a CPT? If you want to fill the CPT of P(A|B,C) with A, B and C boolean variables ( {f, t}, the order is important), then the following array is valid:
See PRMFactory::setRawCPFByLines() for more details.
OperationNotAllowed | Raised if the given operation is illegal. |
Implements gum::prm::IPRMFactory.
Definition at line 331 of file PRMFactory_tpl.h.
|
overridevirtual |
Gives the factory the CPF in its raw form.
The creation of the CPF is left to the factory because we do not know what level of complexity for CPF implementation can be handled by the PRM<GUM_SCALAR> implementation.
How to fill a CPT? If you want to fill the CPT of P(A|B,C) with A, B and C boolean variables ( {f, t}, the order is important), then the following array is valid:
OperationNotAllowed | Raised if the given operation is illegal. |
Implements gum::prm::IPRMFactory.
Definition at line 305 of file PRMFactory_tpl.h.
INLINE void gum::prm::PRMFactory< GUM_SCALAR >::setRawCPFByLines | ( | const std::vector< GUM_SCALAR > & | array | ) |
Gives the factory the CPF in its raw form.
The creation of the CPF is left to the factory because we do not know what level of complexity for CPF implementation can be handled by the PRM<GUM_SCALAR> implementation.
How to fill a CPT? If you want to fill the CPT of P(A|B,C) with A, B and C boolean variables ( {f, t}, the order is important), then the following array is valid:
OperationNotAllowed | Raised if the given operation is illegal. |
Definition at line 317 of file PRMFactory_tpl.h.
|
overridevirtual |
Gives the factory the CPF in its raw form using gum::Formula.
The creation of the CPF is left to the factory because we do not know what level of complexity for CPF implementation can be handled by the PRM<GUM_SCALAR> implementation.
How to fill a CPT? If you want to fill the CPT of P(A|B,C) with A, B and C boolean variables ( {f, t}, the order is important), then the following array is valid:
OperationNotAllowed | Raised if the given operation is illegal. |
Implements gum::prm::IPRMFactory.
Definition at line 1880 of file PRMFactory_tpl.h.
|
overridevirtual |
Instantiate a reference in the current model.
This is equivalent to the following SKOOL instruction: left_instance.left_reference = right_instance;
right_instance's type must be compatible with the slot type of left_reference.
left_instance | The name of an instance in the model. |
left_reference | The name of a reference of left_instance. |
right_instance | The name of an instance or an array of instances in the model. |
Implements gum::prm::IPRMFactory.
Definition at line 874 of file PRMFactory_tpl.h.
|
overridevirtual |
Instantiate a reference in the current model.
This is equivalent to the following SKOOL instruction: left_instance.left_reference = right_instance;
right_instance's type must be compatible with the slot type of left_reference.
l_i | A slot chain starting from an instance and ending over a reference slot. |
r_i | The name of an instance or an array of instances in the model. |
Implements gum::prm::IPRMFactory.
Definition at line 1785 of file PRMFactory_tpl.h.
INLINE void gum::prm::PRMFactory< GUM_SCALAR >::startAggregator | ( | const std::string & | name, |
const std::string & | agg_type, | ||
const std::string & | rv_type, | ||
const std::vector< std::string > & | params | ||
) |
Start an aggregator declaration.
name | The aggregator's name. |
agg_type | The aggregtor's type ( |
rv_type | The aggregator's random variable type ( |
params | The aggregator's parameters. |
Definition at line 546 of file PRMFactory_tpl.h.
|
overridevirtual |
Tells the factory that we start an attribute declaration.
FatalError | Raised if the given operation is illegal. |
Implements gum::prm::IPRMFactory.
Definition at line 1511 of file PRMFactory_tpl.h.
|
overridevirtual |
Tells the factory that we start a class declaration.
Use the default values if you do not want c to be a subclass or to implement interfaces.
c | The class name. |
ext | The name of the super class of c. |
implements | The list of interface implemented by c. |
delayInheritance | If true, the created gum::prm::Class inheritance will be delayed. |
OperationNotAllowed | Raised if the given operation is illegal. |
Implements gum::prm::IPRMFactory.
Definition at line 46 of file PRMFactory_tpl.h.
|
overridevirtual |
Start a discrete subtype declaration.
name | The discrete type's name. |
super | The super type of the declared discrete type. |
DuplicateElement | Raised if an object with the same name already exists. |
Implements gum::prm::IPRMFactory.
Definition at line 1355 of file PRMFactory_tpl.h.
|
overridevirtual |
Start a discretized type declaration.
name | The discretized type's name. |
DuplicateElement | Raised if an object with the same name already exists. |
Implements gum::prm::IPRMFactory.
Definition at line 1437 of file PRMFactory_tpl.h.
|
overridevirtual |
Tells the factory that we start an interface declaration.
Use the default values if you do not want c to be a subclass or to implement interfaces.
i | The interface name. |
ext | The name of the super interface of i. |
delayInheritance | If true, the created gum::prm::PRMInterface inheritance will be delayed. |
NotFound | Raised if ext does not match any declared PRMInterface<GUM_SCALAR>. |
Implements gum::prm::IPRMFactory.
Definition at line 176 of file PRMFactory_tpl.h.
|
overridevirtual |
Tells the factory that we started declaring a model.
OperationNotAllowed | Raised if the given operation is illegal. |
Implements gum::prm::IPRMFactory.
Definition at line 1560 of file PRMFactory_tpl.h.
|
private |
A mapping between aggregators and their parameters.
Definition at line 1032 of file PRMFactory.h.
|
private |
Set of all declared namespaces.
Definition at line 1023 of file PRMFactory.h.
|
private |
The prefix used for classes and types names. It is normally the namespace of the corresponding compilation unit.
Definition at line 1020 of file PRMFactory.h.
|
private |
The pointer on the PRM<GUM_SCALAR> built by this factory.
Definition at line 1026 of file PRMFactory.h.
|
private |
A stack used to keep track of created PRMObject.
Definition at line 1029 of file PRMFactory.h.