![]() |
aGrUM
0.20.2
a C++ library for (probabilistic) graphical models
|
base class for all non-incremental triangulation methods More...
#include <staticTriangulation.h>
Public Member Functions | |
Accessors / Modifiers | |
double | maxLog10CliqueDomainSize () |
returns the max of log10DomainSize of the cliques in the junction tree. More... | |
const NodeProperty< Size > * | domainSizes () const |
returns the domain sizes of the variables of the graph to be triangulated More... | |
Protected Attributes | |
EliminationSequenceStrategy * | elimination_sequence_strategy_ {nullptr} |
the elimination sequence strategy used by the triangulation More... | |
JunctionTreeStrategy * | junction_tree_strategy_ {nullptr} |
the junction tree strategy used by the triangulation More... | |
const NodeProperty< Size > * | domain_sizes_ {nullptr} |
the domain sizes of the variables/nodes of the graph More... | |
Constructors / Destructors | |
virtual StaticTriangulation * | newFactory () const =0 |
returns a fresh triangulation of the same type as the current object but over an empty graph More... | |
virtual StaticTriangulation * | copyFactory () const =0 |
virtual copy constructor More... | |
virtual | ~StaticTriangulation () |
destructor More... | |
StaticTriangulation (const EliminationSequenceStrategy &elimSeq, const JunctionTreeStrategy &JTStrategy, bool minimality=false) | |
default constructor: without any graph More... | |
StaticTriangulation (const UndiGraph *graph, const NodeProperty< Size > *dom_sizes, const EliminationSequenceStrategy &elimSeq, const JunctionTreeStrategy &JTStrategy, bool minimality=false) | |
constructor with a given graph More... | |
StaticTriangulation (const StaticTriangulation &) | |
forbid copy constructor except in newfactory More... | |
StaticTriangulation (StaticTriangulation &&) | |
forbid move constructor except in children's constructors More... | |
Accessors / Modifiers | |
virtual void | setGraph (const UndiGraph *graph, const NodeProperty< Size > *domsizes) |
initialize the triangulation data structures for a new graph More... | |
const EdgeSet & | fillIns () |
returns the fill-ins added by the triangulation algorithm More... | |
const std::vector< NodeId > & | eliminationOrder () |
returns an elimination ordering compatible with the triangulated graph More... | |
Idx | eliminationOrder (const NodeId) |
returns the index of a given node in the elimination order (0 = first node eliminated) More... | |
const NodeProperty< NodeId > & | reverseEliminationOrder () |
returns a table indicating, for each node, at which step it was deleted by the triangulation process More... | |
const UndiGraph & | triangulatedGraph () |
returns the triangulated graph More... | |
const CliqueGraph & | eliminationTree () |
returns the elimination tree of a compatible ordering More... | |
const CliqueGraph & | junctionTree () |
returns a compatible junction tree More... | |
NodeId | createdJunctionTreeClique (const NodeId id) |
returns the Id of the clique of the junction tree created by the elimination of a given node during the triangulation process More... | |
const NodeProperty< NodeId > & | createdJunctionTreeCliques () |
returns the Ids of the cliques of the junction tree created by the elimination of the nodes More... | |
const CliqueGraph & | maxPrimeSubgraphTree () |
returns a junction tree of maximal prime subgraphs More... | |
NodeId | createdMaxPrimeSubgraph (const NodeId id) |
returns the Id of the maximal prime subgraph created by the elimination of a given node during the triangulation process More... | |
void | clear () |
reinitialize the graph to be triangulated to an empty graph More... | |
void | setMinimalRequirement (bool) |
sets/unset the minimality requirement More... | |
virtual bool | isMinimalityRequired () const final |
indicates wether minimality is required More... | |
void | setFillIns (bool) |
sets/unsets the record of the fill-ins in the standard triangulation procedure More... | |
const UndiGraph * | originalGraph () const |
returns the graph to be triangulated More... | |
EliminationSequenceStrategy & | eliminationSequenceStrategy () const |
returns the elimination sequence strategy used by the triangulation More... | |
JunctionTreeStrategy & | junctionTreeStrategy () const |
returns the junction tree strategy used by the triangulation More... | |
virtual void | initTriangulation_ (UndiGraph &graph) |
the function called to initialize the triangulation process More... | |
base class for all non-incremental triangulation methods
Definition at line 49 of file staticTriangulation.h.
|
virtual |
destructor
Definition at line 152 of file staticTriangulation.cpp.
References gum::Set< Key, Alloc >::emplace().
|
protected |
default constructor: without any graph
elimSeq | the elimination sequence used to triangulate the graph |
JTStrategy | the junction tree strategy used to create junction trees from elimination trees |
minimality | a Boolean indicating whether we should enforce that the triangulation is minimal w.r.t. inclusion |
Definition at line 68 of file staticTriangulation.cpp.
References gum::Set< Key, Alloc >::emplace().
|
protected |
constructor with a given graph
graph | the graph to be triangulated, i.e., the nodes of which will be eliminated |
dom_sizes | the domain sizes of the nodes to be eliminated |
elimSeq | the elimination sequence used to triangulate the graph |
JTStrategy | the junction tree strategy used to create junction trees |
minimality | a Boolean indicating whether we should enforce that the triangulation is minimal w.r.t. inclusion |
Definition at line 40 of file staticTriangulation.cpp.
References gum::Set< Key, Alloc >::emplace().
|
protected |
forbid copy constructor except in newfactory
Definition at line 83 of file staticTriangulation.cpp.
References gum::Set< Key, Alloc >::emplace().
|
protected |
forbid move constructor except in children's constructors
Definition at line 115 of file staticTriangulation.cpp.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
reinitialize the graph to be triangulated to an empty graph
Implements gum::Triangulation.
Definition at line 164 of file staticTriangulation.cpp.
References gum::Set< Key, Alloc >::emplace().
|
private |
returns an elimination tree from a triangulated graph
Definition at line 337 of file staticTriangulation.cpp.
References gum::Set< Key, Alloc >::emplace().
|
private |
computes the junction tree of the maximal prime subgraphs
Definition at line 410 of file staticTriangulation.cpp.
References gum::Set< Key, Alloc >::emplace().
|
private |
used for computing the junction tree of the maximal prime subgraphs
Definition at line 376 of file staticTriangulation.cpp.
References gum::Set< Key, Alloc >::emplace().
|
private |
removes redondant fill-ins and compute proper elimination cliques and order
Definition at line 194 of file staticTriangulation.cpp.
References gum::Set< Key, Alloc >::emplace().
|
pure virtual |
virtual copy constructor
note that we return a pointer as it enables subclasses to return pointers to their types, not Triangulation pointers. See item 25 of the more effective C++.
Implements gum::Triangulation.
Implemented in gum::PartialOrderedTriangulation, gum::OrderedTriangulation, gum::DefaultTriangulation, and gum::UnconstrainedTriangulation.
returns the Id of the clique of the junction tree created by the elimination of a given node during the triangulation process
Implements gum::Triangulation.
|
virtual |
returns the Ids of the cliques of the junction tree created by the elimination of the nodes
Implements gum::Triangulation.
returns the Id of the maximal prime subgraph created by the elimination of a given node during the triangulation process
Implements gum::Triangulation.
|
inherited |
returns the domain sizes of the variables of the graph to be triangulated
|
virtual |
returns an elimination ordering compatible with the triangulated graph
Implements gum::Triangulation.
returns the index of a given node in the elimination order (0 = first node eliminated)
Implements gum::Triangulation.
EliminationSequenceStrategy& gum::StaticTriangulation::eliminationSequenceStrategy | ( | ) | const |
returns the elimination sequence strategy used by the triangulation
|
virtual |
returns the elimination tree of a compatible ordering
Implements gum::Triangulation.
|
virtual |
returns the fill-ins added by the triangulation algorithm
Implements gum::Triangulation.
Definition at line 679 of file staticTriangulation.cpp.
References gum::Set< Key, Alloc >::emplace().
|
protectedvirtual |
the function called to initialize the triangulation process
This function is called when the triangulation process starts and is used to initialize the elimination sequence strategy. Actually, the graph that is modified by the triangulation algorithm is a copy of the original graph, and this copy needs be known by the elimination sequence strategy. initTriangulation_ is used to transmit this knowledge to the elimination sequence (through method setGraph of the elimination sequence class).
graph | the very graph that is triangulated (this is a copy of original_graph__) |
Reimplemented in gum::PartialOrderedTriangulation, and gum::OrderedTriangulation.
Definition at line 733 of file staticTriangulation.cpp.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtual |
indicates wether minimality is required
|
virtual |
returns a compatible junction tree
Implements gum::Triangulation.
JunctionTreeStrategy& gum::StaticTriangulation::junctionTreeStrategy | ( | ) | const |
returns the junction tree strategy used by the triangulation
|
inherited |
returns the max of log10DomainSize of the cliques in the junction tree.
This is usefull for instance to estimate the complexity (both in space and in time) of the inference that will use the junction tree.
This method is not 'const' since it can be called before building any junction tree and hence it needs to build it...
Definition at line 69 of file triangulation.cpp.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
returns a junction tree of maximal prime subgraphs
Implements gum::Triangulation.
|
pure virtual |
returns a fresh triangulation of the same type as the current object but over an empty graph
note that we return a pointer as it enables subclasses to return pointers to their types, not Triangulation pointers. See item 25 of the more effective C++.
Implements gum::Triangulation.
Implemented in gum::PartialOrderedTriangulation, gum::OrderedTriangulation, gum::DefaultTriangulation, and gum::UnconstrainedTriangulation.
|
private |
forbid copy operator
const UndiGraph* gum::StaticTriangulation::originalGraph | ( | ) | const |
returns the graph to be triangulated
const NodeProperty< NodeId >& gum::StaticTriangulation::reverseEliminationOrder | ( | ) |
returns a table indicating, for each node, at which step it was deleted by the triangulation process
void gum::StaticTriangulation::setFillIns | ( | bool | ) |
sets/unsets the record of the fill-ins in the standard triangulation procedure
|
virtual |
initialize the triangulation data structures for a new graph
graph | the graph to be triangulated, i.e., the nodes of which will be eliminated |
domsizes | the domain sizes of the nodes to be eliminated |
Implements gum::Triangulation.
Reimplemented in gum::PartialOrderedTriangulation, and gum::OrderedTriangulation.
Definition at line 526 of file staticTriangulation.cpp.
References gum::Set< Key, Alloc >::emplace().
void gum::StaticTriangulation::setMinimalRequirement | ( | bool | ) |
sets/unset the minimality requirement
|
private |
the function that performs the triangulation
Definition at line 554 of file staticTriangulation.cpp.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
returns the triangulated graph
Implements gum::Triangulation.
Definition at line 487 of file staticTriangulation.cpp.
References gum::Set< Key, Alloc >::emplace().
|
private |
a vector containing the set of fill-ins added after each node elimination (used by recursive thinning)
Definition at line 295 of file staticTriangulation.h.
|
protectedinherited |
the domain sizes of the variables/nodes of the graph
Definition at line 152 of file triangulation.h.
|
private |
the cliques formed by the elimination of the nodes
Definition at line 253 of file staticTriangulation.h.
|
private |
the order in which nodes are eliminated by the algorithm
Definition at line 247 of file staticTriangulation.h.
|
private |
the elimination tree computed by the algorithm
Definition at line 256 of file staticTriangulation.h.
|
protected |
the elimination sequence strategy used by the triangulation
Definition at line 230 of file staticTriangulation.h.
|
private |
the fill-ins added during the whole triangulation process
Definition at line 244 of file staticTriangulation.h.
|
private |
a boolean indicating whether the elimination tree has been computed
Definition at line 278 of file staticTriangulation.h.
|
private |
indicates whether we actually computed fill-ins
Definition at line 288 of file staticTriangulation.h.
|
private |
a boolean indicating whether the junction tree has been constructed
Definition at line 281 of file staticTriangulation.h.
|
private |
indicates whether a maximal prime subgraph junction tree has been constructed
Definition at line 285 of file staticTriangulation.h.
|
private |
a boolean indicating whether we have constructed the triangulated graph
Definition at line 275 of file staticTriangulation.h.
|
private |
a boolean indicating whether we have parformed a triangulation
Definition at line 272 of file staticTriangulation.h.
|
private |
the junction tree computed by the algorithm
note that the junction tree is owned by the junctionTreeStrategy and, therefore, its deletion from memory is not handled by the static triangulation class.
Definition at line 262 of file staticTriangulation.h.
|
protected |
the junction tree strategy used by the triangulation
Definition at line 233 of file staticTriangulation.h.
|
private |
the maximal prime subgraph junction tree computed from the junction tree
Definition at line 265 of file staticTriangulation.h.
|
private |
indicates whether the triangulation must be minimal
Definition at line 291 of file staticTriangulation.h.
|
private |
indicates which clique of the max prime junction tree was created by the elmination of a given node (the key of the table)
Definition at line 269 of file staticTriangulation.h.
|
private |
a pointer to the (external) original graph (which will be triangulated)
Definition at line 238 of file staticTriangulation.h.
|
private |
the elimination order (access by NodeId)
Definition at line 250 of file staticTriangulation.h.
|
private |
the triangulated graph
Definition at line 241 of file staticTriangulation.h.
|
private |
a boolean indicating if we want fill-ins list with the standard triangulation method
Definition at line 299 of file staticTriangulation.h.