13 #include <boost/assign/std/list.hpp> 14 #include <boost/assign/std/set.hpp> 15 #include <boost/assign/std/vector.hpp> 17 #include <boost/make_shared.hpp> 22 using namespace gtsam;
47 std::vector<size_t>
keys; keys += 1, 2, 3, 4, 5, 6, 7, 8, 9;
50 list<vector<size_t> > islands =
findIslands(graph, keys, workspace, 7, 2);
52 vector<size_t> island1; island1 += 1, 2, 3, 7, 8;
53 vector<size_t> island2; island2 += 4, 5, 6, 9;
54 CHECK(island1 == islands.front());
55 CHECK(island2 == islands.back());
64 TEST( GenerciGraph, findIslands2 )
80 std::vector<size_t>
keys; keys += 1, 2, 3, 4, 5, 6, 7, 8;
83 list<vector<size_t> > islands =
findIslands(graph, keys, workspace, 7, 2);
85 vector<size_t> island1; island1 += 1, 2, 3, 4, 5, 6, 7, 8;
86 CHECK(island1 == islands.front());
94 TEST ( GenerciGraph, findIslands3 )
102 std::vector<size_t>
keys; keys += 1, 2, 3, 4, 5, 6;
105 list<vector<size_t> > islands =
findIslands(graph, keys, workspace, 7, 2);
107 vector<size_t> island1; island1 += 1, 5;
108 vector<size_t> island2; island2 += 2, 3, 4, 6;
109 CHECK(island1 == islands.front());
110 CHECK(island2 == islands.back());
117 TEST ( GenerciGraph, findIslands4 )
122 std::vector<size_t>
keys; keys += 3, 4, 7;
125 list<vector<size_t> > islands =
findIslands(graph, keys, workspace, 7, 2);
127 vector<size_t> island1; island1 += 3, 4;
128 vector<size_t> island2; island2 += 7;
129 CHECK(island1 == islands.front());
130 CHECK(island2 == islands.back());
139 TEST ( GenerciGraph, findIslands5 )
150 std::vector<size_t>
keys; keys += 1, 2, 3, 4, 5;
153 list<vector<size_t> > islands =
findIslands(graph, keys, workspace, 7, 2);
155 vector<size_t> island1; island1 += 1, 3, 5;
156 vector<size_t> island2; island2 += 2, 4;
157 CHECK(island1 == islands.front());
158 CHECK(island2 == islands.back());
170 graph.
push_back(boost::make_shared<GenericFactor3D>(1, 3));
171 graph.push_back(boost::make_shared<GenericFactor3D>(1, 4));
172 graph.push_back(boost::make_shared<GenericFactor3D>(1, 5));
173 graph.push_back(boost::make_shared<GenericFactor3D>(2, 5));
174 graph.push_back(boost::make_shared<GenericFactor3D>(2, 6));
176 std::vector<size_t> cameraKeys, landmarkKeys;
177 cameraKeys.push_back(1);
178 cameraKeys.push_back(2);
179 landmarkKeys.push_back(3);
180 landmarkKeys.push_back(4);
181 landmarkKeys.push_back(5);
182 landmarkKeys.push_back(6);
184 std::vector<int> dictionary;
185 dictionary.resize(7, -1);
190 std::map<size_t, vector<size_t> > cameraToLandmarks;
202 TEST ( GenericGraph, reduceGenericGraph2 )
212 std::vector<size_t> cameraKeys, landmarkKeys;
213 cameraKeys.push_back(1);
214 cameraKeys.push_back(2);
215 cameraKeys.push_back(7);
216 landmarkKeys.push_back(3);
217 landmarkKeys.push_back(4);
218 landmarkKeys.push_back(5);
219 landmarkKeys.push_back(6);
221 std::vector<int> dictionary;
222 dictionary.resize(8, -1);
228 std::map<size_t, vector<size_t> > cameraToLandmarks;
238 std::set<size_t> cameras1; cameras1 += 1, 2, 3, 4, 5;
239 std::set<size_t> cameras2; cameras2 += 8, 7, 6, 5;
245 TEST ( GenerciGraph, hasCommonCamera2 )
247 std::set<size_t> cameras1; cameras1 += 1, 3, 5, 7;
248 std::set<size_t> cameras2; cameras2 += 2, 4, 6, 8, 10;
list< vector< size_t > > findIslands(const GenericGraph2D &graph, const vector< size_t > &keys, WorkSpace &workspace, const int minNrConstraintsPerCamera, const int minNrConstraintsPerLandmark)
bool hasCommonCamera(const std::set< size_t > &cameras1, const std::set< size_t > &cameras2)
static int runAllTests(TestResult &result)
IsDerived< DERIVEDFACTOR > push_back(boost::shared_ptr< DERIVEDFACTOR > factor)
Add a factor directly using a shared_ptr.
NonlinearFactorGraph graph
const Symbol key1('v', 1)
std::vector< sharedGenericFactor2D > GenericGraph2D
std::vector< sharedGenericFactor3D > GenericGraph3D
void reduceGenericGraph(const GenericGraph3D &graph, const std::vector< size_t > &cameraKeys, const std::vector< size_t > &landmarkKeys, const std::vector< int > &dictionary, GenericGraph3D &reducedGraph)
TEST(GenerciGraph, findIslands)
#define LONGS_EQUAL(expected, actual)
const Symbol key2('v', 2)
std::uint64_t index() const