35 #include <agrum/tools/core/hashTable.h> 36 #include <agrum/tools/core/sequence.h> 37 #include <agrum/tools/core/set.h> 39 #include <agrum/tools/graphs/diGraph.h> 41 #include <agrum/BN/BayesNetFactory.h> 43 #include <agrum/PRM/elements/PRMObject.h> 44 #include <agrum/PRM/elements/PRMInstance.h> 45 #include <agrum/PRM/elements/PRMClass.h> 57 template <
typename GUM_SCALAR >
66 explicit PRMSystem(
const std::string& name);
110 bool exists(
const std::string& name)
const;
118 bool isInstance(
const std::string& name)
const;
121 bool isArray(
const std::string& name)
const;
127 void groundedBN(BayesNetFactory< GUM_SCALAR >& factory)
const;
193 void addArray(
const std::string& array, PRMClassElementContainer< GUM_SCALAR >& type);
294 void _groundRef_(
const PRMInstance< GUM_SCALAR >& instance,
295 BayesNetFactory< GUM_SCALAR >& factory)
const;
301 void _groundAttr_(
const PRMInstance< GUM_SCALAR >& instance,
302 BayesNetFactory< GUM_SCALAR >& factory)
const;
313 const PRMAttribute< GUM_SCALAR >& attr,
314 BayesNetFactory< GUM_SCALAR >& factory)
const;
321 void _groundAgg_(
const PRMClassElement< GUM_SCALAR >& elt,
322 const std::string& name,
323 BayesNetFactory< GUM_SCALAR >& factory)
const;
328 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS 329 extern template class PRMSystem<
double >;
337 #include <agrum/PRM/elements/PRMSystem_tpl.h> const PRMClassElementContainer< GUM_SCALAR > & getArrayType(const std::string &name) const
Returns the type of the given array.
PRMClassElementContainer< GUM_SCALAR > & getArrayType(const std::string &name)
Returns the type of the given array.
void _groundAgg_(const PRMClassElement< GUM_SCALAR > &elt, const std::string &name, BayesNetFactory< GUM_SCALAR > &factory) const
Ground an aggregator with the given name in the grounded IBayesNet.
iterator begin()
Returns an iterator over the instances in this system.
PRMSystem(const PRMSystem< GUM_SCALAR > &from)
Copy constructor. Don't use it.
virtual ~PRMSystem()
Destructor.
NodeId add(const std::string &array, PRMInstance< GUM_SCALAR > *i)
Add an PRMInstance to an array in this system. If the array doesn't exists it is created.
INLINE void emplace(Args &&... args)
PRMInstance< GUM_SCALAR > & get(const std::string &name)
Returns a reference over an PRMInstance given it's name.
bool isInstantiated(const PRMClass< GUM_SCALAR > &c) const
Returns true if the given Class<GUM_SCALAR> has at least one PRMInstance in this PRMSystem.
const PRMInstance< GUM_SCALAR > & get(NodeId id) const
Returns an PRMInstance given it's NodeId in the relational skeleton.
const const_array_iterator & end(const std::string &a) const
Returns an iterator at the end of the Sequence of PRMInstance in the array named a.
const PRMInstance< GUM_SCALAR > & get(const std::string &name) const
Returns a constant reference over an PRMInstance given it's name.
NodeId add(const std::string &array, PRMInstance< GUM_SCALAR > &i)
Add an PRMInstance to an array in this system. If the array doesn't exists it is created.
HashTable< std::string, model_pair > arrayMap_
Mapping between arrays and their name. The first element of the pair is the type of the array...
const_iterator begin() const
Returns a constant iterator over the instances in this system.
PRMSystem(const std::string &name)
Default constructor.
DiGraph skeleton_
The relational skeleton of this PRMSystem.
NodeId add(PRMInstance< GUM_SCALAR > *i)
Add an PRMInstance to this system.
const DiGraph & skeleton() const
Returns the relation skeleton of this PRMSystem.
bool isInstance(const std::string &name) const
Returns true if an PRMInstance with the given name exists.
virtual PRMObject::prm_type obj_type() const
Returns the PRM type of this object.
PRMInstance< GUM_SCALAR > & get(NodeId id)
Returns an PRMInstance given it's NodeId in the relational skeleton.
NodeId get(const PRMInstance< GUM_SCALAR > &i) const
Returns the relation skeleton of this PRMSystem.
void groundedBN(BayesNetFactory< GUM_SCALAR > &factory) const
Returns the grounded Bayesian network of this system.
ParamScopeData(const std::string &s, const PRMReferenceSlot< GUM_SCALAR > &ref, Idx d)
void instantiate()
Instantiate all the PRMInstance in this PRMSystem.
const const_iterator & end() const
Returns a constant iterator at the end of the set of PRMInstance in this PRMSystem.
void _groundAttr_(const PRMInstance< GUM_SCALAR > &instance, BayesNetFactory< GUM_SCALAR > &factory) const
Method which ground Atttributes and Aggregators of an PRMInstance.
bool exists(const std::string &name) const
Retruns true either if name is an instance or an array in this PRMSystem.
Size size() const
Returns the number of PRMInstance in this PRMSystem.
const array_iterator & end(const std::string &a)
Returns an iterator at the end of the Sequence of PRMInstance in the array named a.
bool isArray(const std::string &name) const
Returns true if an array with the given name exists.
const Sequence< PRMInstance< GUM_SCALAR > *> & getArray(const std::string &name) const
Returns the sequence of instances of a given array.
void _groundPotential_(const PRMInstance< GUM_SCALAR > &instance, const PRMAttribute< GUM_SCALAR > &attr, BayesNetFactory< GUM_SCALAR > &factory) const
Method which copy node's Potential of an PRMInstance to the grounded Bayesian network.
PRMSystem< GUM_SCALAR > & operator=(const PRMSystem< GUM_SCALAR > &from)=delete
Copy operator. Don't use it.
void _groundRef_(const PRMInstance< GUM_SCALAR > &instance, BayesNetFactory< GUM_SCALAR > &factory) const
Method which ground PRMReferenceSlot of an PRMInstance and add arcs in the IBayesNet.
const iterator & end()
Returns a iterator at the end of the set of PRMInstance in this PRMSystem.
void addArray(const std::string &array, PRMClassElementContainer< GUM_SCALAR > &type)
Add an array of instances in this system. If the array doesn't exists it is created.
array_iterator begin(const std::string &a)
Returns an iterator at the beginning of the Sequence of PRMInstance in the array named a;...
const_array_iterator begin(const std::string &a) const
Returns an iterator at the beginning of the Sequence of PRMInstance in the array named a;...