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
void print(const std::string str="") const
Print results.
Definition: ISAM2Result.h:172
bool isNew
Whether the variable itself was just added.
Definition: ISAM2Result.h:136
Factor Graph consisting of non-linear factors.
size_t variablesReeliminated
Definition: ISAM2Result.h:82
FactorIndices getNewFactorsIndices() const
Definition: ISAM2Result.h:182
FactorIndices newFactorsIndices
Definition: ISAM2Result.h:95
FastVector< FactorIndex > FactorIndices
Define collection types:
Definition: Factor.h:36
Nonlinear factor graph optimizer using Powell&#39;s Dogleg algorithm (detail implementation) ...
KeyVector observedKeys
Definition: ISAM2Result.h:103
Definition: pytypes.h:1403
size_t variablesRelinearized
Definition: ISAM2Result.h:74
KeySet keysWithRemovedFactors
Definition: ISAM2Result.h:106
DetailedResults * details()
Return pointer to detail, 0 if no detail requested.
Definition: ISAM2Result.h:163
std::optional< double > errorBefore
Definition: ISAM2Result.h:52
double getErrorAfter() const
Definition: ISAM2Result.h:185
StatusMap variableStatus
The status of each variable during this update, see VariableStatus.
Definition: ISAM2Result.h:151
traits
Definition: chartTesting.h:28
std::optional< double > errorAfter
Definition: ISAM2Result.h:64
bool inRootClique
Whether the variable is in the root clique.
Definition: ISAM2Result.h:137
size_t getVariablesRelinearized() const
Definition: ISAM2Result.h:180
size_t getCliques() const
Definition: ISAM2Result.h:183
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition: Key.h:86
ISAM2Result(bool enableDetailedResults=false)
Definition: ISAM2Result.h:158
Gaussian Bayes Tree, the result of eliminating a GaussianJunctionTree.
double getErrorBefore() const
Definition: ISAM2Result.h:184
std::optional< DetailedResults > detail
Definition: ISAM2Result.h:156
size_t getVariablesReeliminated() const
Definition: ISAM2Result.h:181
Parameters for iSAM 2.
size_t factorsRecalculated
Definition: ISAM2Result.h:86


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:34:26