From ec5149265a778554325cf4dfa5bda3285de4d76d Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sat, 7 Jan 2023 06:33:30 -0500 Subject: [PATCH] remove extraneous file --- gtsam/hybrid/tests/testHybridPruning.cpp | 158 ----------------------- 1 file changed, 158 deletions(-) delete mode 100644 gtsam/hybrid/tests/testHybridPruning.cpp diff --git a/gtsam/hybrid/tests/testHybridPruning.cpp b/gtsam/hybrid/tests/testHybridPruning.cpp deleted file mode 100644 index 2e564013d..000000000 --- a/gtsam/hybrid/tests/testHybridPruning.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/* ---------------------------------------------------------------------------- - - * 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 testHybridPruning.cpp - * @brief Unit tests for end-to-end Hybrid Estimation - * @author Varun Agrawal - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Include for test suite -#include - -#include "Switching.h" - -using namespace std; -using namespace gtsam; - -using symbol_shorthand::X; - -/****************************************************************************/ -// Test approximate inference with an additional pruning step. -TEST_DISABLED(HybridPruning, ISAM) { - size_t K = 16; - std::vector measurements = {0, 1, 2, 2, 2, 2, 3, 4, 5, 6, 6, - 7, 8, 9, 9, 9, 10, 11, 11, 11, 11}; - // Ground truth discrete seq - std::vector discrete_seq = {1, 1, 0, 0, 0, 1, 1, 1, 1, 0, - 1, 1, 1, 0, 0, 1, 1, 0, 0, 0}; - // Switching example of robot moving in 1D - // with given measurements and equal mode priors. - Switching switching(K, 1.0, 0.1, measurements, "1/1 1/1"); - HybridNonlinearISAM isam; - HybridNonlinearFactorGraph graph; - Values initial; - - // Add the X(0) prior - graph.push_back(switching.nonlinearFactorGraph.at(0)); - initial.insert(X(0), switching.linearizationPoint.at(X(0))); - - HybridGaussianFactorGraph linearized; - HybridGaussianFactorGraph bayesNet; - - for (size_t k = 1; k < K; k++) { - // Motion Model - graph.push_back(switching.nonlinearFactorGraph.at(k)); - // Measurement - graph.push_back(switching.nonlinearFactorGraph.at(k + K - 1)); - - initial.insert(X(k), switching.linearizationPoint.at(X(k))); - - isam.update(graph, initial, 3); - graph.resize(0); - initial.clear(); - } - - Values result = isam.estimate(); - DiscreteValues assignment = isam.assignment(); - - DiscreteValues expected_discrete; - for (size_t k = 0; k < K - 1; k++) { - expected_discrete[M(k)] = discrete_seq[k]; - } - - std::cout << "\n\n\nNonlinear Version!!\n\n" << std::endl; - GTSAM_PRINT(expected_discrete); - GTSAM_PRINT(assignment); - EXPECT(assert_equal(expected_discrete, assignment)); - - Values expected_continuous; - for (size_t k = 0; k < K; k++) { - expected_continuous.insert(X(k), measurements[k]); - } - EXPECT(assert_equal(expected_continuous, result)); -} - -/****************************************************************************/ -// Test approximate inference with an additional pruning step. -TEST(HybridPruning, GaussianISAM) { - size_t K = 16; - std::vector measurements = {0, 1, 2, 2, 2, 2, 3, 4, 5, 6, 6, - 7, 8, 9, 9, 9, 10, 11, 11, 11, 11}; - // Ground truth discrete seq - std::vector discrete_seq = {1, 1, 0, 0, 0, 1, 1, 1, 1, 0, - 1, 1, 1, 0, 0, 1, 1, 0, 0, 0}; - // Switching example of robot moving in 1D - // with given measurements and equal mode priors. - Switching switching(K, 1.0, 0.1, measurements, "1/1 1/1"); - HybridGaussianISAM isam; - HybridGaussianFactorGraph graph; - Values initial; - - // Add the X(0) prior - graph.push_back(switching.linearizedFactorGraph.at(0)); - initial.insert(X(0), switching.linearizationPoint.at(X(0))); - - HybridGaussianFactorGraph linearized; - HybridGaussianFactorGraph bayesNet; - - for (size_t k = 1; k < K; k++) { - // Motion Model - graph.push_back(switching.linearizedFactorGraph.at(k)); - // Measurement - graph.push_back(switching.linearizedFactorGraph.at(k + K - 1)); - - // initial.insert(X(k), switching.linearizationPoint.at(X(k))); - - isam.update(graph, 3); - graph.resize(0); - // initial.clear(); - } - - HybridValues values = isam.optimize(); - - DiscreteValues expected_discrete; - for (size_t k = 0; k < K - 1; k++) { - expected_discrete[M(k)] = discrete_seq[k]; - } - - EXPECT(assert_equal(expected_discrete, values.discrete())); - - // Values expected_continuous; - // for (size_t k = 0; k < K; k++) { - // expected_continuous.insert(X(k), measurements[k]); - // } - // EXPECT(assert_equal(expected_continuous, result)); -} - -/* ************************************************************************* */ -int main() { - TestResult tr; - return TestRegistry::runAllTests(tr); -} -/* ************************************************************************* */