METISOrderingExample.cpp
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 
25 #include <gtsam/geometry/Pose2.h>
29 #include <gtsam/nonlinear/Values.h>
31 
32 using namespace std;
33 using namespace gtsam;
34 
35 int main(int argc, char** argv) {
37 
38  Pose2 priorMean(0.0, 0.0, 0.0); // prior at origin
39  auto priorNoise = noiseModel::Diagonal::Sigmas(Vector3(0.3, 0.3, 0.1));
41 
42  Pose2 odometry(2.0, 0.0, 0.0);
43  auto odometryNoise = noiseModel::Diagonal::Sigmas(Vector3(0.2, 0.2, 0.1));
46  graph.print("\nFactor Graph:\n"); // print
47 
49  initial.insert(1, Pose2(0.5, 0.0, 0.2));
50  initial.insert(2, Pose2(2.3, 0.1, -0.2));
51  initial.insert(3, Pose2(4.1, 0.1, 0.1));
52  initial.print("\nInitial Estimate:\n"); // print
53 
54  // optimize using Levenberg-Marquardt optimization
56  // In order to specify the ordering type, we need to se the "orderingType". By
57  // default this parameter is set to OrderingType::COLAMD
58  params.orderingType = Ordering::METIS;
60  Values result = optimizer.optimize();
61  result.print("Final Result:\n");
62 
63  return 0;
64 }
Pose2.h
2D Pose
gtsam::NonlinearOptimizer::optimize
virtual const Values & optimize()
Definition: NonlinearOptimizer.h:98
LevenbergMarquardtOptimizer.h
A nonlinear optimizer that uses the Levenberg-Marquardt trust-region scheme.
initial
Values initial
Definition: OdometryOptimize.cpp:2
priorMean
Pose2 priorMean(0.0, 0.0, 0.0)
gtsam::Vector3
Eigen::Vector3d Vector3
Definition: Vector.h:43
vanilla::params
static const SmartProjectionParams params
Definition: smartFactorScenarios.h:69
result
Values result
Definition: OdometryOptimize.cpp:8
odometry
Pose2 odometry(2.0, 0.0, 0.0)
BetweenFactor.h
gtsam::NonlinearFactorGraph
Definition: NonlinearFactorGraph.h:55
gtsam::NonlinearFactorGraph::addPrior
void addPrior(Key key, const T &prior, const SharedNoiseModel &model=nullptr)
Definition: NonlinearFactorGraph.h:199
gtsam::LevenbergMarquardtOptimizer
Definition: LevenbergMarquardtOptimizer.h:35
priorNoise
auto priorNoise
Definition: doc/Code/OdometryExample.cpp:6
gtsam::Values::print
void print(const std::string &str="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
Definition: Values.cpp:66
gtsam
traits
Definition: SFMdata.h:40
Marginals.h
A class for computing marginals in a NonlinearFactorGraph.
NonlinearFactorGraph.h
Factor Graph consisting of non-linear factors.
gtsam::Values
Definition: Values.h:65
std
Definition: BFloat16.h:88
odometryNoise
auto odometryNoise
Definition: doc/Code/OdometryExample.cpp:11
gtsam::LevenbergMarquardtParams
Definition: LevenbergMarquardtParams.h:35
initial
Definition: testScenarioRunner.cpp:148
main
int main(int argc, char **argv)
Definition: METISOrderingExample.cpp:35
graph
NonlinearFactorGraph graph
Definition: doc/Code/OdometryExample.cpp:2
Values.h
A non-templated config holding any types of Manifold-group elements.
gtsam::FactorGraph::emplace_shared
IsDerived< DERIVEDFACTOR > emplace_shared(Args &&... args)
Emplace a shared pointer to factor of given type.
Definition: FactorGraph.h:153
gtsam::Pose2
Definition: Pose2.h:39
gtsam::BetweenFactor
Definition: BetweenFactor.h:40
gtsam::NonlinearFactorGraph::print
void print(const std::string &str="NonlinearFactorGraph: ", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
Definition: NonlinearFactorGraph.cpp:55


gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:33:48