21 for (
size_t v : values_) cout <<
" " <<
v;
28 for (
size_t v : values_) ss <<
v + 1;
34 return contains(values.at(
key()));
41 for (
size_t i1 = 0; i1 < cardinality_; ++i1) table.push_back(contains(i1));
49 return toDecisionTreeFactor() *
f;
54 if (j !=
key())
throw invalid_argument(
"Domain check on wrong domain");
56 for (
size_t value : values_)
67 for (
const size_t value : values_) {
69 for (
const Key k : keys)
71 if (k != j && domains.at(k).contains(
value))
goto found;
81 DiscreteValues::const_iterator it = values.find(
key());
82 if (it != values.end() && !contains(it->second))
83 throw runtime_error(
"Domain::partiallyApply: unsatisfiable");
84 return std::make_shared<Domain>(*this);
91 throw runtime_error(
"Domain::partiallyApply: unsatisfiable");
92 return std::make_shared<Domain>(Dk);
const gtsam::Symbol key('X', 0)
std::string base1Str() const
Concept check for values that can be used in unit tests.
std::optional< Domain > checkAllDiff(const KeyVector keys, const Domains &domains) const
std::shared_ptr< Constraint > shared_ptr
double operator()(const DiscreteValues &values) const override
Calculate value.
void print(const std::string &s="", const KeyFormatter &formatter=DefaultKeyFormatter) const override
print
DecisionTreeFactor operator*(const DecisionTreeFactor &f) const override
Multiply into a decisiontree.
const KeyFormatter & formatter
bool ensureArcConsistency(Key j, Domains *domains) const override
std::map< Key, Domain > Domains
Array< int, Dynamic, 1 > v
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
static std::stringstream ss
bool contains(size_t value) const
DecisionTreeFactor toDecisionTreeFactor() const override
Convert into a decisiontree.
std::pair< Key, size_t > DiscreteKey
Constraint::shared_ptr partiallyApply(const DiscreteValues &values) const override
Partially apply known values.
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
const_iterator begin() const
std::uint64_t Key
Integer nonlinear key type.
DiscreteKeys is a set of keys that can be assembled using the & operator.