Revert "Fix constraints"

This reverts commit 2b6545233a.
release/4.3a0
Frank Dellaert 2025-01-30 22:10:50 -05:00
parent 2b6545233a
commit 0d5b03d609
6 changed files with 5 additions and 36 deletions

View File

@ -136,6 +136,9 @@ class GTSAM_EXPORT DiscreteFactor : public Factor {
/**
* @brief Multiply in a DiscreteFactor and return the result as
* DiscreteFactor, both via shared pointers.
*
* @param df DiscreteFactor shared_ptr
* @return DiscreteFactor::shared_ptr
*/
virtual DiscreteFactor::shared_ptr multiply(
const DiscreteFactor::shared_ptr& df) const = 0;
@ -167,7 +170,7 @@ class GTSAM_EXPORT DiscreteFactor : public Factor {
*
* @return DiscreteFactor::shared_ptr
*/
virtual DiscreteFactor::shared_ptr scale() const;
DiscreteFactor::shared_ptr scale() const;
/**
* Get the number of non-zero values contained in this factor.

View File

@ -72,11 +72,6 @@ class GTSAM_UNSTABLE_EXPORT AllDiff : public Constraint {
/// Partially apply known values, domain version
Constraint::shared_ptr partiallyApply(
const Domains&) const override;
// Scale just returns the same constraint.
DiscreteFactor::shared_ptr scale() const override {
return std::make_shared<AllDiff>(*this);
}
};
} // namespace gtsam

View File

@ -96,11 +96,6 @@ class BinaryAllDiff : public Constraint {
AlgebraicDecisionTree<Key> errorTree() const override {
throw std::runtime_error("BinaryAllDiff::error not implemented");
}
// Scale just returns the same constraint.
DiscreteFactor::shared_ptr scale() const override {
return std::make_shared<BinaryAllDiff>(*this);
}
};
} // namespace gtsam

View File

@ -29,9 +29,7 @@ class Domain;
using Domains = std::map<Key, Domain>;
/**
* Base class for constraint factors.
* This class is used to represent constraints on discrete variables.
* The values are always either 0 or 1, with at least one 1.
* Base class for constraint factors
* Derived classes include SingleValue, BinaryAllDiff, and AllDiff.
*/
class GTSAM_UNSTABLE_EXPORT Constraint : public DiscreteFactor {
@ -82,16 +80,6 @@ class GTSAM_UNSTABLE_EXPORT Constraint : public DiscreteFactor {
/// Partially apply known values, domain version
virtual shared_ptr partiallyApply(const Domains&) const = 0;
/// Multiply in a DecisionTreeFactor.
DecisionTreeFactor operator*(const DecisionTreeFactor& df) const override {
throw std::logic_error("Constraint::operator* not implemented");
}
/// Multiply with scalar just returns the constraint.
DiscreteFactor::shared_ptr operator*(double /* s*/) const override {
throw std::logic_error("Constraint::operator* not implemented");
}
/// Multiply factors, DiscreteFactor::shared_ptr edition
DiscreteFactor::shared_ptr multiply(
const DiscreteFactor::shared_ptr& df) const override {
@ -116,8 +104,6 @@ class GTSAM_UNSTABLE_EXPORT Constraint : public DiscreteFactor {
return toDecisionTreeFactor().sum(keys);
}
double max() const override { return 1.0; }
DiscreteFactor::shared_ptr max(size_t nrFrontals) const override {
return toDecisionTreeFactor().max(nrFrontals);
}

View File

@ -114,11 +114,6 @@ class GTSAM_UNSTABLE_EXPORT Domain : public Constraint {
/// Partially apply known values, domain version
Constraint::shared_ptr partiallyApply(const Domains& domains) const override;
// Scale just returns the same constraint.
DiscreteFactor::shared_ptr scale() const override {
return std::make_shared<Domain>(*this);
}
};
} // namespace gtsam

View File

@ -77,11 +77,6 @@ class GTSAM_UNSTABLE_EXPORT SingleValue : public Constraint {
/// Partially apply known values, domain version
Constraint::shared_ptr partiallyApply(
const Domains& domains) const override;
// Scale just returns the same constraint.
DiscreteFactor::shared_ptr scale() const override {
return std::make_shared<SingleValue>(*this);
}
};
} // namespace gtsam