27 cardinality0_(key1.second),
28 cardinality1_(key2.second) {}
32 const std::string&
s =
"",
40 if (!dynamic_cast<const BinaryAllDiff*>(&other))
51 return (
double)(values.at(
keys_[0]) != values.at(
keys_[1]));
59 std::vector<double>
table;
61 for (
size_t i2 = 0; i2 <
cardinality1_; i2++) table.push_back(i1 != i2);
79 throw std::runtime_error(
80 "BinaryAllDiff::ensureArcConsistency not implemented");
86 throw std::runtime_error(
"BinaryAllDiff::partiallyApply not implemented");
91 const Domains&)
const override {
92 throw std::runtime_error(
"BinaryAllDiff::partiallyApply not implemented");
std::shared_ptr< Constraint > shared_ptr
DecisionTreeFactor operator*(const DecisionTreeFactor &f) const override
Multiply into a decisiontree.
KeyVector keys_
The keys involved in this factor.
static const KeyFormatter DefaultKeyFormatter
const KeyFormatter & formatter
Constraint::shared_ptr partiallyApply(const Domains &) const override
Partially apply known values, domain version.
void print(const std::string &s="", const KeyFormatter &formatter=DefaultKeyFormatter) const override
print
double operator()(const DiscreteValues &values) const override
Calculate value.
bool ensureArcConsistency(Key j, Domains *domains) const override
std::map< Key, Domain > Domains
const Symbol key1('v', 1)
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.
DecisionTreeFactor toDecisionTreeFactor() const override
Convert into a decisiontree.
Constraint::shared_ptr partiallyApply(const DiscreteValues &) const override
Partially apply known values.
bool equals(const DiscreteFactor &other, double tol) const override
equals
std::pair< Key, size_t > DiscreteKey
BinaryAllDiff(const DiscreteKey &key1, const DiscreteKey &key2)
cardinality
const KeyVector & keys() const
Access the factor's involved variable keys.
std::uint64_t Key
Integer nonlinear key type.
const Symbol key2('v', 2)
DiscreteKeys is a set of keys that can be assembled using the & operator.