19 #ifndef OPTIMIZERS_OPTIMIZER_H_
20 #define OPTIMIZERS_OPTIMIZER_H_
24 #include <gtsam/base/Matrix.h>
25 #include <gtsam/inference/Key.h>
26 #include <gtsam/nonlinear/Marginals.h>
27 #include <gtsam/nonlinear/NonlinearFactorGraph.h>
29 #include <boost/optional.hpp>
40 virtual bool Optimize(
const gtsam::NonlinearFactorGraph& factors, gtsam::Values& values) = 0;
44 virtual boost::optional<gtsam::Matrix>
Covariance(
const gtsam::Key& key)
const;
48 boost::optional<gtsam::Matrix>
Covariance(
const gtsam::Key& key_a,
const gtsam::Key& key_b)
const;
51 boost::optional<const gtsam::Marginals&>
marginals()
const;
58 void CalculateMarginals(
const gtsam::NonlinearFactorGraph& factors,
const gtsam::Values& values);
62 void SetMarginalsFactorization();
66 template <
class Archive>
67 void serialize(Archive& ar,
const unsigned int file_version) {
68 ar& BOOST_SERIALIZATION_NVP(params_);
69 ar& BOOST_SERIALIZATION_NVP(marginals_);
70 ar& BOOST_SERIALIZATION_NVP(marginals_factorization_);
74 boost::optional<gtsam::Marginals> marginals_;
75 gtsam::Marginals::Factorization marginals_factorization_;
79 #endif // OPTIMIZERS_OPTIMIZER_H_