For ASPN release, added temporary ENABLE_SPCG flag to avoid conflict with boost::variant
parent
977888e956
commit
b3df8d336a
|
@ -16,6 +16,10 @@
|
|||
* Created October 21, 2010
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#if ENABLE_SPCG
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <gtsam/slam/pose2SLAM.h>
|
||||
|
@ -95,3 +99,11 @@ int main(void) {
|
|||
return 0 ;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int main() {
|
||||
std::cout << "SPCG is currently disabled" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -16,6 +16,10 @@
|
|||
* Created October 21, 2010
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#if ENABLE_SPCG
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <gtsam/slam/pose2SLAM.h>
|
||||
|
@ -73,3 +77,11 @@ int main(void) {
|
|||
return 0 ;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int main() {
|
||||
std::cout << "SPCG is currently disabled" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/graph/prim_minimum_spanning_tree.hpp>
|
||||
#include <boost/iterator/transform_iterator.hpp>
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -44,7 +44,7 @@ ISAM2<CONDITIONAL, VALUES, GRAPH>::ISAM2(const ISAM2Params& params):
|
|||
delta_(Permutation(), deltaUnpermuted_), params_(params) {
|
||||
// See note in gtsam/base/boost_variant_with_workaround.h
|
||||
if(params_.optimizationParams.type() == typeid(ISAM2DoglegParams))
|
||||
doglegDelta_ = variant_workaround::get<ISAM2DoglegParams>(params_.optimizationParams).initialDelta;
|
||||
doglegDelta_ = boost::get<ISAM2DoglegParams>(params_.optimizationParams).initialDelta;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
@ -53,7 +53,7 @@ ISAM2<CONDITIONAL, VALUES, GRAPH>::ISAM2():
|
|||
delta_(Permutation(), deltaUnpermuted_) {
|
||||
// See note in gtsam/base/boost_variant_with_workaround.h
|
||||
if(params_.optimizationParams.type() == typeid(ISAM2DoglegParams))
|
||||
doglegDelta_ = variant_workaround::get<ISAM2DoglegParams>(params_.optimizationParams).initialDelta;
|
||||
doglegDelta_ = boost::get<ISAM2DoglegParams>(params_.optimizationParams).initialDelta;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
@ -533,7 +533,7 @@ ISAM2Result ISAM2<CONDITIONAL, VALUES, GRAPH>::update(
|
|||
if(params_.optimizationParams.type() == typeid(ISAM2GaussNewtonParams)) {
|
||||
// See note in gtsam/base/boost_variant_with_workaround.h
|
||||
const ISAM2GaussNewtonParams& gaussNewtonParams =
|
||||
variant_workaround::get<ISAM2GaussNewtonParams>(params_.optimizationParams);
|
||||
boost::get<ISAM2GaussNewtonParams>(params_.optimizationParams);
|
||||
if (gaussNewtonParams.wildfireThreshold <= 0.0 || disableReordering) {
|
||||
VectorValues newDelta(theta_.dims(ordering_));
|
||||
optimize2(this->root(), newDelta);
|
||||
|
@ -557,7 +557,7 @@ ISAM2Result ISAM2<CONDITIONAL, VALUES, GRAPH>::update(
|
|||
} else if(params_.optimizationParams.type() == typeid(ISAM2DoglegParams)) {
|
||||
// See note in gtsam/base/boost_variant_with_workaround.h
|
||||
const ISAM2DoglegParams& doglegParams =
|
||||
variant_workaround::get<ISAM2DoglegParams>(params_.optimizationParams);
|
||||
boost::get<ISAM2DoglegParams>(params_.optimizationParams);
|
||||
// Do one Dogleg iteration
|
||||
DoglegOptimizerImpl::IterationResult doglegResult = DoglegOptimizerImpl::Iterate(
|
||||
*doglegDelta_, doglegParams.adaptationMode, *this, nonlinearFactors_, theta_, ordering_, nonlinearFactors_.error(theta_), doglegParams.verbose);
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
#include <gtsam/inference/BayesTree.h>
|
||||
|
||||
// Workaround for boost < 1.47, see note in file
|
||||
#include <gtsam/base/boost_variant_with_workaround.h>
|
||||
//#include <gtsam/base/boost_variant_with_workaround.h>
|
||||
#include <boost/variant.hpp>
|
||||
|
||||
namespace gtsam {
|
||||
|
||||
|
|
|
@ -21,7 +21,10 @@
|
|||
#include <gtsam/linear/GaussianSequentialSolver.h>
|
||||
#include <gtsam/linear/GaussianMultifrontalSolver.h>
|
||||
|
||||
#if ENABLE_SPCG
|
||||
#include <gtsam/linear/SubgraphSolver.h>
|
||||
#endif
|
||||
|
||||
#include <gtsam/nonlinear/NonlinearOptimizer.h>
|
||||
|
||||
using namespace std;
|
||||
|
@ -74,6 +77,7 @@ namespace gtsam {
|
|||
return *optimizer.gaussNewton().values();
|
||||
}
|
||||
|
||||
#if ENABLE_SPCG
|
||||
/**
|
||||
* The sparse preconditioned conjugate gradient solver
|
||||
*/
|
||||
|
@ -101,6 +105,7 @@ namespace gtsam {
|
|||
else
|
||||
return *optimizer.gaussNewton().values();
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* optimization that returns the values
|
||||
|
@ -116,10 +121,12 @@ namespace gtsam {
|
|||
case MULTIFRONTAL:
|
||||
return optimizeMultiFrontal<G,T>(graph, initialEstimate, parameters,
|
||||
nonlinear_method == LM);
|
||||
#if ENABLE_SPCG
|
||||
case SPCG:
|
||||
// return optimizeSPCG<G,T>(graph, initialEstimate, parameters,
|
||||
// nonlinear_method == LM);
|
||||
throw runtime_error("optimize: SPCG not supported yet due to the specific pose constraint");
|
||||
#endif
|
||||
}
|
||||
throw runtime_error("optimize: undefined solver");
|
||||
}
|
||||
|
|
|
@ -36,7 +36,9 @@ namespace gtsam {
|
|||
typedef enum {
|
||||
SEQUENTIAL, // Sequential elimination
|
||||
MULTIFRONTAL, // Multi-frontal elimination
|
||||
#if ENABLE_SPCG
|
||||
SPCG, // Subgraph Preconditioned Conjugate Gradient
|
||||
#endif
|
||||
} LinearSolver;
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,6 +14,7 @@ using namespace pose2SLAM;
|
|||
|
||||
const double tol = 1e-5;
|
||||
|
||||
#if ENABLE_SPCG
|
||||
/* ************************************************************************* */
|
||||
TEST(testPose2SLAMwSPCG, example1) {
|
||||
|
||||
|
@ -66,6 +67,7 @@ TEST(testPose2SLAMwSPCG, example1) {
|
|||
|
||||
EXPECT(assert_equal(expected, actual, tol));
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ************************************************************************* */
|
||||
int main() { TestResult tr; return TestRegistry::runAllTests(tr); }
|
||||
|
|
Loading…
Reference in New Issue