updates to fix various issues

release/4.3a0
Frank Dellaert 2022-01-21 17:39:06 -05:00
parent 125708fbb7
commit 03314ed781
4 changed files with 12 additions and 36 deletions

View File

@ -322,8 +322,7 @@ size_t DiscreteConditional::sample(const DiscreteValues& parentsValues) const {
return distribution(rng);
}
/* ********************************************************************************
*/
/* ************************************************************************** */
size_t DiscreteConditional::sample(size_t parent_value) const {
if (nrParents() != 1)
throw std::invalid_argument(
@ -334,8 +333,7 @@ size_t DiscreteConditional::sample(size_t parent_value) const {
return sample(values);
}
/* ********************************************************************************
*/
/* ************************************************************************** */
size_t DiscreteConditional::sample() const {
if (nrParents() != 0)
throw std::invalid_argument(

View File

@ -163,14 +163,6 @@ class GTSAM_EXPORT DiscreteFactorGraph
*/
DiscreteValues optimize(const Ordering& ordering) const;
// /** Permute the variables in the factors */
// GTSAM_EXPORT void permuteWithInverse(const Permutation&
// inversePermutation);
//
// /** Apply a reduction, which is a remapping of variable indices. */
// GTSAM_EXPORT void reduceWithInverse(const internal::Reduction&
// inverseReduction);
/// @name Wrapper support
/// @{

View File

@ -10,7 +10,7 @@
* -------------------------------------------------------------------------- */
/**
* @file DiscreteLookupTable.cpp
* @file DiscreteLookupDAG.cpp
* @date Feb 14, 2011
* @author Duy-Nguyen Ta
* @author Frank Dellaert
@ -116,12 +116,6 @@ DiscreteLookupDAG DiscreteLookupDAG::FromBayesNet(
return dag;
}
/* ************************************************************************** */
DiscreteValues DiscreteLookupDAG::argmax() const {
DiscreteValues result;
return argmax(result);
}
DiscreteValues DiscreteLookupDAG::argmax(DiscreteValues result) const {
// Argmax each node in turn in topological sort order (parents first).
for (auto lookupTable : boost::adaptors::reverse(*this))

View File

@ -11,7 +11,7 @@
/**
* @file DiscreteLookupDAG.h
* @date JAnuary, 2022
* @date January, 2022
* @author Frank dellaert
*/
@ -34,7 +34,7 @@ class DiscreteBayesNet;
* @brief DiscreteLookupTable table for max-product
*
* Inherits from discrete conditional for convenience, but is not normalized.
* Is used in pax-product algorithm.
* Is used in the max-product algorithm.
*/
class DiscreteLookupTable : public DiscreteConditional {
public:
@ -85,7 +85,7 @@ class GTSAM_EXPORT DiscreteLookupDAG : public BayesNet<DiscreteLookupTable> {
/// Construct empty DAG.
DiscreteLookupDAG() {}
// Create from BayesNet with LookupTables
/// Create from BayesNet with LookupTables
static DiscreteLookupDAG FromBayesNet(const DiscreteBayesNet& bayesNet);
/// Destructor
@ -111,25 +111,17 @@ class GTSAM_EXPORT DiscreteLookupDAG : public BayesNet<DiscreteLookupTable> {
}
/**
* @brief argmax by back-substitution.
* @brief argmax by back-substitution, optionally given certain variables.
*
* Assumes the DAG is reverse topologically sorted, i.e. last
* conditional will be optimized first. If the DAG resulted from
* eliminating a factor graph, this is true for the elimination ordering.
*
* @return optimal assignment for all variables.
*/
DiscreteValues argmax() const;
/**
* @brief argmax by back-substitution, given certain variables.
*
* Assumes the DAG is reverse topologically sorted *and* that the
* DAG does not contain any conditionals for the given variables.
* conditional will be optimized first *and* that the
* DAG does not contain any conditionals for the given variables. If the DAG
* resulted from eliminating a factor graph, this is true for the elimination
* ordering.
*
* @return given assignment extended w. optimal assignment for all variables.
*/
DiscreteValues argmax(DiscreteValues given) const;
DiscreteValues argmax(DiscreteValues given = DiscreteValues()) const;
/// @}
private: