move sum, max and nrValues to Constraint class as well
parent
7561da4df2
commit
ff5371fd4a
|
@ -72,25 +72,6 @@ class GTSAM_UNSTABLE_EXPORT AllDiff : public Constraint {
|
|||
/// Partially apply known values, domain version
|
||||
Constraint::shared_ptr partiallyApply(
|
||||
const Domains&) const override;
|
||||
|
||||
/// Get the number of non-zero values contained in this factor.
|
||||
uint64_t nrValues() const override { return 1; };
|
||||
|
||||
DiscreteFactor::shared_ptr sum(size_t nrFrontals) const override {
|
||||
return toDecisionTreeFactor().sum(nrFrontals);
|
||||
}
|
||||
|
||||
DiscreteFactor::shared_ptr sum(const Ordering& keys) const override {
|
||||
return toDecisionTreeFactor().sum(keys);
|
||||
}
|
||||
|
||||
DiscreteFactor::shared_ptr max(size_t nrFrontals) const override {
|
||||
return toDecisionTreeFactor().max(nrFrontals);
|
||||
}
|
||||
|
||||
DiscreteFactor::shared_ptr max(const Ordering& keys) const override {
|
||||
return toDecisionTreeFactor().max(keys);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace gtsam
|
||||
|
|
|
@ -96,25 +96,6 @@ class BinaryAllDiff : public Constraint {
|
|||
AlgebraicDecisionTree<Key> errorTree() const override {
|
||||
throw std::runtime_error("BinaryAllDiff::error not implemented");
|
||||
}
|
||||
|
||||
/// Get the number of non-zero values contained in this factor.
|
||||
uint64_t nrValues() const override { return 1; };
|
||||
|
||||
DiscreteFactor::shared_ptr sum(size_t nrFrontals) const override {
|
||||
return toDecisionTreeFactor().sum(nrFrontals);
|
||||
}
|
||||
|
||||
DiscreteFactor::shared_ptr sum(const Ordering& keys) const override {
|
||||
return toDecisionTreeFactor().sum(keys);
|
||||
}
|
||||
|
||||
DiscreteFactor::shared_ptr max(size_t nrFrontals) const override {
|
||||
return toDecisionTreeFactor().max(nrFrontals);
|
||||
}
|
||||
|
||||
DiscreteFactor::shared_ptr max(const Ordering& keys) const override {
|
||||
return toDecisionTreeFactor().max(keys);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace gtsam
|
||||
|
|
|
@ -68,7 +68,8 @@ class GTSAM_UNSTABLE_EXPORT Constraint : public DiscreteFactor {
|
|||
/*
|
||||
* Ensure Arc-consistency by checking every possible value of domain j.
|
||||
* @param j domain to be checked
|
||||
* @param (in/out) domains all domains, but only domains->at(j) will be checked.
|
||||
* @param (in/out) domains all domains, but only domains->at(j) will be
|
||||
* checked.
|
||||
* @return true if domains->at(j) was changed, false otherwise.
|
||||
*/
|
||||
virtual bool ensureArcConsistency(Key j, Domains* domains) const = 0;
|
||||
|
@ -92,6 +93,25 @@ class GTSAM_UNSTABLE_EXPORT Constraint : public DiscreteFactor {
|
|||
return this->toDecisionTreeFactor() / df;
|
||||
}
|
||||
|
||||
/// Get the number of non-zero values contained in this factor.
|
||||
uint64_t nrValues() const override { return 1; };
|
||||
|
||||
DiscreteFactor::shared_ptr sum(size_t nrFrontals) const override {
|
||||
return toDecisionTreeFactor().sum(nrFrontals);
|
||||
}
|
||||
|
||||
DiscreteFactor::shared_ptr sum(const Ordering& keys) const override {
|
||||
return toDecisionTreeFactor().sum(keys);
|
||||
}
|
||||
|
||||
DiscreteFactor::shared_ptr max(size_t nrFrontals) const override {
|
||||
return toDecisionTreeFactor().max(nrFrontals);
|
||||
}
|
||||
|
||||
DiscreteFactor::shared_ptr max(const Ordering& keys) const override {
|
||||
return toDecisionTreeFactor().max(keys);
|
||||
}
|
||||
|
||||
/// @}
|
||||
/// @name Wrapper support
|
||||
/// @{
|
||||
|
|
|
@ -114,22 +114,6 @@ class GTSAM_UNSTABLE_EXPORT Domain : public Constraint {
|
|||
|
||||
/// Partially apply known values, domain version
|
||||
Constraint::shared_ptr partiallyApply(const Domains& domains) const override;
|
||||
|
||||
DiscreteFactor::shared_ptr sum(size_t nrFrontals) const override {
|
||||
return toDecisionTreeFactor().sum(nrFrontals);
|
||||
}
|
||||
|
||||
DiscreteFactor::shared_ptr sum(const Ordering& keys) const override {
|
||||
return toDecisionTreeFactor().sum(keys);
|
||||
}
|
||||
|
||||
DiscreteFactor::shared_ptr max(size_t nrFrontals) const override {
|
||||
return toDecisionTreeFactor().max(nrFrontals);
|
||||
}
|
||||
|
||||
DiscreteFactor::shared_ptr max(const Ordering& keys) const override {
|
||||
return toDecisionTreeFactor().max(keys);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace gtsam
|
||||
|
|
|
@ -77,25 +77,6 @@ class GTSAM_UNSTABLE_EXPORT SingleValue : public Constraint {
|
|||
/// Partially apply known values, domain version
|
||||
Constraint::shared_ptr partiallyApply(
|
||||
const Domains& domains) const override;
|
||||
|
||||
/// Get the number of non-zero values contained in this factor.
|
||||
uint64_t nrValues() const override { return 1; };
|
||||
|
||||
DiscreteFactor::shared_ptr sum(size_t nrFrontals) const override {
|
||||
return toDecisionTreeFactor().sum(nrFrontals);
|
||||
}
|
||||
|
||||
DiscreteFactor::shared_ptr sum(const Ordering& keys) const override {
|
||||
return toDecisionTreeFactor().sum(keys);
|
||||
}
|
||||
|
||||
DiscreteFactor::shared_ptr max(size_t nrFrontals) const override {
|
||||
return toDecisionTreeFactor().max(nrFrontals);
|
||||
}
|
||||
|
||||
DiscreteFactor::shared_ptr max(const Ordering& keys) const override {
|
||||
return toDecisionTreeFactor().max(keys);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace gtsam
|
||||
|
|
Loading…
Reference in New Issue