11 #include <boost/make_shared.hpp> 24 for (
size_t v: values_) cout <<
v;
29 return contains(values.at(keys_[0]));
37 for (
size_t i1 = 0; i1 < cardinality_; ++i1)
38 table.push_back(contains(i1));
46 return toDecisionTreeFactor() *
f;
51 if (j != keys_[0])
throw invalid_argument(
"Domain check on wrong domain");
53 for(
size_t value: values_)
63 for(
size_t value: values_) {
67 if (k!=j && domains[k].contains(
value))
70 values_.insert(
value);
81 if (it != values.end() && !contains(it->second))
throw runtime_error(
82 "Domain::partiallyApply: unsatisfiable");
83 return boost::make_shared < Domain > (*this);
88 const vector<Domain>& domains)
const {
89 const Domain& Dk = domains[keys_[0]];
91 "Domain::partiallyApply: unsatisfiable");
92 return boost::make_shared < Domain > (Dk);
Concept check for values that can be used in unit tests.
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
double operator()(const Values &values) const override
Calculate value.
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
bool checkAllDiff(const KeyVector keys, std::vector< Domain > &domains)
const_iterator begin() const
std::pair< Key, size_t > DiscreteKey
Constraint::shared_ptr partiallyApply(const Values &values) const override
Partially apply known values.
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
boost::transform_iterator< boost::function1< ConstKeyValuePair, const ConstKeyValuePtrPair & >, KeyValueMap::const_iterator > const_iterator
Const forward iterator, with value type ConstKeyValuePair.
DecisionTreeFactor toDecisionTreeFactor() const override
Convert into a decisiontree.
bool ensureArcConsistency(size_t j, std::vector< Domain > &domains) const override
bool contains(size_t value) const
std::uint64_t Key
Integer nonlinear key type.
boost::shared_ptr< Constraint > shared_ptr
DiscreteKeys is a set of keys that can be assembled using the & operator.