Merge remote-tracking branch 'origin/fix/Bayestree_in_out' into feature/iSAM2_refactor

# Conflicts:
#	gtsam/inference/BayesTree-inst.h
#	gtsam/nonlinear/ISAM2.cpp
release/4.3a0
Frank Dellaert 2019-06-03 15:32:56 -04:00
commit d385c1e698
13 changed files with 248 additions and 170 deletions

View File

@ -22,19 +22,8 @@ function build_and_test ()
sudo update-alternatives --set gcc /usr/bin/gcc-$GCC_VERSION sudo update-alternatives --set gcc /usr/bin/gcc-$GCC_VERSION
fi fi
# gcc is too slow and we have a time limit in Travis CI: selective builds.
if [ "$BUILD_EXAMPLES" == "1" ]; then
GTSAM_BUILD_EXAMPLES_ALWAYS=ON
else
GTSAM_BUILD_EXAMPLES_ALWAYS=OFF
fi
if [ "$RUN_TESTS" == "1" ]; then
GTSAM_BUILD_TESTS=ON
else
GTSAM_BUILD_TESTS=OFF
fi
cmake $SOURCE_DIR \ cmake $SOURCE_DIR \
-DGTSAM_BUILD_UNSTABLE=$GTSAM_BUILD_UNSTABLE \
-DGTSAM_BUILD_EXAMPLES_ALWAYS=$GTSAM_BUILD_EXAMPLES_ALWAYS \ -DGTSAM_BUILD_EXAMPLES_ALWAYS=$GTSAM_BUILD_EXAMPLES_ALWAYS \
-DGTSAM_BUILD_TESTS=$GTSAM_BUILD_TESTS -DGTSAM_BUILD_TESTS=$GTSAM_BUILD_TESTS
@ -42,10 +31,13 @@ function build_and_test ()
make -j2 make -j2
# Run tests: # Run tests:
if [ "$RUN_TESTS" == "1" ]; then if [ "$GTSAM_BUILD_TESTS" == "ON" ]; then
make check make check
fi fi
# Print ccache stats
ccache -s
cd $SOURCE_DIR cd $SOURCE_DIR
} }

View File

@ -16,8 +16,12 @@ addons:
- libpython-dev python-numpy - libpython-dev python-numpy
- libboost-all-dev - libboost-all-dev
before_install: # before_install:
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update ; fi # - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update ; fi
install:
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache ; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then export PATH="/usr/local/opt/ccache/libexec:$PATH" ; fi
script: script:
- bash .travis.sh - bash .travis.sh
@ -27,23 +31,24 @@ env:
- MAKEFLAGS="-j 2" - MAKEFLAGS="-j 2"
- CCACHE_SLOPPINESS=pch_defines,time_macros - CCACHE_SLOPPINESS=pch_defines,time_macros
# gcc is too slow and we have a time limit in Travis CI: selective builds.
matrix: matrix:
include: include:
- compiler: gcc - compiler: gcc
os: linux os: linux
env: BUILD_EXAMPLES=1 env: GTSAM_BUILD_UNSTABLE=ON GTSAM_BUILD_EXAMPLES_ALWAYS=ON GTSAM_BUILD_TESTS=OFF
- compiler: gcc - compiler: gcc
os: linux os: linux
env: RUN_TESTS=1 env: GTSAM_BUILD_UNSTABLE=OFF GTSAM_BUILD_EXAMPLES_ALWAYS=OFF GTSAM_BUILD_TESTS=ON # gcc too slow for all tests
- compiler: gcc - compiler: gcc
os: linux os: linux
env: BUILD_EXAMPLES=1 GCC_VERSION="8" env: GTSAM_BUILD_UNSTABLE=ON GTSAM_BUILD_EXAMPLES_ALWAYS=ON GTSAM_BUILD_TESTS=OFF GCC_VERSION="8"
- compiler: clang - compiler: clang
os: linux os: linux
env: BUILD_EXAMPLES=1 env: GTSAM_BUILD_UNSTABLE=ON GTSAM_BUILD_EXAMPLES_ALWAYS=ON GTSAM_BUILD_TESTS=OFF
- compiler: gcc # - compiler: gcc
os: osx # os: osx
env: BUILD_EXAMPLES=1 # env: GTSAM_BUILD_UNSTABLE=ON GTSAM_BUILD_EXAMPLES_ALWAYS=ON GTSAM_BUILD_TESTS=OFF
- compiler: clang - compiler: clang
os: osx os: osx
env: RUN_TESTS=1 env: GTSAM_BUILD_UNSTABLE=ON GTSAM_BUILD_EXAMPLES_ALWAYS=OFF GTSAM_BUILD_TESTS=ON

