commit
844520fdbe
|
@ -291,10 +291,7 @@ namespace gtsam {
|
|||
}
|
||||
|
||||
os << "\"" << this->id() << "\" -> \"" << branch->id() << "\"";
|
||||
if (B == 2) {
|
||||
if (i == 0) os << " [style=dashed]";
|
||||
if (i > 1) os << " [style=bold]";
|
||||
}
|
||||
if (B == 2 && i == 0) os << " [style=dashed]";
|
||||
os << std::endl;
|
||||
branch->dot(os, labelFormatter, valueFormatter, showZero);
|
||||
}
|
||||
|
|
|
@ -220,7 +220,7 @@ namespace gtsam {
|
|||
/// @{
|
||||
|
||||
/// Make virtual
|
||||
virtual ~DecisionTree() {}
|
||||
virtual ~DecisionTree() = default;
|
||||
|
||||
/// Check if tree is empty.
|
||||
bool empty() const { return !root_; }
|
||||
|
|
|
@ -209,6 +209,10 @@ class GTSAM_EXPORT DiscreteFactorGraph
|
|||
/// @}
|
||||
}; // \ DiscreteFactorGraph
|
||||
|
||||
std::pair<DiscreteConditional::shared_ptr, DecisionTreeFactor::shared_ptr> //
|
||||
EliminateForMPE(const DiscreteFactorGraph& factors,
|
||||
const Ordering& frontalKeys);
|
||||
|
||||
/// traits
|
||||
template <>
|
||||
struct traits<DiscreteFactorGraph> : public Testable<DiscreteFactorGraph> {};
|
||||
|
|
|
@ -361,7 +361,7 @@ class FactorGraph {
|
|||
* less than the original, factors at the end will be removed. If the new
|
||||
* size is larger than the original, null factors will be appended.
|
||||
*/
|
||||
void resize(size_t size) { factors_.resize(size); }
|
||||
virtual void resize(size_t size) { factors_.resize(size); }
|
||||
|
||||
/** delete factor without re-arranging indexes by inserting a nullptr pointer
|
||||
*/
|
||||
|
|
|
@ -283,6 +283,17 @@ void Ordering::print(const std::string& str,
|
|||
cout.flush();
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
Ordering::This& Ordering::operator+=(KeyVector& keys) {
|
||||
this->insert(this->end(), keys.begin(), keys.end());
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
bool Ordering::contains(const Key& key) const {
|
||||
return std::find(this->begin(), this->end(), key) != this->end();
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
bool Ordering::equals(const Ordering& other, double tol) const {
|
||||
return (*this) == other;
|
||||
|
|
|
@ -70,7 +70,23 @@ public:
|
|||
boost::assign_detail::call_push_back<This>(*this))(key);
|
||||
}
|
||||
|
||||
/// Invert (not reverse) the ordering - returns a map from key to order position
|
||||
/**
|
||||
* @brief Append new keys to the ordering as `ordering += keys`.
|
||||
*
|
||||
* @param key
|
||||
* @return The ordering variable with appended keys.
|
||||
*/
|
||||
This& operator+=(KeyVector& keys);
|
||||
|
||||
/// Check if key exists in ordering.
|
||||
bool contains(const Key& key) const;
|
||||
|
||||
/**
|
||||
* @brief Invert (not reverse) the ordering - returns a map from key to order
|
||||
* position.
|
||||
*
|
||||
* @return FastMap<Key, size_t>
|
||||
*/
|
||||
FastMap<Key, size_t> invert() const;
|
||||
|
||||
/// @name Fill-reducing Orderings @{
|
||||
|
|
|
@ -199,6 +199,32 @@ TEST(Ordering, csr_format_3) {
|
|||
EXPECT(adjExpected == adjAcutal);
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
TEST(Ordering, AppendVector) {
|
||||
using symbol_shorthand::X;
|
||||
Ordering actual;
|
||||
KeyVector keys = {X(0), X(1), X(2)};
|
||||
actual += keys;
|
||||
|
||||
Ordering expected;
|
||||
expected += X(0);
|
||||
expected += X(1);
|
||||
expected += X(2);
|
||||
EXPECT(assert_equal(expected, actual));
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
TEST(Ordering, Contains) {
|
||||
using symbol_shorthand::X;
|
||||
Ordering ordering;
|
||||
ordering += X(0);
|
||||
ordering += X(1);
|
||||
ordering += X(2);
|
||||
|
||||
EXPECT(ordering.contains(X(1)));
|
||||
EXPECT(!ordering.contains(X(4)));
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
#ifdef GTSAM_SUPPORT_NESTED_DISSECTION
|
||||
TEST(Ordering, csr_format_4) {
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace gtsam {
|
|||
/// @name Standard Constructors
|
||||
/// @{
|
||||
|
||||
/** Construct empty factor graph */
|
||||
/** Construct empty bayes net */
|
||||
GaussianBayesNet() {}
|
||||
|
||||
/** Construct from iterator over conditionals */
|
||||
|
|
|
@ -15,10 +15,10 @@
|
|||
* @author Christian Potthast, Frank Dellaert
|
||||
*/
|
||||
|
||||
#include <gtsam/linear/linearExceptions.h>
|
||||
#include <gtsam/linear/GaussianConditional.h>
|
||||
#include <gtsam/linear/VectorValues.h>
|
||||
#include <gtsam/linear/Sampler.h>
|
||||
#include <gtsam/linear/VectorValues.h>
|
||||
#include <gtsam/linear/linearExceptions.h>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
#ifdef __GNUC__
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <gtsam/global_includes.h>
|
||||
#include <gtsam/linear/JacobianFactor.h>
|
||||
#include <gtsam/inference/Conditional.h>
|
||||
#include <gtsam/inference/Conditional-inst.h>
|
||||
#include <gtsam/linear/VectorValues.h>
|
||||
|
||||
#include <random> // for std::mt19937_64
|
||||
|
|
Loading…
Reference in New Issue