hybrid folder
parent
d338a7086b
commit
0873ad628e
|
@ -27,6 +27,8 @@
|
||||||
#include <gtsam/linear/GaussianFactor.h>
|
#include <gtsam/linear/GaussianFactor.h>
|
||||||
#include <gtsam/linear/VectorValues.h>
|
#include <gtsam/linear/VectorValues.h>
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
// Forward declarations
|
// Forward declarations
|
||||||
|
|
|
@ -71,8 +71,8 @@ Ordering HybridGaussianISAM::GetOrdering(
|
||||||
void HybridGaussianISAM::updateInternal(
|
void HybridGaussianISAM::updateInternal(
|
||||||
const HybridGaussianFactorGraph& newFactors,
|
const HybridGaussianFactorGraph& newFactors,
|
||||||
HybridBayesTree::Cliques* orphans,
|
HybridBayesTree::Cliques* orphans,
|
||||||
const boost::optional<size_t>& maxNrLeaves,
|
const std::optional<size_t>& maxNrLeaves,
|
||||||
const boost::optional<Ordering>& ordering,
|
const std::optional<Ordering>& ordering,
|
||||||
const HybridBayesTree::Eliminate& function) {
|
const HybridBayesTree::Eliminate& function) {
|
||||||
// Remove the contaminated part of the Bayes tree
|
// Remove the contaminated part of the Bayes tree
|
||||||
BayesNetType bn;
|
BayesNetType bn;
|
||||||
|
@ -116,8 +116,8 @@ void HybridGaussianISAM::updateInternal(
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
void HybridGaussianISAM::update(const HybridGaussianFactorGraph& newFactors,
|
void HybridGaussianISAM::update(const HybridGaussianFactorGraph& newFactors,
|
||||||
const boost::optional<size_t>& maxNrLeaves,
|
const std::optional<size_t>& maxNrLeaves,
|
||||||
const boost::optional<Ordering>& ordering,
|
const std::optional<Ordering>& ordering,
|
||||||
const HybridBayesTree::Eliminate& function) {
|
const HybridBayesTree::Eliminate& function) {
|
||||||
Cliques orphans;
|
Cliques orphans;
|
||||||
this->updateInternal(newFactors, &orphans, maxNrLeaves, ordering, function);
|
this->updateInternal(newFactors, &orphans, maxNrLeaves, ordering, function);
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
#include <gtsam/hybrid/HybridGaussianFactorGraph.h>
|
#include <gtsam/hybrid/HybridGaussianFactorGraph.h>
|
||||||
#include <gtsam/inference/ISAM.h>
|
#include <gtsam/inference/ISAM.h>
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,8 +55,8 @@ class GTSAM_EXPORT HybridGaussianISAM : public ISAM<HybridBayesTree> {
|
||||||
void updateInternal(
|
void updateInternal(
|
||||||
const HybridGaussianFactorGraph& newFactors,
|
const HybridGaussianFactorGraph& newFactors,
|
||||||
HybridBayesTree::Cliques* orphans,
|
HybridBayesTree::Cliques* orphans,
|
||||||
const boost::optional<size_t>& maxNrLeaves = boost::none,
|
const std::optional<size_t>& maxNrLeaves = {},
|
||||||
const boost::optional<Ordering>& ordering = boost::none,
|
const std::optional<Ordering>& ordering = {},
|
||||||
const HybridBayesTree::Eliminate& function =
|
const HybridBayesTree::Eliminate& function =
|
||||||
HybridBayesTree::EliminationTraitsType::DefaultEliminate);
|
HybridBayesTree::EliminationTraitsType::DefaultEliminate);
|
||||||
|
|
||||||
|
@ -68,8 +70,8 @@ class GTSAM_EXPORT HybridGaussianISAM : public ISAM<HybridBayesTree> {
|
||||||
* @param function Elimination function.
|
* @param function Elimination function.
|
||||||
*/
|
*/
|
||||||
void update(const HybridGaussianFactorGraph& newFactors,
|
void update(const HybridGaussianFactorGraph& newFactors,
|
||||||
const boost::optional<size_t>& maxNrLeaves = boost::none,
|
const std::optional<size_t>& maxNrLeaves = {},
|
||||||
const boost::optional<Ordering>& ordering = boost::none,
|
const std::optional<Ordering>& ordering = {},
|
||||||
const HybridBayesTree::Eliminate& function =
|
const HybridBayesTree::Eliminate& function =
|
||||||
HybridBayesTree::EliminationTraitsType::DefaultEliminate);
|
HybridBayesTree::EliminationTraitsType::DefaultEliminate);
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,8 @@ void HybridNonlinearISAM::saveGraph(const string& s,
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
void HybridNonlinearISAM::update(const HybridNonlinearFactorGraph& newFactors,
|
void HybridNonlinearISAM::update(const HybridNonlinearFactorGraph& newFactors,
|
||||||
const Values& initialValues,
|
const Values& initialValues,
|
||||||
const boost::optional<size_t>& maxNrLeaves,
|
const std::optional<size_t>& maxNrLeaves,
|
||||||
const boost::optional<Ordering>& ordering) {
|
const std::optional<Ordering>& ordering) {
|
||||||
if (newFactors.size() > 0) {
|
if (newFactors.size() > 0) {
|
||||||
// Reorder and relinearize every reorderInterval updates
|
// Reorder and relinearize every reorderInterval updates
|
||||||
if (reorderInterval_ > 0 && ++reorderCounter_ >= reorderInterval_) {
|
if (reorderInterval_ > 0 && ++reorderCounter_ >= reorderInterval_) {
|
||||||
|
@ -70,7 +70,7 @@ void HybridNonlinearISAM::reorder_relinearize() {
|
||||||
// Just recreate the whole BayesTree
|
// Just recreate the whole BayesTree
|
||||||
// TODO: allow for constrained ordering here
|
// TODO: allow for constrained ordering here
|
||||||
// TODO: decouple relinearization and reordering to avoid
|
// TODO: decouple relinearization and reordering to avoid
|
||||||
isam_.update(*factors_.linearize(newLinPoint), boost::none, boost::none,
|
isam_.update(*factors_.linearize(newLinPoint), {}, {},
|
||||||
eliminationFunction_);
|
eliminationFunction_);
|
||||||
|
|
||||||
// Update linearization point
|
// Update linearization point
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include <gtsam/hybrid/HybridGaussianISAM.h>
|
#include <gtsam/hybrid/HybridGaussianISAM.h>
|
||||||
#include <gtsam/hybrid/HybridNonlinearFactorGraph.h>
|
#include <gtsam/hybrid/HybridNonlinearFactorGraph.h>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
/**
|
/**
|
||||||
|
@ -119,8 +120,8 @@ class GTSAM_EXPORT HybridNonlinearISAM {
|
||||||
/** Add new factors along with their initial linearization points */
|
/** Add new factors along with their initial linearization points */
|
||||||
void update(const HybridNonlinearFactorGraph& newFactors,
|
void update(const HybridNonlinearFactorGraph& newFactors,
|
||||||
const Values& initialValues,
|
const Values& initialValues,
|
||||||
const boost::optional<size_t>& maxNrLeaves = boost::none,
|
const std::optional<size_t>& maxNrLeaves = {},
|
||||||
const boost::optional<Ordering>& ordering = boost::none);
|
const std::optional<Ordering>& ordering = {});
|
||||||
|
|
||||||
/** Relinearization and reordering of variables */
|
/** Relinearization and reordering of variables */
|
||||||
void reorder_relinearize();
|
void reorder_relinearize();
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace gtsam {
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
void HybridSmoother::update(HybridGaussianFactorGraph graph,
|
void HybridSmoother::update(HybridGaussianFactorGraph graph,
|
||||||
const Ordering &ordering,
|
const Ordering &ordering,
|
||||||
boost::optional<size_t> maxNrLeaves) {
|
std::optional<size_t> maxNrLeaves) {
|
||||||
// Add the necessary conditionals from the previous timestep(s).
|
// Add the necessary conditionals from the previous timestep(s).
|
||||||
std::tie(graph, hybridBayesNet_) =
|
std::tie(graph, hybridBayesNet_) =
|
||||||
addConditionals(graph, hybridBayesNet_, ordering);
|
addConditionals(graph, hybridBayesNet_, ordering);
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
#include <gtsam/hybrid/HybridBayesNet.h>
|
#include <gtsam/hybrid/HybridBayesNet.h>
|
||||||
#include <gtsam/hybrid/HybridGaussianFactorGraph.h>
|
#include <gtsam/hybrid/HybridGaussianFactorGraph.h>
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
class HybridSmoother {
|
class HybridSmoother {
|
||||||
|
@ -48,7 +50,7 @@ class HybridSmoother {
|
||||||
* if applicable
|
* if applicable
|
||||||
*/
|
*/
|
||||||
void update(HybridGaussianFactorGraph graph, const Ordering& ordering,
|
void update(HybridGaussianFactorGraph graph, const Ordering& ordering,
|
||||||
boost::optional<size_t> maxNrLeaves = boost::none);
|
std::optional<size_t> maxNrLeaves = {});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Add conditionals from previous timestep as part of liquefication.
|
* @brief Add conditionals from previous timestep as part of liquefication.
|
||||||
|
|
|
@ -71,7 +71,7 @@ inline HybridBayesNet createHybridBayesNet(size_t num_measurements = 1,
|
||||||
*/
|
*/
|
||||||
inline HybridGaussianFactorGraph createHybridGaussianFactorGraph(
|
inline HybridGaussianFactorGraph createHybridGaussianFactorGraph(
|
||||||
size_t num_measurements = 1,
|
size_t num_measurements = 1,
|
||||||
boost::optional<VectorValues> measurements = boost::none,
|
std::optional<VectorValues> measurements = {},
|
||||||
bool manyModes = false) {
|
bool manyModes = false) {
|
||||||
auto bayesNet = createHybridBayesNet(num_measurements, manyModes);
|
auto bayesNet = createHybridBayesNet(num_measurements, manyModes);
|
||||||
if (measurements) {
|
if (measurements) {
|
||||||
|
|
Loading…
Reference in New Issue