56#define ALLOCATE(x) SmallObjectAllocator::instance().allocate(x)
57#define DEALLOCATE(x, y) SmallObjectAllocator::instance().deallocate(x, y)
61 template <
typename GUM_ELEMENT,
62 template <
typename >
class COMBINEOPERATOR,
63 template <
typename >
class TerminalNodePolicy >
73 template <
typename GUM_ELEMENT,
74 template <
typename >
class COMBINEOPERATOR,
75 template <
typename >
class TerminalNodePolicy >
86 template <
typename GUM_ELEMENT,
87 template <
typename >
class COMBINEOPERATOR,
88 template <
typename >
class TerminalNodePolicy >
95 template <
typename GUM_ELEMENT,
96 template <
typename >
class COMBINEOPERATOR,
97 template <
typename >
class TerminalNodePolicy >
107 template <
typename GUM_ELEMENT,
108 template <
typename >
class COMBINEOPERATOR,
109 template <
typename >
class TerminalNodePolicy >
112 if (
_dt1_->isTerminalNode(currentNodeId)) {
119 if (!
_rd_->variablesSequence().exists(currentNode->
nodeVar()))
124 for (
Idx moda = 0; moda < currentNode->
nodeVar()->domainSize(); ++moda) {
132 template <
typename GUM_ELEMENT,
133 template <
typename >
class COMBINEOPERATOR,
134 template <
typename >
class TerminalNodePolicy >
137 if (
_dt2_->isTerminalNode(currentNodeId))
138 return _rd_->manager()->addTerminalNode(
143 if (!
_rd_->variablesSequence().exists(currentNode->
nodeVar()))
151 for (
Idx moda = 0; moda < currentNode->
nodeVar()->domainSize(); ++moda) {
159 template <
typename GUM_ELEMENT,
160 template <
typename >
class COMBINEOPERATOR,
161 template <
typename >
class TerminalNodePolicy >
166 for (
Idx moda = 1; moda < var->
domainSize() && !diff; ++moda)
167 if (sonsMap[0] != sonsMap[moda]) diff =
true;
175 return _rd_->manager()->addInternalNode(var, sonsMap);
Base class for discrete random variable.
virtual Size domainSize() const =0
The class for generic Hash Tables.
Structure used to represent a node internal structure.
const DiscreteVariable * nodeVar() const
Returns the node variable.
NodeId son(Idx modality) const
Returns the son at a given index.
static MultiDimFunctionGraph< GUM_ELEMENT, TerminalNodePolicy > * getTreeInstance()
Returns an arborescent instance.
HashTable< const DiscreteVariable *, Idx > _context_
TreeOperator(const MultiDimFunctionGraph< GUM_ELEMENT, TerminalNodePolicy > *dt1, const MultiDimFunctionGraph< GUM_ELEMENT, TerminalNodePolicy > *dt2)
Default constructor.
const MultiDimFunctionGraph< GUM_ELEMENT, TerminalNodePolicy > * _dt1_
The two function graphs used for the operation.
MultiDimFunctionGraph< GUM_ELEMENT, TerminalNodePolicy > * _rd_
The resulting function graph.
NodeId _checkRedundancy_(const DiscreteVariable *, NodeId *)
NodeId _xPloreDT1_(NodeId currentNodeId)
The main recursion function.
~TreeOperator()
Default destructor.
NodeId _xPloreDT2_(NodeId currentNodeId)
The main recursion function.
const COMBINEOPERATOR< GUM_ELEMENT > _combine_
The function to be performed on the leaves.
const MultiDimFunctionGraph< GUM_ELEMENT, TerminalNodePolicy > * _dt2_
MultiDimFunctionGraph< GUM_ELEMENT, TerminalNodePolicy > * compute()
Computes and builds the Function Graph that is the result of the operation.
Size Idx
Type for indexes.
Size NodeId
Type for node ids.
Headers of the InternalNode class.
gum is the global namespace for all aGrUM entities
Class used to compute the operation between two decision diagrams.