11 #include <boost/make_shared.hpp> 25 std::cout << s <<
"AllDiff on ";
28 std::cout << std::endl;
33 std::set < size_t > taken;
35 size_t value = values.at(dkey);
36 if (taken.count(value))
return 0.0;
47 for (
size_t i1 = 0; i1 <
nrKeys; i1++)
48 for (
size_t i2 = i1 + 1; i2 <
nrKeys; i2++) {
75 const Domain& Dk = domains[k];
92 if (values.find(k) == values.end()) {
95 return boost::make_shared<AllDiff>(newKeys);
100 const std::vector<Domain>& domains)
const {
103 const Domain& Dk = domains[k];
Concept check for values that can be used in unit tests.
DecisionTreeFactor toDecisionTreeFactor() const override
Convert into a decisiontree, can be very expensive !
KeyVector keys_
The keys involved in this factor.
DecisionTreeFactor operator*(const DecisionTreeFactor &f) const override
Multiply into a decisiontree.
AllDiff(const DiscreteKeys &dkeys)
Constructor.
const KeyFormatter & formatter
bool ensureArcConsistency(size_t j, std::vector< Domain > &domains) const override
static const size_t nrKeys
DiscreteKey discreteKey(size_t i) const
bool checkAllDiff(const KeyVector keys, std::vector< Domain > &domains)
std::pair< Key, size_t > DiscreteKey
void print(const std::string &s="", const KeyFormatter &formatter=DefaultKeyFormatter) const override
print
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 >)
DecisionTreeFactor toDecisionTreeFactor() const override
Convert into a decisiontree.
double operator()(const Values &values) const override
Calculate value = expensive !
size_t firstValue() const
Constraint::shared_ptr partiallyApply(const Values &) const override
Partially apply known values.
std::map< Key, size_t > cardinalities_
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.
void erase(size_t value)
erase a value, non const :-(