ISAM2Result.h
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
18 // \callgraph
19 
20 #pragma once
21 
22 #include <string>
23 #include <vector>
24 
29 
30 namespace gtsam {
31 
39 struct ISAM2Result {
52  std::optional<double> errorBefore;
53 
64  std::optional<double> errorAfter;
65 
75 
83 
87 
89  size_t cliques;
90 
96 
101 
104 
107 
110 
118  struct VariableStatus {
124  bool isRelinearizeInvolved;
127  bool isRelinearized;
132  bool isObserved;
135  bool isNew;
139  : isReeliminated(false),
140  isAboveRelinThreshold(false),
141  isRelinearizeInvolved(false),
142  isRelinearized(false),
143  isObserved(false),
144  isNew(false),
145  inRootClique(false) {}
146  };
147 
149 
152  };
153 
156  std::optional<DetailedResults> detail;
157 
158  explicit ISAM2Result(bool enableDetailedResults = false) {
159  if (enableDetailedResults) detail = DetailedResults();
160  }
161 
164  if (detail.has_value()) {
165  return &(*detail);
166  } else {
167  return nullptr;
168  }
169  }
170 
172  void print(const std::string str = "") const {
173  using std::cout;
174  cout << str << " Reelimintated: " << variablesReeliminated
175  << " Relinearized: " << variablesRelinearized
176  << " Cliques: " << cliques << std::endl;
177  }
178 
183  size_t getCliques() const { return cliques; }
184  double getErrorBefore() const { return errorBefore ? *errorBefore : std::nan(""); }
185  double getErrorAfter() const { return errorAfter ? *errorAfter : std::nan(""); }
186 };
187 
188 } // namespace gtsam
gtsam::ISAM2Result::DetailedResults::VariableStatus::isNew
bool isNew
Whether the variable itself was just added.
Definition: ISAM2Result.h:136
gtsam::ISAM2Result::print
void print(const std::string str="") const
Print results.
Definition: ISAM2Result.h:172
ISAM2Params.h
Parameters for iSAM 2.
gtsam::ISAM2Result::getVariablesRelinearized
size_t getVariablesRelinearized() const
Definition: ISAM2Result.h:180
gtsam::ISAM2Result::newFactorsIndices
FactorIndices newFactorsIndices
Definition: ISAM2Result.h:95
gtsam::FastMap< Key, VariableStatus >
gtsam::ISAM2Result::getVariablesReeliminated
size_t getVariablesReeliminated() const
Definition: ISAM2Result.h:181
gtsam::ISAM2Result::getErrorBefore
double getErrorBefore() const
Definition: ISAM2Result.h:184
detail
Definition: testSerializationNonlinear.cpp:70
gtsam::FastSet< Key >
gtsam::ISAM2Result::detail
std::optional< DetailedResults > detail
Definition: ISAM2Result.h:156
gtsam::ISAM2Result::markedKeys
KeySet markedKeys
Definition: ISAM2Result.h:109
gtsam::KeyVector
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition: Key.h:92
gtsam::ISAM2Result::ISAM2Result
ISAM2Result(bool enableDetailedResults=false)
Definition: ISAM2Result.h:158
gtsam::ISAM2Result::DetailedResults::VariableStatus::isRelinearized
bool isRelinearized
Definition: ISAM2Result.h:131
gtsam::ISAM2Result::unusedKeys
KeySet unusedKeys
Definition: ISAM2Result.h:100
gtsam::ISAM2Result::DetailedResults::VariableStatus::isObserved
bool isObserved
Definition: ISAM2Result.h:134
gtsam::ISAM2Result::errorBefore
std::optional< double > errorBefore
Definition: ISAM2Result.h:52
gtsam::ISAM2Result::DetailedResults
Definition: ISAM2Result.h:115
gtsam::ISAM2Result::getNewFactorsIndices
FactorIndices getNewFactorsIndices() const
Definition: ISAM2Result.h:182
gtsam::ISAM2Result::DetailedResults::VariableStatus::isRelinearizeInvolved
bool isRelinearizeInvolved
Definition: ISAM2Result.h:126
gtsam::ISAM2Result::variablesRelinearized
size_t variablesRelinearized
Definition: ISAM2Result.h:74
gtsam::ISAM2Result::DetailedResults::variableStatus
StatusMap variableStatus
The status of each variable during this update, see VariableStatus.
Definition: ISAM2Result.h:151
gtsam::ISAM2Result::DetailedResults::VariableStatus
Definition: ISAM2Result.h:118
gtsam::ISAM2Result::DetailedResults::VariableStatus::VariableStatus
VariableStatus()
Definition: ISAM2Result.h:138
gtsam::ISAM2Result::getErrorAfter
double getErrorAfter() const
Definition: ISAM2Result.h:185
gtsam::ISAM2Result::DetailedResults::VariableStatus::isReeliminated
bool isReeliminated
Definition: ISAM2Result.h:122
str
Definition: pytypes.h:1558
gtsam::ISAM2Result::details
DetailedResults * details()
Return pointer to detail, 0 if no detail requested.
Definition: ISAM2Result.h:163
gtsam
traits
Definition: SFMdata.h:40
NonlinearFactorGraph.h
Factor Graph consisting of non-linear factors.
gtsam::ISAM2Result::observedKeys
KeyVector observedKeys
Definition: ISAM2Result.h:103
GaussianBayesTree.h
Gaussian Bayes Tree, the result of eliminating a GaussianJunctionTree.
gtsam::ISAM2Result::keysWithRemovedFactors
KeySet keysWithRemovedFactors
Definition: ISAM2Result.h:106
gtsam::ISAM2Result::DetailedResults::VariableStatus::inRootClique
bool inRootClique
Whether the variable is in the root clique.
Definition: ISAM2Result.h:137
DoglegOptimizerImpl.h
Nonlinear factor graph optimizer using Powell's Dogleg algorithm (detail implementation)
gtsam::ISAM2Result::variablesReeliminated
size_t variablesReeliminated
Definition: ISAM2Result.h:82
gtsam::ISAM2Result
Definition: ISAM2Result.h:39
gtsam::ISAM2Result::errorAfter
std::optional< double > errorAfter
Definition: ISAM2Result.h:64
gtsam::ISAM2Result::factorsRecalculated
size_t factorsRecalculated
Definition: ISAM2Result.h:86
gtsam::ISAM2Result::DetailedResults::VariableStatus::isAboveRelinThreshold
bool isAboveRelinThreshold
Definition: ISAM2Result.h:123
gtsam::ISAM2Result::cliques
size_t cliques
Definition: ISAM2Result.h:89
gtsam::ISAM2Result::getCliques
size_t getCliques() const
Definition: ISAM2Result.h:183
gtsam::FactorIndices
FastVector< FactorIndex > FactorIndices
Define collection types:
Definition: Factor.h:37


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:11:47