Loading...
Searching...
No Matches
ISAM2Result.h
Go to the documentation of this file.
/* ----------------------------------------------------------------------------
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
* Atlanta, Georgia 30332-0415
* All Rights Reserved
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
* See LICENSE for the license information
* -------------------------------------------------------------------------- */
// \callgraph
#pragma once
#include <string>
#include <vector>
#include <gtsam/linear/GaussianBayesTree.h>
#include <gtsam/nonlinear/DoglegOptimizerImpl.h>
#include <gtsam/nonlinear/ISAM2Params.h>
#include <gtsam/nonlinear/NonlinearFactorGraph.h>
#include <boost/variant.hpp>
namespace gtsam {
struct ISAM2Result {
boost::optional<double> errorBefore;
boost::optional<double> errorAfter;
size_t variablesRelinearized;
size_t variablesReeliminated;
size_t factorsRecalculated;
size_t cliques;
FactorIndices newFactorsIndices;
KeySet unusedKeys;
KeyVector observedKeys;
KeySet keysWithRemovedFactors;
KeySet markedKeys;
struct DetailedResults {
struct VariableStatus {
bool isReeliminated;
bool isAboveRelinThreshold;
bool isRelinearizeInvolved;
bool isRelinearized;
bool isObserved;
bool isNew;
bool inRootClique;
VariableStatus()
: isReeliminated(false),
isAboveRelinThreshold(false),
isRelinearizeInvolved(false),
isRelinearized(false),
isObserved(false),
isNew(false),
inRootClique(false) {}
};
using StatusMap = FastMap<Key, VariableStatus>;
StatusMap variableStatus;
};
boost::optional<DetailedResults> detail;
explicit ISAM2Result(bool enableDetailedResults = false) {
if (enableDetailedResults) detail.reset(DetailedResults());
}
DetailedResults* details() { return detail.get_ptr(); }
void print(const std::string str = "") const {
using std::cout;
cout << str << " Reelimintated: " << variablesReeliminated
<< " Relinearized: " << variablesRelinearized
<< " Cliques: " << cliques << std::endl;
}
size_t getVariablesRelinearized() const { return variablesRelinearized; }
size_t getVariablesReeliminated() const { return variablesReeliminated; }
FactorIndices getNewFactorsIndices() const { return newFactorsIndices; }
size_t getCliques() const { return cliques; }
double getErrorBefore() const { return errorBefore ? *errorBefore : std::nan(""); }
double getErrorAfter() const { return errorAfter ? *errorAfter : std::nan(""); }
};
} // namespace gtsam
GaussianBayesTree.h
Gaussian Bayes Tree, the result of eliminating a GaussianJunctionTree.
DoglegOptimizerImpl.h
Nonlinear factor graph optimizer using Powell's Dogleg algorithm (detail implementation).
ISAM2Params.h
Parameters for iSAM 2.
NonlinearFactorGraph.h
Factor Graph consisting of non-linear factors.
gtsam
Global functions in a separate testing namespace.
Definition chartTesting.h:28
gtsam::KeyVector
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition Key.h:86
gtsam::FactorIndices
FastVector< FactorIndex > FactorIndices
Define collection types:
Definition Factor.h:34
gtsam::FastMap
FastMap is a thin wrapper around std::map that uses the boost fast_pool_allocator instead of the defa...
Definition FastMap.h:38
gtsam::ISAM2Result::variablesRelinearized
size_t variablesRelinearized
The number of variables that were relinearized because their linear deltas exceeded the reslinearizat...
Definition ISAM2Result.h:76
gtsam::ISAM2Result::getVariablesRelinearized
size_t getVariablesRelinearized() const
Getters and Setters.
Definition ISAM2Result.h:176
gtsam::ISAM2Result::factorsRecalculated
size_t factorsRecalculated
The number of factors that were included in reelimination of the Bayes' tree.
Definition ISAM2Result.h:88
gtsam::ISAM2Result::details
DetailedResults * details()
Return pointer to detail, 0 if no detail requested.
Definition ISAM2Result.h:165
gtsam::ISAM2Result::errorBefore
boost::optional< double > errorBefore
The nonlinear error of all of the factors, including new factors and variables added during the curre...
Definition ISAM2Result.h:54
gtsam::ISAM2Result::print
void print(const std::string str="") const
Print results.
Definition ISAM2Result.h:168
gtsam::ISAM2Result::detail
boost::optional< DetailedResults > detail
Detailed results, if enabled by ISAM2Params::enableDetailedResults.
Definition ISAM2Result.h:158
gtsam::ISAM2Result::cliques
size_t cliques
The number of cliques in the Bayes' Tree.
Definition ISAM2Result.h:91
gtsam::ISAM2Result::keysWithRemovedFactors
KeySet keysWithRemovedFactors
Keys of variables that had factors removed.
Definition ISAM2Result.h:108
gtsam::ISAM2Result::variablesReeliminated
size_t variablesReeliminated
The number of variables that were reeliminated as parts of the Bayes' Tree were recalculated,...
Definition ISAM2Result.h:84
gtsam::ISAM2Result::unusedKeys
KeySet unusedKeys
Unused keys, and indices for unused keys, i.e., keys that are empty now and do not appear in the new ...
Definition ISAM2Result.h:102
gtsam::ISAM2Result::observedKeys
KeyVector observedKeys
keys for variables that were observed, i.e., not unused.
Definition ISAM2Result.h:105
gtsam::ISAM2Result::markedKeys
KeySet markedKeys
All keys that were marked during the update process.
Definition ISAM2Result.h:111
gtsam::ISAM2Result::newFactorsIndices
FactorIndices newFactorsIndices
The indices of the newly-added factors, in 1-to-1 correspondence with the factors passed as newFactor...
Definition ISAM2Result.h:97
gtsam::ISAM2Result::errorAfter
boost::optional< double > errorAfter
The nonlinear error of all of the factors computed after the current update, meaning that variables a...
Definition ISAM2Result.h:66
gtsam::ISAM2Result::DetailedResults
A struct holding detailed results, which must be enabled with ISAM2Params::enableDetailedResults.
Definition ISAM2Result.h:117
gtsam::ISAM2Result::DetailedResults::variableStatus
StatusMap variableStatus
The status of each variable during this update, see VariableStatus.
Definition ISAM2Result.h:153
gtsam::ISAM2Result::DetailedResults::VariableStatus::isRelinearizeInvolved
bool isRelinearizeInvolved
Whether the variable was below the relinearization threshold but was relinearized by being involved i...
Definition ISAM2Result.h:128
gtsam::ISAM2Result::DetailedResults::VariableStatus::isObserved
bool isObserved
Whether the variable was relinearized, either by being above the relinearization threshold or by invo...
Definition ISAM2Result.h:136
gtsam::ISAM2Result::DetailedResults::VariableStatus::isNew
bool isNew
Whether the variable itself was just added.
Definition ISAM2Result.h:138
gtsam::ISAM2Result::DetailedResults::VariableStatus::isAboveRelinThreshold
bool isAboveRelinThreshold
Whether the variable was just relinearized due to being above the relinearization threshold.
Definition ISAM2Result.h:125
gtsam::ISAM2Result::DetailedResults::VariableStatus::isReeliminated
bool isReeliminated
Whether the variable was just reeliminated, due to being relinearized, observed, new,...
Definition ISAM2Result.h:124
gtsam::ISAM2Result::DetailedResults::VariableStatus::inRootClique
bool inRootClique
Whether the variable is in the root clique.
Definition ISAM2Result.h:139