28 typedef std::shared_ptr<SingleValue> shared_ptr;
32 :
Constraint(key), cardinality_(n), value_(value) {}
36 :
Constraint(dkey.first), cardinality_(dkey.second), value_(value) {}
48 return (cardinality_ == f.cardinality_) && (value_ == f.value_);
68 bool ensureArcConsistency(
Key j, Domains* domains)
const override;
71 Constraint::shared_ptr partiallyApply(
75 Constraint::shared_ptr partiallyApply(
const Domains& domains)
const override;
specialized key for discrete variables
std::pair< Key, size_t > DiscreteKey
Key type for discrete variables.
Definition DiscreteKey.h:38
Global functions in a separate testing namespace.
Definition chartTesting.h:28
KeyFormatter DefaultKeyFormatter
Assign default key formatter.
Definition Key.cpp:30
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition Matrix.cpp:143
Point2 operator*(double s, const Point2 &p)
multiply with scalar
Definition Point2.h:52
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
std::uint64_t Key
Integer nonlinear key type.
Definition types.h:43
An assignment from labels to value index (size_t).
Definition Assignment.h:37
Constraint(Key j)
Construct unary constraint factor.
Definition Constraint.h:42
A discrete probabilistic factor.
Definition DecisionTreeFactor.h:42
Base class for discrete probabilistic factors The most general one is the derived DecisionTreeFactor.
Definition DiscreteFactor.h:41
A map from keys to values.
Definition DiscreteValues.h:34
SingleValue(Key key, size_t n, size_t value)
Construct from key, cardinality, and given value.
Definition SingleValue.h:31
bool equals(const DiscreteFactor &other, double tol) const override
Return whether another factor is an equal constraint.
Definition SingleValue.h:43
SingleValue(const DiscreteKey &dkey, size_t value)
Construct from DiscreteKey and given value.
Definition SingleValue.h:35
KeyVector keys_
The keys involved in this factor.
Definition Factor.h:88