Skip to content

Commit

Permalink
move multiply to Constraint.h
Browse files Browse the repository at this point in the history
  • Loading branch information
varunagrawal committed Jan 6, 2025
1 parent 713c49c commit 43f755d
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 28 deletions.
7 changes: 0 additions & 7 deletions gtsam_unstable/discrete/AllDiff.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,6 @@ class GTSAM_UNSTABLE_EXPORT AllDiff : public Constraint {
/// Multiply into a decisiontree
DecisionTreeFactor operator*(const DecisionTreeFactor& f) const override;

/// Multiply factors, DiscreteFactor::shared_ptr edition
DiscreteFactor::shared_ptr multiply(
const DiscreteFactor::shared_ptr& df) const override {
return std::make_shared<DecisionTreeFactor>(
this->operator*(df->toDecisionTreeFactor()));
}

/// Compute error for each assignment and return as a tree
AlgebraicDecisionTree<Key> errorTree() const override {
throw std::runtime_error("AllDiff::error not implemented");
Expand Down
7 changes: 0 additions & 7 deletions gtsam_unstable/discrete/BinaryAllDiff.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,6 @@ class BinaryAllDiff : public Constraint {
return toDecisionTreeFactor() * f;
}

/// Multiply factors, DiscreteFactor::shared_ptr edition
DiscreteFactor::shared_ptr multiply(
const DiscreteFactor::shared_ptr& df) const override {
return std::make_shared<DecisionTreeFactor>(
this->operator*(df->toDecisionTreeFactor()));
}

/*
* Ensure Arc-consistency by checking every possible value of domain j.
* @param j domain to be checked
Expand Down
8 changes: 8 additions & 0 deletions gtsam_unstable/discrete/Constraint.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ class GTSAM_UNSTABLE_EXPORT Constraint : public DiscreteFactor {

/// Partially apply known values, domain version
virtual shared_ptr partiallyApply(const Domains&) const = 0;

/// Multiply factors, DiscreteFactor::shared_ptr edition
DiscreteFactor::shared_ptr multiply(
const DiscreteFactor::shared_ptr& df) const override {
return std::make_shared<DecisionTreeFactor>(
this->operator*(df->toDecisionTreeFactor()));
}

/// @}
/// @name Wrapper support
/// @{
Expand Down
7 changes: 0 additions & 7 deletions gtsam_unstable/discrete/Domain.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,6 @@ class GTSAM_UNSTABLE_EXPORT Domain : public Constraint {
/// Multiply into a decisiontree
DecisionTreeFactor operator*(const DecisionTreeFactor& f) const override;

/// Multiply factors, DiscreteFactor::shared_ptr edition
DiscreteFactor::shared_ptr multiply(
const DiscreteFactor::shared_ptr& df) const override {
return std::make_shared<DecisionTreeFactor>(
this->operator*(df->toDecisionTreeFactor()));
}

/*
* Ensure Arc-consistency by checking every possible value of domain j.
* @param j domain to be checked
Expand Down
7 changes: 0 additions & 7 deletions gtsam_unstable/discrete/SingleValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,6 @@ class GTSAM_UNSTABLE_EXPORT SingleValue : public Constraint {
/// Multiply into a decisiontree
DecisionTreeFactor operator*(const DecisionTreeFactor& f) const override;

/// Multiply factors, DiscreteFactor::shared_ptr edition
DiscreteFactor::shared_ptr multiply(
const DiscreteFactor::shared_ptr& df) const override {
return std::make_shared<DecisionTreeFactor>(
this->operator*(df->toDecisionTreeFactor()));
}

/*
* Ensure Arc-consistency: just sets domain[j] to {value_}.
* @param j domain to be checked
Expand Down

0 comments on commit 43f755d

Please sign in to comment.