View File

@ -314,6 +314,29 @@ else()
set(GTSAM_EIGEN_INCLUDE_FOR_BUILD "${CMAKE_SOURCE_DIR}/gtsam/3rdparty/Eigen/") set(GTSAM_EIGEN_INCLUDE_FOR_BUILD "${CMAKE_SOURCE_DIR}/gtsam/3rdparty/Eigen/")
endif() endif()
# Detect Eigen version:
set(EIGEN_VER_H "${GTSAM_EIGEN_INCLUDE_FOR_BUILD}/Eigen/src/Core/util/Macros.h")
if (EXISTS ${EIGEN_VER_H})
file(READ "${EIGEN_VER_H}" STR_EIGEN_VERSION)
# Extract the Eigen version from the Macros.h file, lines "#define EIGEN_WORLD_VERSION XX", etc...
string(REGEX MATCH "EIGEN_WORLD_VERSION[ ]+[0-9]+" GTSAM_EIGEN_VERSION_WORLD "${STR_EIGEN_VERSION}")
string(REGEX MATCH "[0-9]+" GTSAM_EIGEN_VERSION_WORLD "${GTSAM_EIGEN_VERSION_WORLD}")
string(REGEX MATCH "EIGEN_MAJOR_VERSION[ ]+[0-9]+" GTSAM_EIGEN_VERSION_MAJOR "${STR_EIGEN_VERSION}")
string(REGEX MATCH "[0-9]+" GTSAM_EIGEN_VERSION_MAJOR "${GTSAM_EIGEN_VERSION_MAJOR}")
string(REGEX MATCH "EIGEN_MINOR_VERSION[ ]+[0-9]+" GTSAM_EIGEN_VERSION_MINOR "${STR_EIGEN_VERSION}")
string(REGEX MATCH "[0-9]+" GTSAM_EIGEN_VERSION_MINOR "${GTSAM_EIGEN_VERSION_MINOR}")
set(GTSAM_EIGEN_VERSION "${GTSAM_EIGEN_VERSION_WORLD}.${GTSAM_EIGEN_VERSION_MAJOR}.${GTSAM_EIGEN_VERSION_MINOR}")
message(STATUS "Found Eigen version: ${GTSAM_EIGEN_VERSION}")
else()
message(WARNING "Cannot determine Eigen version, missing file: `${EIGEN_VER_H}`")
endif ()
if (MSVC) if (MSVC)
if (BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
# mute eigen static assert to avoid errors in shared lib # mute eigen static assert to avoid errors in shared lib
@ -499,11 +522,7 @@ if(NOT MSVC AND NOT XCODE_VERSION)
message(STATUS " C compilation flags : ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${cmake_build_type_toupper}}") message(STATUS " C compilation flags : ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${cmake_build_type_toupper}}")
message(STATUS " C++ compilation flags : ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${cmake_build_type_toupper}}") message(STATUS " C++ compilation flags : ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${cmake_build_type_toupper}}")
endif() endif()
if(GTSAM_USE_SYSTEM_EIGEN) message(STATUS " Use System Eigen : ${GTSAM_USE_SYSTEM_EIGEN} (Using version: ${GTSAM_EIGEN_VERSION})")
message(STATUS " Use System Eigen : Yes")
else()
message(STATUS " Use System Eigen : No")
endif()
if(GTSAM_USE_TBB) if(GTSAM_USE_TBB)
message(STATUS " Use Intel TBB : Yes") message(STATUS " Use Intel TBB : Yes")
elseif(TBB_FOUND) elseif(TBB_FOUND)

View File

@ -8,7 +8,6 @@
%% Saved with string encoding Unicode (UTF-8) %% Saved with string encoding Unicode (UTF-8)
@webpage{Hauser06lecture, @webpage{Hauser06lecture,
Author = {Raphael Hauser}, Author = {Raphael Hauser},
Date-Added = {2011-10-10 15:21:22 +0000}, Date-Added = {2011-10-10 15:21:22 +0000},
@ -16,11 +15,5 @@
Title = {Lecture Notes on Unconstrained Optimization}, Title = {Lecture Notes on Unconstrained Optimization},
Url = {http://www.numerical.rl.ac.uk/nimg/oupartc/lectures/raphael/}, Url = {http://www.numerical.rl.ac.uk/nimg/oupartc/lectures/raphael/},
Year = {2006}, Year = {2006},
Bdsk-Url-1 = {http://www.numerical.rl.ac.uk/nimg/oupartc/lectures/raphael/}, howpublished = {\href{http://www.numerical.rl.ac.uk/nimg/oupartc/lectures/raphael/}{link}},
Bdsk-File-1 = {YnBsaXN0MDDUAQIDBAUIJidUJHRvcFgkb2JqZWN0c1gkdmVyc2lvblkkYXJjaGl2ZXLRBgdUcm9vdIABqAkKFR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U0tleWVkQXJjaGl2ZXIACAARABYAHwAoADIANQA6ADwARQBLAFIAXQBlAGwAbwBxAHMAdgB4AHoAfACGAJMAmACgAjACMgI3AkACSwJPAl0CZAJtApQCmQKcAqkCrgAAAAAAAAIBAAAAAAAAACgAAAAAAAAAAAAAAAAAAALA}}

View File

@ -1,10 +1,11 @@
#LyX 2.0 created this file. For more info see http://www.lyx.org/ #LyX 2.1 created this file. For more info see http://www.lyx.org/
\lyxformat 413 \lyxformat 474
\begin_document \begin_document
\begin_header \begin_header
\textclass article \textclass article
\begin_preamble \begin_preamble
\usepackage{amssymb} \usepackage{url}
\usepackage{hyperref}
\end_preamble \end_preamble
\use_default_options true \use_default_options true
\maintain_unincluded_children false \maintain_unincluded_children false
@ -15,13 +16,13 @@
\font_roman default \font_roman default
\font_sans default \font_sans default
\font_typewriter default \font_typewriter default
\font_math auto
\font_default_family default \font_default_family default
\use_non_tex_fonts false \use_non_tex_fonts false
\font_sc false \font_sc false
\font_osf false \font_osf false
\font_sf_scale 100 \font_sf_scale 100
\font_tt_scale 100 \font_tt_scale 100
\graphics default \graphics default
\default_output_format default \default_output_format default
\output_sync 0 \output_sync 0
@ -32,15 +33,24 @@
\use_hyperref false \use_hyperref false
\papersize default \papersize default
\use_geometry false \use_geometry false
\use_amsmath 1 \use_package amsmath 1
\use_esint 1 \use_package amssymb 2
\use_mhchem 1 \use_package cancel 1
\use_mathdots 1 \use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 0
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic \cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false \use_bibtopic false
\use_indices false \use_indices false
\paperorientation portrait \paperorientation portrait
\suppress_date false \suppress_date false
\justification true
\use_refstyle 1 \use_refstyle 1
\index Index \index Index
\shortcut idx \shortcut idx
@ -231,7 +241,7 @@ key "Hauser06lecture"
\end_inset \end_inset
(in our /net/hp223/borg/Literature folder). .
\end_layout \end_layout
\begin_layout Standard \begin_layout Standard
@ -465,22 +475,39 @@ where
\end_inset \end_inset
. .
A typical update rule [ A typical update rule, as per Lec.
\color blue 7-1.2 of
see where this came from in paper \begin_inset CommandInset citation
\color inherit LatexCommand cite
] is key "Hauser06lecture"
\end_inset
is:
\begin_inset Formula \begin_inset Formula
\[ \[
\Delta\leftarrow\begin{cases} \Delta_{k+1}\leftarrow\begin{cases}
\max\left(\Delta,3\norm{\delta x_{d}}\right)\text{,} & \rho>0.75\\ \Delta_{k}/4 & \rho<0.25\\
\Delta & 0.75>\rho>0.25\\ \min\left(2\Delta_{k},\Delta_{max}\right)\text{,} & \rho>0.75\\
\Delta/2 & 0.25>\rho \Delta_{k} & 0.75>\rho>0.25
\end{cases} \end{cases}
\] \]
\end_inset \end_inset
where
\begin_inset Formula $\Delta_{k}\triangleq\norm{\delta x_{d}}$
\end_inset
.
Note that the rule is designed to ensure that
\begin_inset Formula $\Delta_{k}$
\end_inset
never exceeds the maximum trust region size
\begin_inset Formula $\Delta_{max}.$
\end_inset
\end_layout \end_layout
@ -593,9 +620,9 @@ To find the intersection of the line between
\begin{align*} \begin{align*}
\Delta & =\norm{\left(1-\tau\right)\delta x_{u}+\tau\delta x_{n}}\\ \Delta & =\norm{\left(1-\tau\right)\delta x_{u}+\tau\delta x_{n}}\\
\Delta^{2} & =\left(1-\tau\right)^{2}\delta x_{u}^{\t}\delta x_{u}+2\tau\left(1-\tau\right)\delta x_{u}^{\t}\delta x_{n}+\tau^{2}\delta x_{n}^{\t}\delta x_{n}\\ \Delta^{2} & =\left(1-\tau\right)^{2}\delta x_{u}^{\t}\delta x_{u}+2\tau\left(1-\tau\right)\delta x_{u}^{\t}\delta x_{n}+\tau^{2}\delta x_{n}^{\t}\delta x_{n}\\
0 & =uu-2\tau uu+\tau^{2}uu+2\tau un-2\tau^{2}un+\tau^{2}nn-\Delta^{2}\\ 0 & =\delta x_{u}^{\t}\delta x_{u}-2\tau\delta x_{u}^{\t}\delta x_{u}+\tau^{2}\delta x_{u}^{\t}\delta x_{u}+2\tau\delta x_{u}^{\t}\delta x_{n}-2\tau^{2}\delta x_{u}^{\t}\delta x_{n}+\tau^{2}\delta x_{n}^{\t}\delta x_{n}-\Delta^{2}\\
0 & =\left(uu-2un+nn\right)\tau^{2}+\left(2un-2uu\right)\tau-\Delta^{2}+uu\\ 0 & =\left(\delta x_{u}^{\t}\delta x_{u}-2\delta x_{u}^{\t}\delta x_{n}+\delta x_{n}^{\t}\delta x_{n}\right)\tau^{2}+\left(2\delta x_{u}^{\t}\delta x_{n}-2\delta x_{u}^{\t}\delta x_{u}\right)\tau-\Delta^{2}+\delta x_{u}^{\t}\delta x_{u}\\
\tau & =\frac{-\left(2un-2uu\right)\pm\sqrt{\left(2un-2uu\right)^{2}-4\left(uu-2un+nn\right)\left(uu-\Delta^{2}\right)}}{2\left(uu-un+nn\right)} \tau & =\frac{-\left(2\delta x_{u}^{\t}\delta x_{n}-2\delta x_{u}^{\t}\delta x_{u}\right)\pm\sqrt{\left(2\delta x_{u}^{\t}\delta x_{n}-2\delta x_{u}^{\t}\delta x_{u}\right)^{2}-4\left(\delta x_{u}^{\t}\delta x_{u}-2\delta x_{u}^{\t}\delta x_{n}+\delta x_{n}^{\t}\delta x_{n}\right)\left(\delta x_{u}^{\t}\delta x_{u}-\Delta^{2}\right)}}{2\left(\delta x_{u}^{\t}\delta x_{u}-\delta x_{u}^{\t}\delta x_{n}+\delta x_{n}^{\t}\delta x_{n}\right)}
\end{align*} \end{align*}
\end_inset \end_inset
@ -641,7 +668,7 @@ Thus, mathematically, we can write the dogleg update
\begin_inset Formula \begin_inset Formula
\[ \[
\delta x_{d}^{\left(k\right)}=\begin{cases} \delta x_{d}^{\left(k\right)}=\begin{cases}
-\frac{\Delta}{\norm{g^{\left(k\right)}}}g^{\left(k\right)}\text{,} & \Delta<\norm{\delta x_{u}^{\left(k\right)}}\\ -\frac{\Delta}{\norm{\delta x_{u}^{\left(k\right)}}}\delta x_{u}^{\left(k\right)}\text{,} & \Delta<\norm{\delta x_{u}^{\left(k\right)}}\\
\left(1-\tau^{\left(k\right)}\right)\delta x_{u}^{\left(k\right)}+\tau^{\left(k\right)}\delta x_{n}^{\left(k\right)}\text{,} & \norm{\delta x_{u}^{\left(k\right)}}<\Delta<\norm{\delta x_{n}^{\left(k\right)}}\\ \left(1-\tau^{\left(k\right)}\right)\delta x_{u}^{\left(k\right)}+\tau^{\left(k\right)}\delta x_{n}^{\left(k\right)}\text{,} & \norm{\delta x_{u}^{\left(k\right)}}<\Delta<\norm{\delta x_{n}^{\left(k\right)}}\\
\delta x_{n}^{\left(k\right)}\text{,} & \norm{\delta x_{n}^{\left(k\right)}}<\Delta \delta x_{n}^{\left(k\right)}\text{,} & \norm{\delta x_{n}^{\left(k\right)}}<\Delta
\end{cases} \end{cases}

Binary file not shown.

View File

@ -63,6 +63,19 @@ GTSAM_MAKE_VECTOR_DEFS(12);
typedef Eigen::VectorBlock<Vector> SubVector; typedef Eigen::VectorBlock<Vector> SubVector;
typedef Eigen::VectorBlock<const Vector> ConstSubVector; typedef Eigen::VectorBlock<const Vector> ConstSubVector;
/**
* Ensure we are not including a different version of Eigen in user code than
* while compiling gtsam, since it can lead to hard-to-understand runtime
* crashes.
*/
#if defined(GTSAM_EIGEN_VERSION_WORLD)
static_assert(
GTSAM_EIGEN_VERSION_WORLD==EIGEN_WORLD_VERSION &&
GTSAM_EIGEN_VERSION_MAJOR==EIGEN_MAJOR_VERSION &&
GTSAM_EIGEN_VERSION_MINOR==EIGEN_MINOR_VERSION,
"Error: GTSAM was built against a different version of Eigen");
#endif
/** /**
* print without optional string, must specify cout yourself * print without optional string, must specify cout yourself
*/ */

View File

@ -52,6 +52,12 @@
// Whether Eigen with MKL will use OpenMP (if OpenMP was found, Eigen uses MKL, and GTSAM_WITH_EIGEN_MKL_OPENMP is enabled in CMake) // Whether Eigen with MKL will use OpenMP (if OpenMP was found, Eigen uses MKL, and GTSAM_WITH_EIGEN_MKL_OPENMP is enabled in CMake)
#cmakedefine GTSAM_USE_EIGEN_MKL_OPENMP #cmakedefine GTSAM_USE_EIGEN_MKL_OPENMP
// Eigen library version (needed to avoid mixing versions, which often leads
// to segfaults)
#cmakedefine GTSAM_EIGEN_VERSION_WORLD @GTSAM_EIGEN_VERSION_WORLD@
#cmakedefine GTSAM_EIGEN_VERSION_MAJOR @GTSAM_EIGEN_VERSION_MAJOR@
#cmakedefine GTSAM_EIGEN_VERSION_MINOR @GTSAM_EIGEN_VERSION_MINOR@
// The default allocator to use // The default allocator to use
#cmakedefine GTSAM_ALLOCATOR_BOOSTPOOL #cmakedefine GTSAM_ALLOCATOR_BOOSTPOOL
#cmakedefine GTSAM_ALLOCATOR_TBB #cmakedefine GTSAM_ALLOCATOR_TBB

View File

@ -36,19 +36,20 @@ namespace gtsam {
/* ************************************************************************* */ /* ************************************************************************* */
template<class CLIQUE> template<class CLIQUE>
BayesTreeCliqueData BayesTree<CLIQUE>::getCliqueData() const { BayesTreeCliqueData BayesTree<CLIQUE>::getCliqueData() const {
BayesTreeCliqueData data; BayesTreeCliqueData stats;
for(const sharedClique& root: roots_) for (const sharedClique& root : roots_) getCliqueData(root, &stats);
getCliqueData(data, root); return stats;
return data;
} }
/* ************************************************************************* */ /* ************************************************************************* */
template<class CLIQUE> template <class CLIQUE>
void BayesTree<CLIQUE>::getCliqueData(BayesTreeCliqueData& data, sharedClique clique) const { void BayesTree<CLIQUE>::getCliqueData(sharedClique clique,
data.conditionalSizes.push_back(clique->conditional()->nrFrontals()); BayesTreeCliqueData* stats) const {
data.separatorSizes.push_back(clique->conditional()->nrParents()); const auto conditional = clique->conditional();
for(sharedClique c: clique->children) { stats->conditionalSizes.push_back(conditional->nrFrontals());
getCliqueData(data, c); stats->separatorSizes.push_back(conditional->nrParents());
for (sharedClique c : clique->children) {
getCliqueData(c, stats);
} }
} }
@ -133,34 +134,26 @@ namespace gtsam {
} }
/* ************************************************************************* */ /* ************************************************************************* */
// TODO: Clean up
namespace { namespace {
template<class FACTOR, class CLIQUE> template <class FACTOR, class CLIQUE>
int _pushClique(FactorGraph<FACTOR>& fg, const boost::shared_ptr<CLIQUE>& clique) { struct _pushCliqueFunctor {
fg.push_back(clique->conditional_); _pushCliqueFunctor(FactorGraph<FACTOR>* graph_) : graph(graph_) {}
FactorGraph<FACTOR>* graph;
int operator()(const boost::shared_ptr<CLIQUE>& clique, int dummy) {
graph->push_back(clique->conditional_);
return 0; return 0;
} }
};
template<class FACTOR, class CLIQUE> } // namespace
struct _pushCliqueFunctor {
_pushCliqueFunctor(FactorGraph<FACTOR>& graph_) : graph(graph_) {}
FactorGraph<FACTOR>& graph;
int operator()(const boost::shared_ptr<CLIQUE>& clique, int dummy) {
graph.push_back(clique->conditional_);
return 0;
}
};
}
/* ************************************************************************* */ /* ************************************************************************* */
template<class CLIQUE> template <class CLIQUE>
void BayesTree<CLIQUE>::addFactorsToGraph(FactorGraph<FactorType>& graph) const void BayesTree<CLIQUE>::addFactorsToGraph(
{ FactorGraph<FactorType>* graph) const {
// Traverse the BayesTree and add all conditionals to this graph // Traverse the BayesTree and add all conditionals to this graph
int data = 0; // Unused int data = 0; // Unused
_pushCliqueFunctor<FactorType,CLIQUE> functor(graph); _pushCliqueFunctor<FactorType, CLIQUE> functor(graph);
treeTraversal::DepthFirstForest(*this, data, functor); // FIXME: sort of works? treeTraversal::DepthFirstForest(*this, data, functor);
// treeTraversal::DepthFirstForest(*this, data, boost::bind(&_pushClique<FactorType,CLIQUE>, boost::ref(graph), _1));
} }
/* ************************************************************************* */ /* ************************************************************************* */
@ -434,51 +427,51 @@ namespace gtsam {
} }
/* ************************************************************************* */ /* ************************************************************************* */
template<class CLIQUE> template <class CLIQUE>
void BayesTree<CLIQUE>::removePath(sharedClique clique, BayesNetType& bn, Cliques& orphans) void BayesTree<CLIQUE>::removePath(sharedClique clique, BayesNetType* bn,
{ Cliques* orphans) {
// base case is NULL, if so we do nothing and return empties above // base case is NULL, if so we do nothing and return empties above
if (clique) { if (clique) {
// remove the clique from orphans in case it has been added earlier // remove the clique from orphans in case it has been added earlier
orphans.remove(clique); orphans->remove(clique);
// remove me // remove me
this->removeClique(clique); this->removeClique(clique);
// remove path above me // remove path above me
this->removePath(typename Clique::shared_ptr(clique->parent_.lock()), bn, orphans); this->removePath(typename Clique::shared_ptr(clique->parent_.lock()), bn,
orphans);
// add children to list of orphans (splice also removed them from clique->children_) // add children to list of orphans (splice also removed them from
orphans.insert(orphans.begin(), clique->children.begin(), clique->children.end()); // clique->children_)
orphans->insert(orphans->begin(), clique->children.begin(),
clique->children.end());
clique->children.clear(); clique->children.clear();
bn.push_back(clique->conditional_); bn->push_back(clique->conditional_);
} }
} }
/* ************************************************************************* */ /* *************************************************************************
template<class CLIQUE> */
void BayesTree<CLIQUE>::removeTop(const KeyVector& keys, BayesNetType& bn, Cliques& orphans) template <class CLIQUE>
{ void BayesTree<CLIQUE>::removeTop(const KeyVector& keys, BayesNetType* bn,
Cliques* orphans) {
gttic(removetop); gttic(removetop);
// process each key of the new factor // process each key of the new factor
for(const Key& j: keys) for (const Key& j : keys) {
{
// get the clique // get the clique
// TODO: Nodes will be searched again in removeClique // TODO(frank): Nodes will be searched again in removeClique
typename Nodes::const_iterator node = nodes_.find(j); typename Nodes::const_iterator node = nodes_.find(j);
if(node != nodes_.end()) { if (node != nodes_.end()) {
// remove path from clique to root // remove path from clique to root
this->removePath(node->second, bn, orphans); this->removePath(node->second, bn, orphans);
} }
} }
// Delete cachedShortcuts for each orphan subtree // Delete cachedShortcuts for each orphan subtree
//TODO: Consider Improving // TODO(frank): Consider Improving
for(sharedClique& orphan: orphans) for (sharedClique& orphan : *orphans) orphan->deleteCachedShortcuts();
orphan->deleteCachedShortcuts();
} }
/* ************************************************************************* */ /* ************************************************************************* */

View File

@ -208,13 +208,13 @@ namespace gtsam {
* Remove path from clique to root and return that path as factors * Remove path from clique to root and return that path as factors
* plus a list of orphaned subtree roots. Used in removeTop below. * plus a list of orphaned subtree roots. Used in removeTop below.
*/ */
void removePath(sharedClique clique, BayesNetType& bn, Cliques& orphans); void removePath(sharedClique clique, BayesNetType* bn, Cliques* orphans);
/** /**
* Given a list of indices, turn "contaminated" part of the tree back into a factor graph. * Given a list of indices, turn "contaminated" part of the tree back into a factor graph.
* Factors and orphans are added to the in/out arguments. * Factors and orphans are added to the in/out arguments.
*/ */
void removeTop(const KeyVector& keys, BayesNetType& bn, Cliques& orphans); void removeTop(const KeyVector& keys, BayesNetType* bn, Cliques* orphans);
/** /**
* Remove the requested subtree. */ * Remove the requested subtree. */
@ -229,7 +229,7 @@ namespace gtsam {
void addClique(const sharedClique& clique, const sharedClique& parent_clique = sharedClique()); void addClique(const sharedClique& clique, const sharedClique& parent_clique = sharedClique());
/** Add all cliques in this BayesTree to the specified factor graph */ /** Add all cliques in this BayesTree to the specified factor graph */
void addFactorsToGraph(FactorGraph<FactorType>& graph) const; void addFactorsToGraph(FactorGraph<FactorType>* graph) const;
protected: protected:
@ -238,7 +238,7 @@ namespace gtsam {
int parentnum = 0) const; int parentnum = 0) const;
/** Gather data on a single clique */ /** Gather data on a single clique */
void getCliqueData(BayesTreeCliqueData& stats, sharedClique clique) const; void getCliqueData(sharedClique clique, BayesTreeCliqueData* stats) const;
/** remove a clique: warning, can result in a forest */ /** remove a clique: warning, can result in a forest */
void removeClique(sharedClique clique); void removeClique(sharedClique clique);
@ -249,7 +249,26 @@ namespace gtsam {
// Friend JunctionTree because it directly fills roots and nodes index. // Friend JunctionTree because it directly fills roots and nodes index.
template<class BAYESRTEE, class GRAPH> friend class EliminatableClusterTree; template<class BAYESRTEE, class GRAPH> friend class EliminatableClusterTree;
private: #ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V4
public:
/// @name Deprecated
/// @{
void removePath(sharedClique clique, BayesNetType& bn, Cliques& orphans) {
removePath(clique, &bn, &orphans);
}
void removeTop(const KeyVector& keys, BayesNetType& bn, Cliques& orphans) {
removeTop(keys, &bn, &orphans);
}
void getCliqueData(BayesTreeCliqueData& stats, sharedClique clique) const {
getCliqueData(clique, &stats);
}
void addFactorsToGraph(FactorGraph<FactorType>& graph) const{
addFactorsToGraph(& graph);
}
/// @}
#endif
private:
/** Serialization function */ /** Serialization function */
friend class boost::serialization::access; friend class boost::serialization::access;
template<class ARCHIVE> template<class ARCHIVE>

View File

@ -270,7 +270,7 @@ class FactorGraph {
typename std::enable_if< typename std::enable_if<
std::is_base_of<This, typename CLIQUE::FactorGraphType>::value>::type std::is_base_of<This, typename CLIQUE::FactorGraphType>::value>::type
push_back(const BayesTree<CLIQUE>& bayesTree) { push_back(const BayesTree<CLIQUE>& bayesTree) {
bayesTree.addFactorsToGraph(*this); bayesTree.addFactorsToGraph(this);
} }
/** /**

View File

@ -24,14 +24,14 @@ namespace gtsam {
/* ************************************************************************* */ /* ************************************************************************* */
template<class BAYESTREE> template<class BAYESTREE>
void ISAM<BAYESTREE>::update_internal(const FactorGraphType& newFactors, void ISAM<BAYESTREE>::updateInternal(const FactorGraphType& newFactors,
Cliques& orphans, const Eliminate& function) { Cliques* orphans, const Eliminate& function) {
// Remove the contaminated part of the Bayes tree // Remove the contaminated part of the Bayes tree
BayesNetType bn; BayesNetType bn;
const KeySet newFactorKeys = newFactors.keys(); const KeySet newFactorKeys = newFactors.keys();
if (!this->empty()) { if (!this->empty()) {
KeyVector keyVector(newFactorKeys.begin(), newFactorKeys.end()); KeyVector keyVector(newFactorKeys.begin(), newFactorKeys.end());
this->removeTop(keyVector, bn, orphans); this->removeTop(keyVector, &bn, orphans);
} }
// Add the removed top and the new factors // Add the removed top and the new factors
@ -40,7 +40,7 @@ void ISAM<BAYESTREE>::update_internal(const FactorGraphType& newFactors,
factors += newFactors; factors += newFactors;
// Add the orphaned subtrees // Add the orphaned subtrees
for (const sharedClique& orphan : orphans) for (const sharedClique& orphan : *orphans)
factors += boost::make_shared<BayesTreeOrphanWrapper<Clique> >(orphan); factors += boost::make_shared<BayesTreeOrphanWrapper<Clique> >(orphan);
// Get an ordering where the new keys are eliminated last // Get an ordering where the new keys are eliminated last
@ -62,7 +62,7 @@ template<class BAYESTREE>
void ISAM<BAYESTREE>::update(const FactorGraphType& newFactors, void ISAM<BAYESTREE>::update(const FactorGraphType& newFactors,
const Eliminate& function) { const Eliminate& function) {
Cliques orphans; Cliques orphans;
this->update_internal(newFactors, orphans, function); this->updateInternal(newFactors, &orphans, function);
} }
} }

View File

@ -22,56 +22,67 @@
namespace gtsam { namespace gtsam {
/**
* A Bayes tree with an update methods that implements the iSAM algorithm.
* Given a set of new factors, it re-eliminates the invalidated part of the
* tree. \nosubgrouping
*/
template <class BAYESTREE>
class ISAM : public BAYESTREE {
public:
typedef BAYESTREE Base;
typedef typename Base::BayesNetType BayesNetType;
typedef typename Base::FactorGraphType FactorGraphType;
typedef typename Base::Clique Clique;
typedef typename Base::sharedClique sharedClique;
typedef typename Base::Cliques Cliques;
private:
typedef typename Base::Eliminate Eliminate;
typedef typename Base::EliminationTraitsType EliminationTraitsType;
public:
/// @name Standard Constructors
/// @{
/** Create an empty Bayes Tree */
ISAM() {}
/** Copy constructor */
explicit ISAM(const Base& bayesTree) : Base(bayesTree) {}
/// @}
/// @name Advanced Interface Interface
/// @{
/** /**
* A Bayes tree with an update methods that implements the iSAM algorithm. * update the Bayes tree with a set of new factors, typically derived from
* Given a set of new factors, it re-eliminates the invalidated part of the tree. * measurements
* \nosubgrouping * @param newFactors is a factor graph that contains the new factors
* @param function an elimination routine
*/ */
template<class BAYESTREE> void update(
class ISAM: public BAYESTREE const FactorGraphType& newFactors,
{
public:
typedef BAYESTREE Base;
typedef typename Base::BayesNetType BayesNetType;
typedef typename Base::FactorGraphType FactorGraphType;
typedef typename Base::Clique Clique;
typedef typename Base::sharedClique sharedClique;
typedef typename Base::Cliques Cliques;
private:
typedef typename Base::Eliminate Eliminate;
typedef typename Base::EliminationTraitsType EliminationTraitsType;
public:
/// @name Standard Constructors
/// @{
/** Create an empty Bayes Tree */
ISAM() {}
/** Copy constructor */
ISAM(const Base& bayesTree) : Base(bayesTree) {}
/// @}
/// @name Advanced Interface Interface
/// @{
/**
* update the Bayes tree with a set of new factors, typically derived from measurements
* @param newFactors is a factor graph that contains the new factors
* @param function an elimination routine
*/
void update(const FactorGraphType& newFactors, const Eliminate& function = EliminationTraitsType::DefaultEliminate);
/** update_internal provides access to list of orphans for drawing purposes */
void update_internal(const FactorGraphType& newFactors, Cliques& orphans,
const Eliminate& function = EliminationTraitsType::DefaultEliminate); const Eliminate& function = EliminationTraitsType::DefaultEliminate);
/// @} /** updateInternal provides access to list of orphans for drawing purposes
*/
void updateInternal(
const FactorGraphType& newFactors, Cliques* orphans,
const Eliminate& function = EliminationTraitsType::DefaultEliminate);
}; /// @}
}/// namespace gtsam #ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V4
/// @name Deprecated
/// @{
void update_internal(
const FactorGraphType& newFactors, Cliques& orphans,
const Eliminate& function = EliminationTraitsType::DefaultEliminate) {
updateInternal(newFactors, &orphans, function);
}
/// @}
#endif
};
} // namespace gtsam