36 using namespace gtsam;
98 auto discreteConditional_m0 =
isam[
M(0)]->conditional()->asDiscrete();
110 const auto [expectedHybridBayesTree, expectedRemainingGraph] =
114 auto x0_conditional = dynamic_pointer_cast<HybridGaussianConditional>(
115 isam[
X(0)]->conditional()->inner());
116 auto expected_x0_conditional =
117 dynamic_pointer_cast<HybridGaussianConditional>(
118 (*expectedHybridBayesTree)[
X(0)]->conditional()->inner());
122 auto x1_conditional = dynamic_pointer_cast<HybridGaussianConditional>(
123 isam[
X(1)]->conditional()->inner());
124 auto expected_x1_conditional =
125 dynamic_pointer_cast<HybridGaussianConditional>(
126 (*expectedHybridBayesTree)[
X(1)]->conditional()->inner());
130 auto x2_conditional = dynamic_pointer_cast<HybridGaussianConditional>(
131 isam[
X(2)]->conditional()->inner());
132 auto expected_x2_conditional =
133 dynamic_pointer_cast<HybridGaussianConditional>(
134 (*expectedHybridBayesTree)[
X(2)]->conditional()->inner());
141 expectedRemainingGraph->eliminateMultifrontal(discreteOrdering);
144 auto discrete =
isam[
M(1)]->conditional()->asDiscrete();
152 auto expectedConditional = (*discreteBayesTree)[
M(1)]->conditional();
153 auto actualConditional =
isam[
M(1)]->conditional();
165 for (
size_t i = 0;
i < 3;
i++) {
171 for (
size_t i = 0;
i <= 3;
i++) {
177 for (
size_t j = 0;
j < 4;
j++) {
182 const auto [unPrunedHybridBayesTree, unPrunedRemainingGraph] =
185 size_t maxNrLeaves = 5;
188 incrementalHybrid.
prune(maxNrLeaves);
224 auto discreteConditional_m0 = *dynamic_pointer_cast<DiscreteConditional>(
225 incrementalHybrid[
M(0)]->conditional()->inner());
229 auto count = [](
const double &
value,
int count) {
230 return value > 0 ? count + 1 : count;
237 auto &unPrunedLastDensity = *dynamic_pointer_cast<HybridGaussianConditional>(
238 unPrunedHybridBayesTree->clique(
X(3))->conditional()->inner());
239 auto &lastDensity = *dynamic_pointer_cast<HybridGaussianConditional>(
240 incrementalHybrid[
X(3)]->conditional()->inner());
242 std::vector<std::pair<DiscreteValues, double>> assignments =
243 discreteConditional_m0.enumerate();
245 for (
auto &&av : assignments) {
247 const double value = av.second;
250 EXPECT(lastDensity(assignment) ==
nullptr);
252 CHECK(lastDensity(assignment));
254 *lastDensity(assignment)));
268 for (
size_t i = 0;
i < 3;
i++) {
274 for (
size_t i = 0;
i <= 3;
i++) {
279 size_t maxComponents = 5;
286 2, incrementalHybrid[
X(0)]->conditional()->asHybrid()->nrComponents());
288 3, incrementalHybrid[
X(1)]->conditional()->asHybrid()->nrComponents());
290 5, incrementalHybrid[
X(2)]->conditional()->asHybrid()->nrComponents());
292 5, incrementalHybrid[
X(3)]->conditional()->asHybrid()->nrComponents());
306 5, incrementalHybrid[
X(3)]->conditional()->asHybrid()->nrComponents());
308 5, incrementalHybrid[
X(4)]->conditional()->asHybrid()->nrComponents());
324 auto priorNoise = noiseModel::Diagonal::Sigmas(
329 auto poseNoise = noiseModel::Isotropic::Sigma(3, 0.1);
366 auto noise_model = noiseModel::Isotropic::Sigma(3, 1.0);
367 std::vector<NoiseModelFactor::shared_ptr>
components;
475 auto discreteTree = inc[
M(3)]->conditional()->asDiscrete();
484 expected_assignment[
M(1)] = 1;
485 expected_assignment[
M(2)] = 1;
486 expected_assignment[
M(3)] = 1;
492 auto lastConditional = inc[
X(3)]->conditional()->asHybrid();