/* ---------------------------------------------------------------------------- * 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 * -------------------------------------------------------------------------- */ /** * @file testPCGSolver.cpp * @brief Unit tests for PCGSolver class * @author Yong-Dian Jian */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // for operator += using namespace boost::assign; #include #include using namespace std; using namespace gtsam; const double tol = 1e-3; using symbol_shorthand::X; using symbol_shorthand::L; /* ************************************************************************* */ TEST( NonlinearOptimizer, optimization_method ) { LevenbergMarquardtParams paramsPCG; paramsPCG.linearSolverType = LevenbergMarquardtParams::Iterative; PCGSolverParameters::shared_ptr pcg = boost::make_shared(); pcg->preconditioner_ = boost::make_shared(); paramsPCG.iterativeParams = pcg; NonlinearFactorGraph fg = example::createReallyNonlinearFactorGraph(); Point2 x0(10,10); Values c0; c0.insert(X(1), x0); Values actualPCG = LevenbergMarquardtOptimizer(fg, c0, paramsPCG).optimize(); DOUBLES_EQUAL(0,fg.error(actualPCG),tol); } /* ************************************************************************* */ int main() { TestResult tr; return TestRegistry::runAllTests(tr); }