21#include <boost/range.hpp>
39 template<
class FACTOR,
class DERIVEDCONDITIONAL>
52 typedef boost::iterator_range<typename FACTOR::const_iterator>
Frontals;
55 typedef boost::iterator_range<typename FACTOR::const_iterator>
Parents;
74 void print(
const std::string& s =
"Conditional",
const KeyFormatter& formatter = DefaultKeyFormatter)
const;
77 bool equals(
const This& c,
double tol = 1e-9)
const;
93 return asFactor().front();
95 throw std::invalid_argument(
"Requested Conditional::firstFrontalKey from a conditional with zero frontal keys");
105 typename FACTOR::const_iterator
beginFrontals()
const {
return asFactor().begin(); }
114 typename FACTOR::const_iterator
endParents()
const {
return asFactor().end(); }
133 typename FACTOR::iterator
endParents() {
return asFactor().end(); }
137 FACTOR& asFactor() {
return static_cast<FACTOR&
>(
static_cast<DERIVEDCONDITIONAL&
>(*this)); }
140 const FACTOR& asFactor()
const {
return static_cast<const FACTOR&
>(
static_cast<const DERIVEDCONDITIONAL&
>(*this)); }
144 template<
class ARCHIVE>
145 void serialize(ARCHIVE & ar,
const unsigned int ) {
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:69
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition: Key.h:35
TODO: Update comments.
Definition: Conditional.h:41
size_t nrFrontals_
The first nrFrontal variables are frontal and the rest are parents.
Definition: Conditional.h:44
Key firstFrontalKey() const
Convenience function to get the first frontal key.
Definition: Conditional.h:91
FACTOR::const_iterator endFrontals() const
Iterator pointing past the last frontal key.
Definition: Conditional.h:108
void print(const std::string &s="Conditional", const KeyFormatter &formatter=DefaultKeyFormatter) const
print with optional formatter
Definition: Conditional-inst.h:29
FACTOR::iterator endParents()
Mutable iterator pointing past the last parent key.
Definition: Conditional.h:133
FACTOR::iterator endFrontals()
Mutable iterator pointing past the last frontal key.
Definition: Conditional.h:127
Parents parents() const
return a view of the parent keys
Definition: Conditional.h:102
boost::iterator_range< typename FACTOR::const_iterator > Parents
View of the separator keys (call parents())
Definition: Conditional.h:55
size_t nrFrontals() const
return the number of frontals
Definition: Conditional.h:85
Conditional()
Empty Constructor to make serialization possible.
Definition: Conditional.h:62
Conditional(size_t nrFrontals)
Constructor.
Definition: Conditional.h:65
FACTOR::iterator beginParents()
Mutable iterator pointing to the first parent key.
Definition: Conditional.h:130
size_t & nrFrontals()
Mutable version of nrFrontals.
Definition: Conditional.h:121
FACTOR::iterator beginFrontals()
Mutable iterator pointing to first frontal key.
Definition: Conditional.h:124
boost::iterator_range< typename FACTOR::const_iterator > Frontals
View of the frontal keys (call frontals())
Definition: Conditional.h:52
Frontals frontals() const
return a view of the frontal keys
Definition: Conditional.h:99
friend class boost::serialization::access
Serialization function.
Definition: Conditional.h:143
FACTOR::const_iterator beginFrontals() const
Iterator pointing to first frontal key.
Definition: Conditional.h:105
size_t nrParents() const
return the number of parents
Definition: Conditional.h:88
FACTOR::const_iterator endParents() const
Iterator pointing past the last parent key.
Definition: Conditional.h:114
FACTOR::const_iterator beginParents() const
Iterator pointing to the first parent key.
Definition: Conditional.h:111
bool equals(const This &c, double tol=1e-9) const
check equality
Definition: Conditional-inst.h:42