updates to fix various issues
parent
125708fbb7
commit
03314ed781
|
@ -322,8 +322,7 @@ size_t DiscreteConditional::sample(const DiscreteValues& parentsValues) const {
|
||||||
return distribution(rng);
|
return distribution(rng);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********************************************************************************
|
/* ************************************************************************** */
|
||||||
*/
|
|
||||||
size_t DiscreteConditional::sample(size_t parent_value) const {
|
size_t DiscreteConditional::sample(size_t parent_value) const {
|
||||||
if (nrParents() != 1)
|
if (nrParents() != 1)
|
||||||
throw std::invalid_argument(
|
throw std::invalid_argument(
|
||||||
|
@ -334,8 +333,7 @@ size_t DiscreteConditional::sample(size_t parent_value) const {
|
||||||
return sample(values);
|
return sample(values);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********************************************************************************
|
/* ************************************************************************** */
|
||||||
*/
|
|
||||||
size_t DiscreteConditional::sample() const {
|
size_t DiscreteConditional::sample() const {
|
||||||
if (nrParents() != 0)
|
if (nrParents() != 0)
|
||||||
throw std::invalid_argument(
|
throw std::invalid_argument(
|
||||||
|
|
|
@ -163,14 +163,6 @@ class GTSAM_EXPORT DiscreteFactorGraph
|
||||||
*/
|
*/
|
||||||
DiscreteValues optimize(const Ordering& ordering) const;
|
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
|
/// @name Wrapper support
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
* -------------------------------------------------------------------------- */
|
* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file DiscreteLookupTable.cpp
|
* @file DiscreteLookupDAG.cpp
|
||||||
* @date Feb 14, 2011
|
* @date Feb 14, 2011
|
||||||
* @author Duy-Nguyen Ta
|
* @author Duy-Nguyen Ta
|
||||||
* @author Frank Dellaert
|
* @author Frank Dellaert
|
||||||
|
@ -116,12 +116,6 @@ DiscreteLookupDAG DiscreteLookupDAG::FromBayesNet(
|
||||||
return dag;
|
return dag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************** */
|
|
||||||
DiscreteValues DiscreteLookupDAG::argmax() const {
|
|
||||||
DiscreteValues result;
|
|
||||||
return argmax(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
DiscreteValues DiscreteLookupDAG::argmax(DiscreteValues result) const {
|
DiscreteValues DiscreteLookupDAG::argmax(DiscreteValues result) const {
|
||||||
// Argmax each node in turn in topological sort order (parents first).
|
// Argmax each node in turn in topological sort order (parents first).
|
||||||
for (auto lookupTable : boost::adaptors::reverse(*this))
|
for (auto lookupTable : boost::adaptors::reverse(*this))
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file DiscreteLookupDAG.h
|
* @file DiscreteLookupDAG.h
|
||||||
* @date JAnuary, 2022
|
* @date January, 2022
|
||||||
* @author Frank dellaert
|
* @author Frank dellaert
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ class DiscreteBayesNet;
|
||||||
* @brief DiscreteLookupTable table for max-product
|
* @brief DiscreteLookupTable table for max-product
|
||||||
*
|
*
|
||||||
* Inherits from discrete conditional for convenience, but is not normalized.
|
* 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 {
|
class DiscreteLookupTable : public DiscreteConditional {
|
||||||
public:
|
public:
|
||||||
|
@ -85,7 +85,7 @@ class GTSAM_EXPORT DiscreteLookupDAG : public BayesNet<DiscreteLookupTable> {
|
||||||
/// Construct empty DAG.
|
/// Construct empty DAG.
|
||||||
DiscreteLookupDAG() {}
|
DiscreteLookupDAG() {}
|
||||||
|
|
||||||
// Create from BayesNet with LookupTables
|
/// Create from BayesNet with LookupTables
|
||||||
static DiscreteLookupDAG FromBayesNet(const DiscreteBayesNet& bayesNet);
|
static DiscreteLookupDAG FromBayesNet(const DiscreteBayesNet& bayesNet);
|
||||||
|
|
||||||
/// Destructor
|
/// 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
|
* Assumes the DAG is reverse topologically sorted, i.e. last
|
||||||
* conditional will be optimized first. If the DAG resulted from
|
* conditional will be optimized first *and* that the
|
||||||
* eliminating a factor graph, this is true for the elimination ordering.
|
* 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
|
||||||
* @return optimal assignment for all variables.
|
* ordering.
|
||||||
*/
|
|
||||||
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.
|
|
||||||
*
|
*
|
||||||
* @return given assignment extended w. optimal assignment for all variables.
|
* @return given assignment extended w. optimal assignment for all variables.
|
||||||
*/
|
*/
|
||||||
DiscreteValues argmax(DiscreteValues given) const;
|
DiscreteValues argmax(DiscreteValues given = DiscreteValues()) const;
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue